pyadps 0.1.1__py3-none-any.whl → 0.2.1b0__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/Home_Page.py +5 -11
- pyadps/pages/01_Read_File.py +19 -188
- pyadps/pages/02_View_Raw_Data.py +33 -69
- pyadps/pages/03_Download_Raw_File.py +61 -149
- pyadps/pages/04_QC_Test.py +334 -0
- pyadps/pages/05_Profile_Test.py +575 -0
- pyadps/pages/06_Velocity_Test.py +341 -0
- pyadps/pages/07_Write_File.py +452 -0
- pyadps/utils/__init__.py +3 -3
- pyadps/utils/autoprocess.py +78 -344
- pyadps/utils/cutbin.py +413 -0
- pyadps/utils/metadata/config.ini +4 -22
- pyadps/utils/plotgen.py +3 -505
- pyadps/utils/profile_test.py +125 -494
- pyadps/utils/pyreadrdi.py +17 -27
- pyadps/utils/readrdi.py +18 -164
- pyadps/utils/{__pycache__/regrid.cpython-312.pyc → regrid.py} +0 -0
- pyadps/utils/script.py +147 -197
- pyadps/utils/signal_quality.py +24 -344
- pyadps/utils/velocity_test.py +31 -79
- pyadps/utils/writenc.py +21 -155
- {pyadps-0.1.1.dist-info → pyadps-0.2.1b0.dist-info}/METADATA +5 -5
- pyadps-0.2.1b0.dist-info/RECORD +31 -0
- {pyadps-0.1.1.dist-info → pyadps-0.2.1b0.dist-info}/WHEEL +1 -1
- {pyadps-0.1.1.dist-info → pyadps-0.2.1b0.dist-info}/entry_points.txt +0 -1
- pyadps/pages/04_Sensor_Health.py +0 -905
- pyadps/pages/05_QC_Test.py +0 -476
- pyadps/pages/06_Profile_Test.py +0 -971
- pyadps/pages/07_Velocity_Test.py +0 -600
- pyadps/pages/08_Write_File.py +0 -587
- pyadps/pages/09_Auto_process.py +0 -64
- 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__/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/utils/metadata/demo.000 +0 -0
- pyadps/utils/sensor_health.py +0 -120
- pyadps-0.1.1.dist-info/RECORD +0 -47
- {pyadps-0.1.1.dist-info → pyadps-0.2.1b0.dist-info}/LICENSE +0 -0
pyadps/utils/writenc.py
CHANGED
@@ -17,6 +17,7 @@ from netCDF4 import date2num
|
|
17
17
|
from pyadps.utils import readrdi as rd
|
18
18
|
|
19
19
|
|
20
|
+
|
20
21
|
def pd2nctime(time, t0="hours since 2000-01-01"):
|
21
22
|
"""
|
22
23
|
Function to convert pandas datetime format to netcdf datetime format.
|
@@ -67,14 +68,7 @@ def flead_ncatt(fl_obj, ncfile_id, ens=0):
|
|
67
68
|
setattr(ncfile_id, format_key, format(value))
|
68
69
|
|
69
70
|
|
70
|
-
def rawnc(
|
71
|
-
infile,
|
72
|
-
outfile,
|
73
|
-
time,
|
74
|
-
axis_option=None,
|
75
|
-
attributes=None,
|
76
|
-
t0="hours since 2000-01-01",
|
77
|
-
):
|
71
|
+
def rawnc(infile, outfile, time, axis_option=None, attributes=None, t0="hours since 2000-01-01"):
|
78
72
|
"""
|
79
73
|
rawnc is a function to create netcdf file. Stores 3-D data types like
|
80
74
|
velocity, echo, correlation, and percent good.
|
@@ -162,100 +156,28 @@ def rawnc(
|
|
162
156
|
|
163
157
|
vshape = var.T.shape
|
164
158
|
if i == 0:
|
165
|
-
if primary_axis == "
|
159
|
+
if primary_axis == "time":
|
160
|
+
time[:] = np.arange(1, vshape[0] + 1, 1)
|
161
|
+
elif primary_axis == "ensemble":
|
166
162
|
ensemble[:] = np.arange(1, vshape[0] + 1, 1)
|
163
|
+
else:
|
164
|
+
raise ValueError(f"Invalid axis_option: {axis_option}.")
|
167
165
|
|
168
166
|
varid[i][0 : vshape[0], 0 : vshape[1], 0 : vshape[2]] = var.T
|
169
|
-
|
167
|
+
|
170
168
|
# Add global attributes if provided
|
171
169
|
if attributes:
|
172
170
|
for key, value in attributes.items():
|
173
|
-
setattr(
|
174
|
-
outnc, key, str(value)
|
175
|
-
) # Convert to string to store in NetCDF metadata
|
171
|
+
setattr(outnc, key, str(value)) # Convert to string to store in NetCDF metadata
|
176
172
|
|
177
173
|
# outnc.history = "Created " + time.ctime(time.time())
|
178
174
|
flead_ncatt(flead, outnc)
|
175
|
+
|
179
176
|
|
180
177
|
outnc.close()
|
181
178
|
|
182
|
-
def flead_nc(
|
183
|
-
infile,
|
184
|
-
outfile,
|
185
|
-
time,
|
186
|
-
axis_option=None,
|
187
|
-
attributes=None,
|
188
|
-
t0="hours since 2000-01-01",
|
189
|
-
):
|
190
|
-
"""
|
191
|
-
Function to create ncfile containing Variable Leader.
|
192
|
-
|
193
|
-
Args:
|
194
|
-
infile (string): Input file path including filename
|
195
|
-
outfile (string): Output file path including filename
|
196
|
-
"""
|
197
|
-
outnc = nc4.Dataset(outfile, "w", format="NETCDF4")
|
198
|
-
|
199
|
-
# Dimensions
|
200
|
-
# Define the primary axis based on axis_option
|
201
|
-
if axis_option == "ensemble":
|
202
|
-
outnc.createDimension("ensemble", None)
|
203
|
-
primary_axis = "ensemble"
|
204
|
-
ensemble = outnc.createVariable("ensemble", "i4", ("ensemble",))
|
205
|
-
ensemble.axis = "T"
|
206
|
-
elif axis_option == "time":
|
207
|
-
tsize = len(time)
|
208
|
-
outnc.createDimension("time", tsize)
|
209
|
-
primary_axis = "time"
|
210
|
-
time_var = outnc.createVariable("time", "i4", ("time",))
|
211
|
-
time_var.axis = "T"
|
212
|
-
time_var.units = t0
|
213
|
-
time_var.long_name = "time"
|
214
|
-
|
215
|
-
# Convert time_data to numerical format
|
216
|
-
nctime = pd2nctime(time, t0)
|
217
|
-
time_var[:] = nctime
|
218
|
-
|
219
|
-
else:
|
220
|
-
raise ValueError(f"Invalid axis_option: {axis_option}.")
|
221
|
-
|
222
|
-
# Variables
|
223
|
-
|
224
|
-
flead = rd.FixedLeader(infile)
|
225
|
-
fdict = flead.fleader
|
226
|
-
varid = [0] * len(fdict)
|
227
|
-
|
228
|
-
i = 0
|
229
|
-
|
230
|
-
for key, values in fdict.items():
|
231
|
-
format_item = key.replace(" ", "_")
|
232
|
-
varid[i] = outnc.createVariable(
|
233
|
-
format_item, "i4", primary_axis, fill_value=-32768
|
234
|
-
)
|
235
|
-
var = values
|
236
|
-
vshape = var.shape
|
237
|
-
if i == 0:
|
238
|
-
if primary_axis == "ensemble":
|
239
|
-
ensemble[:] = np.arange(1, vshape[0] + 1, 1)
|
240
|
-
|
241
|
-
varid[i][0 : vshape[0]] = var
|
242
|
-
i += 1
|
243
|
-
|
244
|
-
# Add global attributes if provided
|
245
|
-
if attributes:
|
246
|
-
for key, value in attributes.items():
|
247
|
-
setattr(outnc, key, str(value)) # Store attributes as strings
|
248
179
|
|
249
|
-
|
250
|
-
|
251
|
-
def vlead_nc(
|
252
|
-
infile,
|
253
|
-
outfile,
|
254
|
-
time,
|
255
|
-
axis_option=None,
|
256
|
-
attributes=None,
|
257
|
-
t0="hours since 2000-01-01",
|
258
|
-
):
|
180
|
+
def vlead_nc(infile, outfile, time, axis_option=None, attributes=None, t0="hours since 2000-01-01"):
|
259
181
|
"""
|
260
182
|
Function to create ncfile containing Variable Leader.
|
261
183
|
|
@@ -304,12 +226,16 @@ def vlead_nc(
|
|
304
226
|
var = values
|
305
227
|
vshape = var.shape
|
306
228
|
if i == 0:
|
307
|
-
if primary_axis == "
|
229
|
+
if primary_axis == "time":
|
230
|
+
time[:] = np.arange(1, vshape[0] + 1, 1)
|
231
|
+
elif primary_axis == "ensemble":
|
308
232
|
ensemble[:] = np.arange(1, vshape[0] + 1, 1)
|
233
|
+
else:
|
234
|
+
raise ValueError(f"Invalid axis_option: {axis_option}.")
|
309
235
|
|
310
236
|
varid[i][0 : vshape[0]] = var
|
311
237
|
i += 1
|
312
|
-
|
238
|
+
|
313
239
|
# Add global attributes if provided
|
314
240
|
if attributes:
|
315
241
|
for key, value in attributes.items():
|
@@ -318,9 +244,7 @@ def vlead_nc(
|
|
318
244
|
outnc.close()
|
319
245
|
|
320
246
|
|
321
|
-
def finalnc(
|
322
|
-
outfile, depth, final_mask, final_echo, final_corr , final_pgood, time, data, t0="hours since 2000-01-01", attributes=None
|
323
|
-
):
|
247
|
+
def finalnc(outfile, depth, time, data, t0="hours since 2000-01-01", attributes=None):
|
324
248
|
"""
|
325
249
|
Function to create the processed NetCDF file.
|
326
250
|
|
@@ -335,19 +259,15 @@ def finalnc(
|
|
335
259
|
|
336
260
|
# Change velocity to cm/s
|
337
261
|
data = data.astype(np.float64)
|
338
|
-
data[data > fill] /= 10
|
262
|
+
data[data > fill] /= 10
|
339
263
|
|
340
264
|
# Change depth to positive
|
341
|
-
|
265
|
+
depth = abs(depth)
|
342
266
|
|
343
267
|
# Reverse the arrays if depth in descending order
|
344
268
|
if np.all(depth[:-1] >= depth[1:]):
|
345
269
|
depth = depth[::-1]
|
346
270
|
data = data[:, ::-1, :]
|
347
|
-
final_mask = final_mask[::-1, :]
|
348
|
-
final_echo = final_echo[:,::-1, :]
|
349
|
-
final_corr = final_corr[:,::-1, :]
|
350
|
-
final_pgood = final_pgood[:,::-1, :]
|
351
271
|
|
352
272
|
ncfile = nc4.Dataset(outfile, mode="w", format="NETCDF4")
|
353
273
|
# Check if depth is scalar or array
|
@@ -387,45 +307,6 @@ def finalnc(
|
|
387
307
|
evel.units = "cm/s"
|
388
308
|
evel.long_name = "error_velocity"
|
389
309
|
|
390
|
-
mvel = ncfile.createVariable("mask", np.float32, ("time", "depth"), fill_value=fill)
|
391
|
-
mvel.long_name = "Velocity Mask (1: bad value, 0: good value)"
|
392
|
-
|
393
|
-
echo1 = ncfile.createVariable("echo1", np.float32, ("time", "depth"), fill_value=-32768)
|
394
|
-
echo1.long_name = "Echo intensity Beam 1"
|
395
|
-
|
396
|
-
echo2 = ncfile.createVariable("echo2", np.float32, ("time", "depth"), fill_value=-32768)
|
397
|
-
echo2.long_name = "Echo intensity Beam 2"
|
398
|
-
|
399
|
-
echo3 = ncfile.createVariable("echo3", np.float32, ("time", "depth"), fill_value=-32768)
|
400
|
-
echo3.long_name = "Echo intensity Beam 3"
|
401
|
-
|
402
|
-
echo4 = ncfile.createVariable("echo4", np.float32, ("time", "depth"), fill_value=-32768)
|
403
|
-
echo4.long_name = "Echo intensity Beam 4"
|
404
|
-
|
405
|
-
corr1 = ncfile.createVariable("corr1", np.float32, ("time", "depth"), fill_value=-32768)
|
406
|
-
corr1.long_name = "Beam 1 correlation"
|
407
|
-
|
408
|
-
corr2 = ncfile.createVariable("corr2", np.float32, ("time", "depth"), fill_value=-32768)
|
409
|
-
corr2.long_name = "Beam 2 correlation"
|
410
|
-
|
411
|
-
corr3 = ncfile.createVariable("corr3", np.float32, ("time", "depth"), fill_value=-32768)
|
412
|
-
corr3.long_name = "Beam 3 correlation"
|
413
|
-
|
414
|
-
corr4 = ncfile.createVariable("corr4", np.float32, ("time", "depth"), fill_value=-32768)
|
415
|
-
corr4.long_name = "Beam 4 correlation"
|
416
|
-
|
417
|
-
pgd1 = ncfile.createVariable("pgd1", np.float32, ("time", "depth"), fill_value=-32768)
|
418
|
-
pgd1.long_name = "Percent Good Beam 1"
|
419
|
-
|
420
|
-
pgd2 = ncfile.createVariable("pgd2", np.float32, ("time", "depth"), fill_value=-32768)
|
421
|
-
pgd2.long_name = "Percent Good Beam 2"
|
422
|
-
|
423
|
-
pgd3 = ncfile.createVariable("pgd3", np.float32, ("time", "depth"), fill_value=-32768)
|
424
|
-
pgd3.long_name = "Percent Good Beam 3"
|
425
|
-
|
426
|
-
pgd4 = ncfile.createVariable("pgd4", np.float32, ("time", "depth"), fill_value=-32768)
|
427
|
-
pgd4.long_name = "Percent Good Beam 4"
|
428
|
-
|
429
310
|
nctime = pd2nctime(time, t0)
|
430
311
|
# write data
|
431
312
|
z[:] = depth
|
@@ -434,25 +315,10 @@ def finalnc(
|
|
434
315
|
vvel[:, :] = data[1, :, :].T
|
435
316
|
wvel[:, :] = data[2, :, :].T
|
436
317
|
evel[:, :] = data[3, :, :].T
|
437
|
-
|
438
|
-
echo1[:, :] = final_echo[0, :, :].T
|
439
|
-
echo2[:, :] = final_echo[1, :, :].T
|
440
|
-
echo3[:, :] = final_echo[2, :, :].T
|
441
|
-
echo4[:, :] = final_echo[3, :, :].T
|
442
|
-
corr1[:, :] = final_corr[0, :, :].T
|
443
|
-
corr2[:, :] = final_corr[1, :, :].T
|
444
|
-
corr3[:, :] = final_corr[2, :, :].T
|
445
|
-
corr4[:, :] = final_corr[3, :, :].T
|
446
|
-
pgd1[:, :] = final_pgood[0, :, :].T
|
447
|
-
pgd2[:, :] = final_pgood[1, :, :].T
|
448
|
-
pgd3[:, :] = final_pgood[2, :, :].T
|
449
|
-
pgd4[:, :] = final_pgood[3, :, :].T
|
450
|
-
|
318
|
+
|
451
319
|
# Add global attributes if provided
|
452
320
|
if attributes:
|
453
321
|
for key, value in attributes.items():
|
454
322
|
setattr(ncfile, key, str(value)) # Store attributes as strings
|
455
323
|
|
456
|
-
ncfile.mask_applied = "True"
|
457
|
-
|
458
324
|
ncfile.close()
|
@@ -1,8 +1,8 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.1
|
2
2
|
Name: pyadps
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.2.1b0
|
4
4
|
Summary: A Python package for ADCP data processing
|
5
|
-
Home-page: https://
|
5
|
+
Home-page: https://example.com
|
6
6
|
License: MIT
|
7
7
|
Keywords: adcp,data-processing,oceanography
|
8
8
|
Author: P. Amol
|
@@ -22,10 +22,10 @@ Requires-Dist: numpy (>=1.26.4)
|
|
22
22
|
Requires-Dist: pandas (>=2.2.2)
|
23
23
|
Requires-Dist: plotly (>=5.22.0)
|
24
24
|
Requires-Dist: plotly-resampler (>=0.10.0)
|
25
|
-
Requires-Dist: pygeomag (>=1.1.0,<2.0.0)
|
26
25
|
Requires-Dist: scipy (>=1.14.0)
|
27
26
|
Requires-Dist: streamlit (>=1.36.0)
|
28
|
-
|
27
|
+
Requires-Dist: wmm2020 (>=1.1.1)
|
28
|
+
Project-URL: Documentation, https://example.com/docs
|
29
29
|
Project-URL: Repository, https://github.com/p-amol/pyadps
|
30
30
|
Description-Content-Type: text/markdown
|
31
31
|
|
@@ -0,0 +1,31 @@
|
|
1
|
+
pyadps/Home_Page.py,sha256=gC0eFMtn85U_A4KcVlCEzXkB6a_J0WD3vpK691Kmyw8,1180
|
2
|
+
pyadps/__init__.py,sha256=bNCm6_WIhiwvaUeOZhRkyLZyzzUKfSH80Fslg0JPJyk,232
|
3
|
+
pyadps/__main__.py,sha256=cIFUayxPnKl00oIR99L6IUEvc8trW7dijtfBQCAen5c,356
|
4
|
+
pyadps/pages/01_Read_File.py,sha256=HmszmDISLnmpAw-NOwl_2p__vlUn-EceXAQJ0ua9bsQ,9004
|
5
|
+
pyadps/pages/02_View_Raw_Data.py,sha256=-Txl4seQG_c1iAyKRDGONebOARmgEelTgYw19DajToo,3675
|
6
|
+
pyadps/pages/03_Download_Raw_File.py,sha256=6tv1b5zyImSOVkTVhhGpm2TUVkvanhlTUksUlKJMWC8,8791
|
7
|
+
pyadps/pages/04_QC_Test.py,sha256=RR6xos_jgTVrxve8GyrUxvWhEmxpLgbQ-Cx-xAazsls,10335
|
8
|
+
pyadps/pages/05_Profile_Test.py,sha256=TBqxJ4TRM7TN5Y7UxXkVtyfS6isD7FWzyS4wuZw79XE,19570
|
9
|
+
pyadps/pages/06_Velocity_Test.py,sha256=pBl56ITM-fTM5UnfB_qcYdzWNtmlhD5ZeGUGLwrBKj8,12066
|
10
|
+
pyadps/pages/07_Write_File.py,sha256=hzhKxQXwoMa-WC7Co3ufkqPAS_iLkqea6I_OusDQUM4,16115
|
11
|
+
pyadps/pages/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
12
|
+
pyadps/utils/__init__.py,sha256=NJQy9tUDnAOvX9-c47LjBJzxYeICC4y-WBv44pOL09k,402
|
13
|
+
pyadps/utils/autoprocess.py,sha256=DB0a8ycyEL1n0nNWsG-1lU0JmO5CtNQA_VXJsntIfek,9691
|
14
|
+
pyadps/utils/cutbin.py,sha256=JioME3mo4wZKiJ7lOWqNo0MvxHNFYv2enirBoD0oh6E,15911
|
15
|
+
pyadps/utils/metadata/config.ini,sha256=zbwByM9mIfLPPCkaJI7ShCmLbnAI9lkeImnVpkSCw2U,1821
|
16
|
+
pyadps/utils/metadata/flmeta.json,sha256=diIB9nht_0uw9YJNSFGdZYGzeVbR-07zIZS9Nf4VPSE,14245
|
17
|
+
pyadps/utils/metadata/vlmeta.json,sha256=_dkQlGkkUvpAIM7S6kEUenSaiCpOrwXg8n1aU3dDF3s,22535
|
18
|
+
pyadps/utils/plotgen.py,sha256=ylYPxBmrtPc_ssgEwyUixc6p3QuNcTs88LgJHWk_Vag,7129
|
19
|
+
pyadps/utils/profile_test.py,sha256=_eXh0JstTAxvYAEJEn1J_QpEJWeQBVIyZ7IPWipq3Vg,6168
|
20
|
+
pyadps/utils/pyreadrdi.py,sha256=MX5xe5qKwFMF1RWeCQ3-vBDxm9nP0UbHsEJzSDewnuY,34807
|
21
|
+
pyadps/utils/readrdi.py,sha256=ZQnkoVI1NUUjU7tVWx4gnLo7b2C3Lv4LnVPKm56qvqg,45028
|
22
|
+
pyadps/utils/regrid.py,sha256=Hj2dYSk4RQgXWXvkil5s5GlhyF-gE4HvO9Y_yIWrfPM,10006
|
23
|
+
pyadps/utils/script.py,sha256=yf3AZS3FMS2xk77rwezGA8WefwV03vIRQ6HraoeLuBA,4965
|
24
|
+
pyadps/utils/signal_quality.py,sha256=E1lZWZfdUnbc5c02px5WWU8b12DnkeCo-gRHjIoe18s,4170
|
25
|
+
pyadps/utils/velocity_test.py,sha256=sjQDgyC8TtOcmR8xW7crPhbt9ZAyp6Ej5o8bOdcWqxk,4707
|
26
|
+
pyadps/utils/writenc.py,sha256=Oc6vtMec4YWitv_XQYBuiakvo3ZUACBL0uZSL9lGUm4,9793
|
27
|
+
pyadps-0.2.1b0.dist-info/LICENSE,sha256=sfY_7DzQF5FxnO2T6ek74dfm5uBmwEp1oEg_WlzNsb8,1092
|
28
|
+
pyadps-0.2.1b0.dist-info/METADATA,sha256=HIdgrdWhwU8gAGbJHV0S6U5DPj1aPQi_o_gzzx1w5EA,4455
|
29
|
+
pyadps-0.2.1b0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
30
|
+
pyadps-0.2.1b0.dist-info/entry_points.txt,sha256=qS5lbmTJLC4Ys0nu4-2tJoBpAHxTREta30KFrDyTfsY,90
|
31
|
+
pyadps-0.2.1b0.dist-info/RECORD,,
|