pyadps 0.1.1__py3-none-any.whl → 0.1.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyadps/pages/01_Read_File.py +3 -2
- pyadps/pages/03_Download_Raw_File.py +56 -9
- pyadps/pages/06_Profile_Test.py +10 -10
- pyadps/pages/08_Write_File.py +23 -4
- pyadps/utils/profile_test.py +228 -2
- {pyadps-0.1.1.dist-info → pyadps-0.1.2.dist-info}/METADATA +1 -1
- pyadps-0.1.2.dist-info/RECORD +33 -0
- pyadps/pages/__pycache__/__init__.cpython-312.pyc +0 -0
- pyadps/utils/__pycache__/__init__.cpython-312.pyc +0 -0
- pyadps/utils/__pycache__/autoprocess.cpython-312.pyc +0 -0
- pyadps/utils/__pycache__/cutbin.cpython-312.pyc +0 -0
- pyadps/utils/__pycache__/plotgen.cpython-312.pyc +0 -0
- pyadps/utils/__pycache__/profile_test.cpython-312.pyc +0 -0
- pyadps/utils/__pycache__/pyreadrdi.cpython-312.pyc +0 -0
- pyadps/utils/__pycache__/readrdi.cpython-312.pyc +0 -0
- pyadps/utils/__pycache__/regrid.cpython-312.pyc +0 -0
- pyadps/utils/__pycache__/script.cpython-312.pyc +0 -0
- pyadps/utils/__pycache__/sensor_health.cpython-312.pyc +0 -0
- pyadps/utils/__pycache__/signal_quality.cpython-312.pyc +0 -0
- pyadps/utils/__pycache__/velocity_test.cpython-312.pyc +0 -0
- pyadps/utils/__pycache__/writenc.cpython-312.pyc +0 -0
- pyadps-0.1.1.dist-info/RECORD +0 -47
- {pyadps-0.1.1.dist-info → pyadps-0.1.2.dist-info}/LICENSE +0 -0
- {pyadps-0.1.1.dist-info → pyadps-0.1.2.dist-info}/WHEEL +0 -0
- {pyadps-0.1.1.dist-info → pyadps-0.1.2.dist-info}/entry_points.txt +0 -0
pyadps/pages/01_Read_File.py
CHANGED
@@ -20,10 +20,10 @@ if "fname" not in st.session_state:
|
|
20
20
|
st.session_state.fname = "No file selected"
|
21
21
|
|
22
22
|
if "rawfilename" not in st.session_state:
|
23
|
-
st.session_state.rawfilename = "
|
23
|
+
st.session_state.rawfilename = "RAW_DAT.nc"
|
24
24
|
|
25
25
|
if "vleadfilename" not in st.session_state:
|
26
|
-
st.session_state.vleadfilename = "
|
26
|
+
st.session_state.vleadfilename = "RAW_VAR.nc"
|
27
27
|
|
28
28
|
|
29
29
|
################ Functions #######################
|
@@ -132,6 +132,7 @@ if uploaded_file is not None:
|
|
132
132
|
st.session_state.salinity = (
|
133
133
|
ds.variableleader.salinity.data * ds.variableleader.salinity.scale
|
134
134
|
)
|
135
|
+
st.session_state.filename = (ds.filename)
|
135
136
|
|
136
137
|
# st.session_state.flead = flead
|
137
138
|
# st.session_state.vlead = vlead
|
@@ -18,13 +18,13 @@ if "fname" not in st.session_state:
|
|
18
18
|
st.session_state.fname = "No file selected"
|
19
19
|
|
20
20
|
if "rawfilename" not in st.session_state:
|
21
|
-
st.session_state.rawfilename = "
|
21
|
+
st.session_state.rawfilename = "RAW_DAT.nc"
|
22
22
|
|
23
23
|
if "fleadfilename" not in st.session_state:
|
24
|
-
st.session_state.fleadfilename = "
|
24
|
+
st.session_state.fleadfilename = "RAW_FIX.nc"
|
25
25
|
|
26
26
|
if "vleadfilename" not in st.session_state:
|
27
|
-
st.session_state.vleadfilename = "
|
27
|
+
st.session_state.vleadfilename = "RAW_VAR.nc"
|
28
28
|
|
29
29
|
if "attributes" not in st.session_state:
|
30
30
|
st.session_state.attributes = {}
|
@@ -32,6 +32,19 @@ if "attributes" not in st.session_state:
|
|
32
32
|
if "add_attributes_DRW" not in st.session_state:
|
33
33
|
st.session_state.add_attributes_DRW = "No" # Default value
|
34
34
|
|
35
|
+
if "file_prefix" not in st.session_state:
|
36
|
+
raw_basename = os.path.basename(st.session_state.fname)
|
37
|
+
st.session_state.filename = os.path.splitext(raw_basename)[0]
|
38
|
+
st.session_state.file_prefix = st.session_state.filename
|
39
|
+
|
40
|
+
|
41
|
+
if "prefix_saved" not in st.session_state:
|
42
|
+
st.session_state.prefix_saved = False
|
43
|
+
|
44
|
+
if "filename" not in st.session_state:
|
45
|
+
st.session_state.filename = "" # <-- Default file name if not passed
|
46
|
+
|
47
|
+
|
35
48
|
|
36
49
|
################ Functions #######################
|
37
50
|
@st.cache_data()
|
@@ -50,11 +63,18 @@ def read_file(filepath):
|
|
50
63
|
ds.fixensemble()
|
51
64
|
st.session_state.ds = ds
|
52
65
|
|
66
|
+
@st.cache_data
|
67
|
+
def get_prefixed_filename(base_name):
|
68
|
+
"""Generates the file name with the optional prefix."""
|
69
|
+
if st.session_state.file_prefix:
|
70
|
+
return f"{st.session_state.file_prefix}_{base_name}"
|
71
|
+
return base_name
|
72
|
+
|
53
73
|
|
54
74
|
@st.cache_data
|
55
75
|
def file_write(path, axis_option, add_attributes=True):
|
56
76
|
tempdirname = tempfile.TemporaryDirectory(delete=False)
|
57
|
-
st.session_state.rawfilename = tempdirname.name
|
77
|
+
st.session_state.rawfilename = os.path.join(tempdirname.name, get_prefixed_filename("RAW_DAT.nc"))
|
58
78
|
|
59
79
|
if add_attributes:
|
60
80
|
wr.rawnc(
|
@@ -72,7 +92,7 @@ def file_write(path, axis_option, add_attributes=True):
|
|
72
92
|
@st.cache_data
|
73
93
|
def file_write_flead(path, axis_option, add_attributes=True):
|
74
94
|
tempvardirname = tempfile.TemporaryDirectory(delete=False)
|
75
|
-
st.session_state.fleadfilename = tempvardirname.name
|
95
|
+
st.session_state.fleadfilename = os.path.join(tempvardirname.name, get_prefixed_filename("RAW_FIX.nc"))
|
76
96
|
|
77
97
|
if add_attributes:
|
78
98
|
wr.flead_nc(
|
@@ -90,7 +110,7 @@ def file_write_flead(path, axis_option, add_attributes=True):
|
|
90
110
|
@st.cache_data
|
91
111
|
def file_write_vlead(path, axis_option, add_attributes=True):
|
92
112
|
tempvardirname = tempfile.TemporaryDirectory(delete=False)
|
93
|
-
st.session_state.vleadfilename = tempvardirname.name
|
113
|
+
st.session_state.vleadfilename = os.path.join(tempvardirname.name, get_prefixed_filename("RAW_VAR.nc"))
|
94
114
|
|
95
115
|
if add_attributes:
|
96
116
|
wr.vlead_nc(
|
@@ -106,6 +126,7 @@ def file_write_vlead(path, axis_option, add_attributes=True):
|
|
106
126
|
)
|
107
127
|
|
108
128
|
|
129
|
+
|
109
130
|
if "axis_option" not in st.session_state:
|
110
131
|
st.session_state.axis_option = "ensemble" # Default value
|
111
132
|
|
@@ -149,6 +170,32 @@ if st.session_state.add_attributes_DRW == "Yes":
|
|
149
170
|
|
150
171
|
st.write("Attributes will be added to the NetCDF file once you submit.")
|
151
172
|
|
173
|
+
|
174
|
+
st.info(f"Current file name: **{st.session_state.filename}**")
|
175
|
+
|
176
|
+
# Prefix editing option
|
177
|
+
st.session_state.use_custom_filename = st.radio(
|
178
|
+
"Do you want to edit Output Filename?",
|
179
|
+
["No", "Yes"],
|
180
|
+
horizontal=True,
|
181
|
+
)
|
182
|
+
|
183
|
+
if st.session_state.use_custom_filename == "Yes" and not st.session_state.prefix_saved:
|
184
|
+
st.session_state.file_prefix = st.text_input(
|
185
|
+
"Enter file name (e.g., GD10A000)",
|
186
|
+
value=st.session_state.file_prefix,
|
187
|
+
)
|
188
|
+
|
189
|
+
if st.button("Save Filename"):
|
190
|
+
if st.session_state.file_prefix.strip():
|
191
|
+
st.session_state.prefix_saved = True
|
192
|
+
st.rerun()
|
193
|
+
else:
|
194
|
+
st.warning("Please enter a valid filename before saving.")
|
195
|
+
|
196
|
+
if st.session_state.prefix_saved:
|
197
|
+
st.success(f"Filename saved as: **{st.session_state.file_prefix}**")
|
198
|
+
|
152
199
|
# Dropdown for axis_option
|
153
200
|
st.session_state.axis_option_DRW = st.selectbox(
|
154
201
|
"Select x-axis option:",
|
@@ -179,7 +226,7 @@ if st.session_state.rawnc_download_DRW:
|
|
179
226
|
st.download_button(
|
180
227
|
label="Download Raw File",
|
181
228
|
data=file,
|
182
|
-
file_name="
|
229
|
+
file_name=get_prefixed_filename("RAW_DAT.nc"),
|
183
230
|
)
|
184
231
|
|
185
232
|
if st.session_state.fleadnc_download_DRW:
|
@@ -193,7 +240,7 @@ if st.session_state.fleadnc_download_DRW:
|
|
193
240
|
st.download_button(
|
194
241
|
label="Download Fixed Leader",
|
195
242
|
data=file,
|
196
|
-
file_name="
|
243
|
+
file_name=get_prefixed_filename("RAW_FIX.nc"),
|
197
244
|
)
|
198
245
|
|
199
246
|
if st.session_state.vleadnc_download_DRW:
|
@@ -207,7 +254,7 @@ if st.session_state.vleadnc_download_DRW:
|
|
207
254
|
st.download_button(
|
208
255
|
label="Download Variable Leader",
|
209
256
|
data=file,
|
210
|
-
file_name="
|
257
|
+
file_name=get_prefixed_filename("RAW_VAR.nc"),
|
211
258
|
)
|
212
259
|
|
213
260
|
|
pyadps/pages/06_Profile_Test.py
CHANGED
@@ -797,8 +797,8 @@ with tab4:
|
|
797
797
|
orientation=st.session_state.beam_direction_QCT,
|
798
798
|
method=st.session_state.interpolate_PT,
|
799
799
|
boundary_limit=boundary,
|
800
|
-
cells=
|
801
|
-
cell_size=
|
800
|
+
cells=fdata['Cells'],
|
801
|
+
cell_size=fdata['Depth Cell Len'],
|
802
802
|
bin1dist=bin1dist,
|
803
803
|
beams=beams,
|
804
804
|
)
|
@@ -813,8 +813,8 @@ with tab4:
|
|
813
813
|
orientation=st.session_state.beam_direction_QCT,
|
814
814
|
method=st.session_state.interpolate_PT,
|
815
815
|
boundary_limit=boundary,
|
816
|
-
cells=
|
817
|
-
cell_size=
|
816
|
+
cells=fdata['Cells'],
|
817
|
+
cell_size=fdata['Depth Cell Len'],
|
818
818
|
bin1dist=bin1dist,
|
819
819
|
beams=beams,
|
820
820
|
)
|
@@ -829,8 +829,8 @@ with tab4:
|
|
829
829
|
orientation=st.session_state.beam_direction_QCT,
|
830
830
|
method=st.session_state.interpolate_PT,
|
831
831
|
boundary_limit=boundary,
|
832
|
-
cells=
|
833
|
-
cell_size=
|
832
|
+
cells=fdata['Cells'],
|
833
|
+
cell_size=fdata['Depth Cell Len'],
|
834
834
|
bin1dist=bin1dist,
|
835
835
|
beams=beams,
|
836
836
|
)
|
@@ -845,8 +845,8 @@ with tab4:
|
|
845
845
|
orientation=st.session_state.beam_direction_QCT,
|
846
846
|
method=st.session_state.interpolate_PT,
|
847
847
|
boundary_limit=boundary,
|
848
|
-
cells=
|
849
|
-
cell_size=
|
848
|
+
cells=fdata['Cells'],
|
849
|
+
cell_size=fdata['Depth Cell Len'],
|
850
850
|
bin1dist=bin1dist,
|
851
851
|
beams=beams,
|
852
852
|
)
|
@@ -862,8 +862,8 @@ with tab4:
|
|
862
862
|
orientation=st.session_state.beam_direction_QCT,
|
863
863
|
method="nearest",
|
864
864
|
boundary_limit=boundary,
|
865
|
-
cells=
|
866
|
-
cell_size=
|
865
|
+
cells=fdata['Cells'],
|
866
|
+
cell_size=fdata['Depth Cell Len'],
|
867
867
|
bin1dist=bin1dist,
|
868
868
|
)
|
869
869
|
|
pyadps/pages/08_Write_File.py
CHANGED
@@ -16,10 +16,23 @@ if "fname" not in st.session_state:
|
|
16
16
|
st.session_state.fname = "No file selected"
|
17
17
|
|
18
18
|
if "rawfilename" not in st.session_state:
|
19
|
-
st.session_state.rawfilename = "
|
19
|
+
st.session_state.rawfilename = "RAW_DAT.nc"
|
20
20
|
|
21
21
|
if "vleadfilename" not in st.session_state:
|
22
|
-
st.session_state.vleadfilename = "
|
22
|
+
st.session_state.vleadfilename = "RAW_VAR.nc"
|
23
|
+
|
24
|
+
if "file_prefix" not in st.session_state:
|
25
|
+
raw_basename = os.path.basename(st.session_state.fname)
|
26
|
+
st.session_state.filename = os.path.splitext(raw_basename)[0]
|
27
|
+
st.session_state.file_prefix = st.session_state.filename
|
28
|
+
|
29
|
+
|
30
|
+
if "prefix_saved" not in st.session_state:
|
31
|
+
st.session_state.prefix_saved = False
|
32
|
+
|
33
|
+
if "filename" not in st.session_state:
|
34
|
+
st.session_state.filename = "" # <-- Default file name if not passed
|
35
|
+
|
23
36
|
|
24
37
|
|
25
38
|
# Check if attributes exist in session state
|
@@ -72,9 +85,15 @@ else:
|
|
72
85
|
if "depth_axis" not in st.session_state:
|
73
86
|
st.session_state.isRegridCheck_PT = False
|
74
87
|
|
88
|
+
@st.cache_data
|
89
|
+
def get_prefixed_filename(base_name):
|
90
|
+
"""Generates the file name with the optional prefix."""
|
91
|
+
if st.session_state.file_prefix:
|
92
|
+
return f"{st.session_state.file_prefix}_{base_name}"
|
93
|
+
return base_name
|
75
94
|
|
76
95
|
@st.cache_data
|
77
|
-
def file_write(filename="
|
96
|
+
def file_write(filename=get_prefixed_filename("PRO_DAT.nc")):
|
78
97
|
tempdirname = tempfile.TemporaryDirectory(delete=False)
|
79
98
|
outfilepath = tempdirname.name + "/" + filename
|
80
99
|
return outfilepath
|
@@ -297,7 +316,7 @@ if download_button:
|
|
297
316
|
st.download_button(
|
298
317
|
label="Download NetCDF File",
|
299
318
|
data=file,
|
300
|
-
file_name="
|
319
|
+
file_name=get_prefixed_filename("PRO_DAT.nc"),
|
301
320
|
)
|
302
321
|
|
303
322
|
if st.session_state.file_type_WF == "CSV":
|
pyadps/utils/profile_test.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import numpy as np
|
2
2
|
import scipy as sp
|
3
|
-
from pyadps.utils.readrdi import ReadFile
|
3
|
+
from pyadps.utils.readrdi import ReadFile, check_equal
|
4
4
|
from .plotgen import PlotEnds
|
5
5
|
|
6
6
|
|
@@ -214,6 +214,217 @@ def manual_cut_bins(mask, min_cell, max_cell, min_ensemble, max_ensemble):
|
|
214
214
|
return mask
|
215
215
|
|
216
216
|
|
217
|
+
def modifiedRegrid2d(
|
218
|
+
ds,
|
219
|
+
data,
|
220
|
+
fill_value,
|
221
|
+
end_cell_option="cell",
|
222
|
+
trimends=None,
|
223
|
+
method="nearest",
|
224
|
+
orientation="default",
|
225
|
+
boundary_limit=0,
|
226
|
+
cells=None,
|
227
|
+
cell_size=None,
|
228
|
+
bin1dist=None,
|
229
|
+
):
|
230
|
+
"""
|
231
|
+
Modified Regrids 2D data onto a new grid based on specified parameters.
|
232
|
+
The function is capable of handling data with non-uniform number of cells
|
233
|
+
and Depth cell length.
|
234
|
+
|
235
|
+
Parameters:
|
236
|
+
-----------
|
237
|
+
ds : pyadps.dataset or numpy.ndarray
|
238
|
+
If pyadps dataframe is loaded, the data from the fixed and variable leader
|
239
|
+
is automatically obtained. This includes the depth of the transducer and other relevant information
|
240
|
+
for trimming the data.
|
241
|
+
|
242
|
+
If numpy.ndarray is loaded, the value should contain the transducer_depth.
|
243
|
+
In such cases provide cells, cell_size, and bin 1 distance.
|
244
|
+
Orientiation should be either 'up' or 'down' and not 'default'.
|
245
|
+
|
246
|
+
|
247
|
+
data : array-like
|
248
|
+
The 2D data array to be regridded.
|
249
|
+
|
250
|
+
fill_value : scalar
|
251
|
+
The value used to fill missing or undefined grid points.
|
252
|
+
|
253
|
+
end_cell_option : str or float, optional, default="cell"
|
254
|
+
The depth of the last bin or boundary for the grid.
|
255
|
+
Options include:
|
256
|
+
- "cell" : Calculates the depth of the default last bin for the grid.
|
257
|
+
Truncates to surface for upward ADCP.
|
258
|
+
- "surface": The data is gridded till the surface
|
259
|
+
- "manual": User-defined depth for the grid.
|
260
|
+
Use boundary_limit option to provide the value.
|
261
|
+
otherwise, a specific numerical depth value can be provided.
|
262
|
+
|
263
|
+
trimends : tuple of floats, optional, default=None
|
264
|
+
If provided, defines the ensemble range (start, end) for
|
265
|
+
calculating the maximum/minimum transducer depth.
|
266
|
+
Helps avoiding the deployment or retrieval data.
|
267
|
+
E.g. (10, 3000)
|
268
|
+
|
269
|
+
method : str, optional, default="nearest"
|
270
|
+
The interpolation method to use for regridding based
|
271
|
+
on scipy.interpolate.interp1d.
|
272
|
+
Options include:
|
273
|
+
- "nearest" : Nearest neighbor interpolation.
|
274
|
+
- "linear" : Linear interpolation.
|
275
|
+
- "cubic" : Cubic interpolation.
|
276
|
+
|
277
|
+
orientation : str, optional, default="up"
|
278
|
+
Defines the direction of the regridding for an upward/downward looking ADCP. Options include:
|
279
|
+
- "up" : Regrid upwards (for upward-looking ADCP).
|
280
|
+
- "down" : Regrid downwards (for downward-looking ADCP).
|
281
|
+
|
282
|
+
boundary_limit : float, optional, default=0
|
283
|
+
The limit for the boundary depth. This restricts the grid regridding to depths beyond the specified limit.
|
284
|
+
|
285
|
+
cells: int, optional
|
286
|
+
Number of cells
|
287
|
+
|
288
|
+
cell_size: int, optional
|
289
|
+
Cell size or depth cell length in cm
|
290
|
+
|
291
|
+
bin1dist: int, optional
|
292
|
+
Distance from the first bin in cm
|
293
|
+
|
294
|
+
|
295
|
+
Returns:
|
296
|
+
--------
|
297
|
+
z: regridded depth
|
298
|
+
regridded_data : array-like
|
299
|
+
The regridded 2D data array, based on the specified method,
|
300
|
+
orientation, and other parameters.
|
301
|
+
|
302
|
+
Notes:
|
303
|
+
------
|
304
|
+
- If `end_cell_option == boundary`, then `boundary_limit` is used to regrid the data.
|
305
|
+
- This function allows for flexible regridding of 2D data to fit a new grid, supporting different interpolation methods.
|
306
|
+
- The `boundary_limit` parameter helps restrict regridding to depths above or below a certain threshold.
|
307
|
+
"""
|
308
|
+
|
309
|
+
if isinstance(ds, ReadFile) or ds.__class__.__name__ == "ReadFile":
|
310
|
+
flobj = ds.fixedleader
|
311
|
+
vlobj = ds.variableleader
|
312
|
+
# Get values and convert to 'm'
|
313
|
+
bin1dist = flobj.field()["Bin 1 Dist"] / 100
|
314
|
+
transdepth = vlobj.vleader["Depth of Transducer"] / 10
|
315
|
+
cell_size = flobj.field()["Depth Cell Len"] / 100
|
316
|
+
cells = flobj.field()["Cells"]
|
317
|
+
ensembles = flobj.ensembles
|
318
|
+
if orientation.lower() == "default":
|
319
|
+
orientation = flobj.system_configuration()["Beam Direction"]
|
320
|
+
|
321
|
+
elif isinstance(ds, np.ndarray) and np.squeeze(ds).ndim == 1:
|
322
|
+
transdepth = ds / 10
|
323
|
+
ensembles = np.size(ds)
|
324
|
+
|
325
|
+
if cells is None:
|
326
|
+
raise ValueError("Input must include number of cells.")
|
327
|
+
|
328
|
+
if cell_size is None:
|
329
|
+
raise ValueError("Input must include cell size.")
|
330
|
+
else:
|
331
|
+
cell_size = cell_size / 100
|
332
|
+
|
333
|
+
if bin1dist is None:
|
334
|
+
raise ValueError("Input must include bin 1 distance.")
|
335
|
+
else:
|
336
|
+
bin1dist = bin1dist / 100
|
337
|
+
|
338
|
+
if orientation.lower() != "up" and orientation.lower() != "down":
|
339
|
+
raise ValueError("Orientation must be `up` or `down`.")
|
340
|
+
else:
|
341
|
+
raise ValueError("Input must be a 1-D numpy array or a PyADPS instance")
|
342
|
+
|
343
|
+
if orientation.lower() == "up":
|
344
|
+
sgn = -1
|
345
|
+
else:
|
346
|
+
sgn = 1
|
347
|
+
|
348
|
+
# Create a regular grid
|
349
|
+
|
350
|
+
# Find depth of first cell
|
351
|
+
depth = transdepth + sgn * bin1dist
|
352
|
+
# print("depth: ", depth)
|
353
|
+
|
354
|
+
# Find the maximum and minimum depth for first cell for upward
|
355
|
+
# looking ADCP (minimum and maximum for downward looking)
|
356
|
+
if trimends is not None:
|
357
|
+
max_depth = abs(np.min(sgn * depth[trimends[0] : trimends[1]]))
|
358
|
+
min_depth = abs(np.max(sgn * depth[trimends[0] : trimends[1]]))
|
359
|
+
else:
|
360
|
+
max_depth = abs(np.min(sgn * depth))
|
361
|
+
min_depth = abs(np.max(sgn * depth))
|
362
|
+
|
363
|
+
# FIRST CELL
|
364
|
+
# Convert the first cell depth to the first regular grid depth
|
365
|
+
depthfirstcell = max_depth - max_depth % min(cell_size)
|
366
|
+
# print("depthfirstcell: ", depthfirstcell)
|
367
|
+
|
368
|
+
# LAST CELL
|
369
|
+
# Convert the last cell depth to last regular grid depth
|
370
|
+
if end_cell_option.lower() == "surface":
|
371
|
+
# Added one additional negative cell to accomodate 0 m.
|
372
|
+
depthlastcell = sgn * min(cell_size)
|
373
|
+
# print("depthlastcell: ", depthlastcell)
|
374
|
+
elif end_cell_option.lower() == "cell":
|
375
|
+
min_depth_regrid = min_depth - sgn * min_depth % min(cell_size)
|
376
|
+
depthlastcell = min_depth_regrid + sgn * (max(cells) + 1) * min(cell_size)
|
377
|
+
# print("depthlastcell: ", depthlastcell)
|
378
|
+
# Check if this is required. Use 'surface' option
|
379
|
+
if depthlastcell < 0:
|
380
|
+
depthlastcell = sgn * min(cell_size)
|
381
|
+
elif end_cell_option.lower() == "manual":
|
382
|
+
if sgn < 0 and boundary_limit > depthfirstcell:
|
383
|
+
print(
|
384
|
+
"ERROR: For upward looking ADCP, boundary limit should be less than transducer depth"
|
385
|
+
)
|
386
|
+
return
|
387
|
+
if sgn > 0 and boundary_limit < depthfirstcell:
|
388
|
+
print(
|
389
|
+
"ERROR: For downward looking ADCP, boundary limit should be greater than transducer depth"
|
390
|
+
)
|
391
|
+
return
|
392
|
+
# Set the last grid cell depth
|
393
|
+
depthlastcell = boundary_limit
|
394
|
+
else:
|
395
|
+
print("ERROR: `end_cell_option` not recognized.")
|
396
|
+
return
|
397
|
+
|
398
|
+
# Negative used for upward and positive for downward.
|
399
|
+
z = np.arange(sgn * depthfirstcell, sgn * depthlastcell, min(cell_size))
|
400
|
+
regbins = len(z)
|
401
|
+
|
402
|
+
regridded_data = np.zeros((regbins, ensembles))
|
403
|
+
|
404
|
+
# Create original depth array
|
405
|
+
for i, d in enumerate(depth):
|
406
|
+
n = d + sgn * cell_size[i] * cells[i]
|
407
|
+
# np.arange may include unexpected elements due to floating-point
|
408
|
+
# precision issues at the stopping point. Changed to np.linspace.
|
409
|
+
#
|
410
|
+
# depth_bins = np.arange(sgn*d, sgn*n, cell_size)
|
411
|
+
depth_bins = np.linspace(sgn * d, sgn * n, max(cells))
|
412
|
+
# print("depth_bins: ", depth_bins, "len: ", len(depth_bins))
|
413
|
+
# print("data:", data, "len:", len(data))
|
414
|
+
# print("i: ", i)
|
415
|
+
f = sp.interpolate.interp1d(
|
416
|
+
depth_bins,
|
417
|
+
data[:, i],
|
418
|
+
kind=method,
|
419
|
+
fill_value=fill_value,
|
420
|
+
bounds_error=False,
|
421
|
+
)
|
422
|
+
gridz = f(z)
|
423
|
+
|
424
|
+
regridded_data[:, i] = gridz
|
425
|
+
|
426
|
+
return abs(z), regridded_data
|
427
|
+
|
217
428
|
def regrid2d(
|
218
429
|
ds,
|
219
430
|
data,
|
@@ -305,6 +516,11 @@ def regrid2d(
|
|
305
516
|
"""
|
306
517
|
|
307
518
|
if isinstance(ds, ReadFile) or ds.__class__.__name__ == "ReadFile":
|
519
|
+
if not (check_equal(ds.fleader['Cells']) or check_equal(ds.fleader['Depth Cell Len'])):
|
520
|
+
print("\033[93m Warning: The number of cells or depth cell length are not equal. Using the modifiedRegrid2d function, which may take some time.\033[0m")
|
521
|
+
return modifiedRegrid2d(ds, data, fill_value, end_cell_option, trimends, method, orientation,
|
522
|
+
boundary_limit, cells, cell_size, bin1dist)
|
523
|
+
|
308
524
|
flobj = ds.fixedleader
|
309
525
|
vlobj = ds.variableleader
|
310
526
|
# Get values and convert to 'm'
|
@@ -322,11 +538,21 @@ def regrid2d(
|
|
322
538
|
|
323
539
|
if cells is None:
|
324
540
|
raise ValueError("Input must include number of cells.")
|
541
|
+
else:
|
542
|
+
if not check_equal(cells):
|
543
|
+
print("\033[93m Warning: The number of cells or depth cell length are not equal. Using the modifiedRegrid2d function, which may take some time.\033[0m")
|
544
|
+
return modifiedRegrid2d(ds, data, fill_value, end_cell_option, trimends, method, orientation,
|
545
|
+
boundary_limit, cells, cell_size, bin1dist)
|
546
|
+
cells = cells[0]
|
325
547
|
|
326
548
|
if cell_size is None:
|
327
549
|
raise ValueError("Input must include cell size.")
|
328
550
|
else:
|
329
|
-
|
551
|
+
if not check_equal(cell_size):
|
552
|
+
# print("\033[93m Warning: The number of cells or depth cell length are not equal. Using the modifiedRegrid2d function, which may take some time.\033[0m")
|
553
|
+
return modifiedRegrid2d(ds, data, fill_value, end_cell_option, trimends, method, orientation,
|
554
|
+
boundary_limit, cells, cell_size, bin1dist)
|
555
|
+
cell_size = cell_size[0] / 100
|
330
556
|
|
331
557
|
if bin1dist is None:
|
332
558
|
raise ValueError("Input must include bin 1 distance.")
|
@@ -0,0 +1,33 @@
|
|
1
|
+
pyadps/Home_Page.py,sha256=j_-3fsp1hkhpNEl5jE-CEQvClDGpMi1H3ZQPXfuKWBg,1782
|
2
|
+
pyadps/__init__.py,sha256=bNCm6_WIhiwvaUeOZhRkyLZyzzUKfSH80Fslg0JPJyk,232
|
3
|
+
pyadps/__main__.py,sha256=cIFUayxPnKl00oIR99L6IUEvc8trW7dijtfBQCAen5c,356
|
4
|
+
pyadps/pages/01_Read_File.py,sha256=swujYGZvQX30zcccWhn5MiFVY_MBUYXuZ9_8GtvpQI4,14421
|
5
|
+
pyadps/pages/02_View_Raw_Data.py,sha256=AhT7gvDbcMRPf-WIBzTQ0o-nn9_q7NH6plTlpMtgzaY,6170
|
6
|
+
pyadps/pages/03_Download_Raw_File.py,sha256=XF25xog8bkdsm3s1MFA10ZxbvqgDmvxBDOo6OPBHQwQ,12382
|
7
|
+
pyadps/pages/04_Sensor_Health.py,sha256=2Qnwl7D46H-f8LmXLVZj5X36h8MjRwmVRK6Bs_wuB_k,33905
|
8
|
+
pyadps/pages/05_QC_Test.py,sha256=8wt7h-RHLOf3GZ8-B_kXA0IqzHTBwW_H7YQFEk5EM6E,15904
|
9
|
+
pyadps/pages/06_Profile_Test.py,sha256=Vir91oRIWApbO2elBm4I59rdf83NtspUmtzAyWdsIiY,34891
|
10
|
+
pyadps/pages/07_Velocity_Test.py,sha256=K4vEiLPMXrU4JMLj-mIA1G4H5ORozMbHMiMov3ZZXP0,23008
|
11
|
+
pyadps/pages/08_Write_File.py,sha256=SUHGvOTN2hnwhxGucmTtclU6BhaJKWO2qGV4zS-JsPU,22954
|
12
|
+
pyadps/pages/09_Auto_process.py,sha256=SRtQVD9_kodlSvYdF9-02ur6EaWG2zMvN6-BcWdzYV8,1874
|
13
|
+
pyadps/pages/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
14
|
+
pyadps/utils/__init__.py,sha256=nCqRp-OT_1BC7RnL3ARUIldlw9sWyr1XqQvQid-B4ts,407
|
15
|
+
pyadps/utils/autoprocess.py,sha256=8KAg5-7uC7dsMHrCPfvM5icPzle3MU1gpFNcC-eZrkM,20086
|
16
|
+
pyadps/utils/metadata/config.ini,sha256=TC7htzGwUukIXt_u3JR5ycyvOoDj_JxWgGY6khjNeck,2154
|
17
|
+
pyadps/utils/metadata/demo.000,sha256=qxB3sgjABrpv4DNXkwjpbSxk5sc4UwAI8kgQX0--PM8,234468
|
18
|
+
pyadps/utils/metadata/flmeta.json,sha256=diIB9nht_0uw9YJNSFGdZYGzeVbR-07zIZS9Nf4VPSE,14245
|
19
|
+
pyadps/utils/metadata/vlmeta.json,sha256=_dkQlGkkUvpAIM7S6kEUenSaiCpOrwXg8n1aU3dDF3s,22535
|
20
|
+
pyadps/utils/plotgen.py,sha256=-A5fN2WoCZevt_SLT5OKSeYCzfv3rGG4tw7p1qzFjeA,26344
|
21
|
+
pyadps/utils/profile_test.py,sha256=gnbS6ZsqKvv2tcHTj-Fi_VNOszbxDcPxl77_n4dLzSo,29237
|
22
|
+
pyadps/utils/pyreadrdi.py,sha256=2xBg9v7wvxywfvJK1E0hrjR9XSqiiNwpA9ELfcSsuhM,35303
|
23
|
+
pyadps/utils/readrdi.py,sha256=ullqqWL-tvK3V9fjX8kpPwRpWhmRZy-CyA240gmcdr4,50012
|
24
|
+
pyadps/utils/script.py,sha256=TKMCYe0HEz-2GFpNxKVzpg0p4MM-Cu2rcMZc51GgLn4,6534
|
25
|
+
pyadps/utils/sensor_health.py,sha256=aHRaU4kMJZ9dGmYypKpCCgq-owWoNjvcl1I_9I7dG68,3973
|
26
|
+
pyadps/utils/signal_quality.py,sha256=dohaMtJT_MCeyxF__zMRy36_rMmVZqU5vCdW1AYH35s,16239
|
27
|
+
pyadps/utils/velocity_test.py,sha256=O8dgjv_5pxhJq6QuWHxysMjNzxSnob_2KPLInmO1kHI,6112
|
28
|
+
pyadps/utils/writenc.py,sha256=fgE0qpxCy_uk5hsYCeN5l77jWgj-vLxpjx-4hEJDJU0,13955
|
29
|
+
pyadps-0.1.2.dist-info/LICENSE,sha256=sfY_7DzQF5FxnO2T6ek74dfm5uBmwEp1oEg_WlzNsb8,1092
|
30
|
+
pyadps-0.1.2.dist-info/METADATA,sha256=h4npMIrAf5Tngry5d_wZPiW0Bpq-zizzLmSsfAGl_Vk,4518
|
31
|
+
pyadps-0.1.2.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
|
32
|
+
pyadps-0.1.2.dist-info/entry_points.txt,sha256=-oZhbbJq8Q29uNVh5SmzOLp9OeFM9VUzHVxovfI4LXA,126
|
33
|
+
pyadps-0.1.2.dist-info/RECORD,,
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
pyadps-0.1.1.dist-info/RECORD
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
pyadps/Home_Page.py,sha256=j_-3fsp1hkhpNEl5jE-CEQvClDGpMi1H3ZQPXfuKWBg,1782
|
2
|
-
pyadps/__init__.py,sha256=bNCm6_WIhiwvaUeOZhRkyLZyzzUKfSH80Fslg0JPJyk,232
|
3
|
-
pyadps/__main__.py,sha256=cIFUayxPnKl00oIR99L6IUEvc8trW7dijtfBQCAen5c,356
|
4
|
-
pyadps/pages/01_Read_File.py,sha256=4LUeSEumOtsGpsEdPdeRq5msHP91JqdZXcJB_PJHPXo,14373
|
5
|
-
pyadps/pages/02_View_Raw_Data.py,sha256=AhT7gvDbcMRPf-WIBzTQ0o-nn9_q7NH6plTlpMtgzaY,6170
|
6
|
-
pyadps/pages/03_Download_Raw_File.py,sha256=A17wxNTHZC1Oi51S0fa2uLTBQsRTWRjDZQjFb2l78uI,10721
|
7
|
-
pyadps/pages/04_Sensor_Health.py,sha256=2Qnwl7D46H-f8LmXLVZj5X36h8MjRwmVRK6Bs_wuB_k,33905
|
8
|
-
pyadps/pages/05_QC_Test.py,sha256=8wt7h-RHLOf3GZ8-B_kXA0IqzHTBwW_H7YQFEk5EM6E,15904
|
9
|
-
pyadps/pages/06_Profile_Test.py,sha256=zH2TdpEzRFUiXSDQGfdeSsGYAihdCRuj4YgsedB61E0,34776
|
10
|
-
pyadps/pages/07_Velocity_Test.py,sha256=K4vEiLPMXrU4JMLj-mIA1G4H5ORozMbHMiMov3ZZXP0,23008
|
11
|
-
pyadps/pages/08_Write_File.py,sha256=ghzxAaIrnArb04Mvn4b4jNu1ewZ-U9V8uZQAFuO6DZc,22255
|
12
|
-
pyadps/pages/09_Auto_process.py,sha256=SRtQVD9_kodlSvYdF9-02ur6EaWG2zMvN6-BcWdzYV8,1874
|
13
|
-
pyadps/pages/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
14
|
-
pyadps/pages/__pycache__/__init__.cpython-312.pyc,sha256=6pMyqdclo2Qu_4JRR0WGzppdaQyxFUIBQbciBi14wgw,157
|
15
|
-
pyadps/utils/__init__.py,sha256=nCqRp-OT_1BC7RnL3ARUIldlw9sWyr1XqQvQid-B4ts,407
|
16
|
-
pyadps/utils/__pycache__/__init__.cpython-312.pyc,sha256=1FNTM005xyJOn2eJ9-kn8rJjD215cvgy3Cc-Xb-apf0,545
|
17
|
-
pyadps/utils/__pycache__/autoprocess.cpython-312.pyc,sha256=s_f3V09eFxcGWaGNHiXADgBs1OaWhGz6ypEdkVV4rpg,17996
|
18
|
-
pyadps/utils/__pycache__/cutbin.cpython-312.pyc,sha256=Fu6VQQL0rjRkvrSS8qLmU8ctaz-Y-juw2b6fcIuS30g,28442
|
19
|
-
pyadps/utils/__pycache__/plotgen.cpython-312.pyc,sha256=HA8QnkI9CQttcAlXrRPvrZrgKroJb_W_S6dmR0XM9pk,47182
|
20
|
-
pyadps/utils/__pycache__/profile_test.cpython-312.pyc,sha256=FGaPZj5POdrBmUwbLs9tKFXJQL29WjZsX1l7mumUwrk,20852
|
21
|
-
pyadps/utils/__pycache__/pyreadrdi.cpython-312.pyc,sha256=6_jgCt-3N4gQVLKLZZCLqOKsQJ3mQXQrq_w2jtU7ARw,37624
|
22
|
-
pyadps/utils/__pycache__/readrdi.cpython-312.pyc,sha256=-3SpMj71glafcy0XlS_itLYFKCQAXLnrmliBwVDhEqM,53190
|
23
|
-
pyadps/utils/__pycache__/regrid.cpython-312.pyc,sha256=STOYAAGBfLnP91Pvqlcvtd8ilwyOoRDoGxHs56hiSYo,9804
|
24
|
-
pyadps/utils/__pycache__/script.cpython-312.pyc,sha256=ubdOI-kEG_iBBB0tBvU-r4CZWj9Wn42PewdGKsNlu2M,8230
|
25
|
-
pyadps/utils/__pycache__/sensor_health.cpython-312.pyc,sha256=8iYp15CEZNFujAIftWylksg9WbdPe0ozsk99jJFQqco,5037
|
26
|
-
pyadps/utils/__pycache__/signal_quality.cpython-312.pyc,sha256=PeUZEesieBLxrc8z8aKoX7N7zjUJfpTqcvsTp_V0FG0,18256
|
27
|
-
pyadps/utils/__pycache__/velocity_test.cpython-312.pyc,sha256=6tUY161EOSGwwSkfMEnWwF8jzrCIl5bm9D-PEcCogyY,7071
|
28
|
-
pyadps/utils/__pycache__/writenc.cpython-312.pyc,sha256=0c1p-PLaJjYJrTXrgJ-VRCyZtqVlPyYyfeefIAr0t-8,11738
|
29
|
-
pyadps/utils/autoprocess.py,sha256=8KAg5-7uC7dsMHrCPfvM5icPzle3MU1gpFNcC-eZrkM,20086
|
30
|
-
pyadps/utils/metadata/config.ini,sha256=TC7htzGwUukIXt_u3JR5ycyvOoDj_JxWgGY6khjNeck,2154
|
31
|
-
pyadps/utils/metadata/demo.000,sha256=qxB3sgjABrpv4DNXkwjpbSxk5sc4UwAI8kgQX0--PM8,234468
|
32
|
-
pyadps/utils/metadata/flmeta.json,sha256=diIB9nht_0uw9YJNSFGdZYGzeVbR-07zIZS9Nf4VPSE,14245
|
33
|
-
pyadps/utils/metadata/vlmeta.json,sha256=_dkQlGkkUvpAIM7S6kEUenSaiCpOrwXg8n1aU3dDF3s,22535
|
34
|
-
pyadps/utils/plotgen.py,sha256=-A5fN2WoCZevt_SLT5OKSeYCzfv3rGG4tw7p1qzFjeA,26344
|
35
|
-
pyadps/utils/profile_test.py,sha256=kcqdFigL2wQwMRrKyfNzfGIYcFwRj1_945lEpIio6pQ,20173
|
36
|
-
pyadps/utils/pyreadrdi.py,sha256=2xBg9v7wvxywfvJK1E0hrjR9XSqiiNwpA9ELfcSsuhM,35303
|
37
|
-
pyadps/utils/readrdi.py,sha256=ullqqWL-tvK3V9fjX8kpPwRpWhmRZy-CyA240gmcdr4,50012
|
38
|
-
pyadps/utils/script.py,sha256=TKMCYe0HEz-2GFpNxKVzpg0p4MM-Cu2rcMZc51GgLn4,6534
|
39
|
-
pyadps/utils/sensor_health.py,sha256=aHRaU4kMJZ9dGmYypKpCCgq-owWoNjvcl1I_9I7dG68,3973
|
40
|
-
pyadps/utils/signal_quality.py,sha256=dohaMtJT_MCeyxF__zMRy36_rMmVZqU5vCdW1AYH35s,16239
|
41
|
-
pyadps/utils/velocity_test.py,sha256=O8dgjv_5pxhJq6QuWHxysMjNzxSnob_2KPLInmO1kHI,6112
|
42
|
-
pyadps/utils/writenc.py,sha256=fgE0qpxCy_uk5hsYCeN5l77jWgj-vLxpjx-4hEJDJU0,13955
|
43
|
-
pyadps-0.1.1.dist-info/LICENSE,sha256=sfY_7DzQF5FxnO2T6ek74dfm5uBmwEp1oEg_WlzNsb8,1092
|
44
|
-
pyadps-0.1.1.dist-info/METADATA,sha256=bCxR_5Za17VwJ69R7Ja7h9UwVAidcFwI_3veHtBn9Qs,4518
|
45
|
-
pyadps-0.1.1.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
|
46
|
-
pyadps-0.1.1.dist-info/entry_points.txt,sha256=-oZhbbJq8Q29uNVh5SmzOLp9OeFM9VUzHVxovfI4LXA,126
|
47
|
-
pyadps-0.1.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|