pyadps 0.1.0b0__py3-none-any.whl → 0.2.0b0__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 +2 -0
- pyadps/pages/03_Download_Raw_File.py +22 -9
- pyadps/pages/04_QC_Test.py +56 -5
- pyadps/pages/05_Profile_Test.py +203 -17
- pyadps/pages/06_Velocity_Test.py +67 -19
- pyadps/pages/07_Write_File.py +138 -53
- pyadps/utils/__init__.py +1 -1
- pyadps/utils/autoprocess.py +282 -0
- pyadps/utils/metadata/config.ini +81 -0
- pyadps/utils/profile_test.py +36 -24
- pyadps/utils/readrdi.py +3 -2
- pyadps/utils/regrid.py +211 -54
- pyadps/utils/velocity_test.py +50 -15
- pyadps/utils/writenc.py +82 -20
- {pyadps-0.1.0b0.dist-info → pyadps-0.2.0b0.dist-info}/METADATA +2 -1
- pyadps-0.2.0b0.dist-info/RECORD +31 -0
- {pyadps-0.1.0b0.dist-info → pyadps-0.2.0b0.dist-info}/WHEEL +1 -1
- {pyadps-0.1.0b0.dist-info → pyadps-0.2.0b0.dist-info}/entry_points.txt +1 -0
- pyadps-0.1.0b0.dist-info/RECORD +0 -29
- {pyadps-0.1.0b0.dist-info → pyadps-0.2.0b0.dist-info}/LICENSE +0 -0
pyadps/utils/writenc.py
CHANGED
@@ -68,9 +68,9 @@ def flead_ncatt(fl_obj, ncfile_id, ens=0):
|
|
68
68
|
setattr(ncfile_id, format_key, format(value))
|
69
69
|
|
70
70
|
|
71
|
-
def
|
71
|
+
def rawnc(infile, outfile, time, axis_option=None, attributes=None, t0="hours since 2000-01-01"):
|
72
72
|
"""
|
73
|
-
|
73
|
+
rawnc is a function to create netcdf file. Stores 3-D data types like
|
74
74
|
velocity, echo, correlation, and percent good.
|
75
75
|
|
76
76
|
Args:
|
@@ -90,14 +90,33 @@ def main(infile, outfile, attributes=None):
|
|
90
90
|
beam_list = flead.fleader["Beams"]
|
91
91
|
|
92
92
|
# Dimensions
|
93
|
-
|
93
|
+
# Define the primary axis based on axis_option
|
94
|
+
if axis_option == "ensemble":
|
95
|
+
outnc.createDimension("ensemble", None)
|
96
|
+
primary_axis = "ensemble"
|
97
|
+
ensemble = outnc.createVariable("ensemble", "i4", ("ensemble",))
|
98
|
+
ensemble.axis = "T"
|
99
|
+
elif axis_option == "time":
|
100
|
+
tsize = len(time)
|
101
|
+
outnc.createDimension("time", tsize)
|
102
|
+
primary_axis = "time"
|
103
|
+
time_var = outnc.createVariable("time", "i4", ("time",))
|
104
|
+
time_var.axis = "T"
|
105
|
+
time_var.units = t0
|
106
|
+
time_var.long_name = "time"
|
107
|
+
|
108
|
+
# Convert time_data to numerical format
|
109
|
+
nctime = pd2nctime(time, t0)
|
110
|
+
time_var[:] = nctime
|
111
|
+
|
112
|
+
else:
|
113
|
+
raise ValueError(f"Invalid axis_option: {axis_option}.")
|
114
|
+
|
94
115
|
outnc.createDimension("cell", max(cell_list))
|
95
116
|
outnc.createDimension("beam", max(beam_list))
|
96
117
|
|
97
118
|
# Variables
|
98
119
|
# Dimension Variables
|
99
|
-
ensemble = outnc.createVariable("ensemble", "u4", ("ensemble",))
|
100
|
-
ensemble.axis = "T"
|
101
120
|
cell = outnc.createVariable("cell", "i2", ("cell",))
|
102
121
|
cell.axis = "Z"
|
103
122
|
beam = outnc.createVariable("beam", "i2", ("beam",))
|
@@ -118,9 +137,9 @@ def main(infile, outfile, attributes=None):
|
|
118
137
|
for i, item in enumerate(varlist):
|
119
138
|
if item == "Velocity":
|
120
139
|
varid[i] = outnc.createVariable(
|
121
|
-
item, "i2", (
|
140
|
+
item, "i2", (primary_axis, "cell", "beam"), fill_value=-32768
|
122
141
|
)
|
123
|
-
varid[i].missing_value = -32768
|
142
|
+
# varid[i].missing_value = -32768
|
124
143
|
vel = getattr(rd, item)
|
125
144
|
var = vel(infile).data
|
126
145
|
# var = rd.variables(infile, item)
|
@@ -129,7 +148,7 @@ def main(infile, outfile, attributes=None):
|
|
129
148
|
# Unsigned integers might be assigned for future netcdf versions
|
130
149
|
format_item = item.replace(" ", "") # For percent good
|
131
150
|
varid[i] = outnc.createVariable(
|
132
|
-
format_item, "i2", (
|
151
|
+
format_item, "i2", (primary_axis, "cell", "beam")
|
133
152
|
)
|
134
153
|
datatype = getattr(rd, format_item)
|
135
154
|
var = np.array(datatype(infile).data, dtype="int16")
|
@@ -137,7 +156,13 @@ def main(infile, outfile, attributes=None):
|
|
137
156
|
|
138
157
|
vshape = var.T.shape
|
139
158
|
if i == 0:
|
140
|
-
|
159
|
+
if primary_axis == "time":
|
160
|
+
time[:] = np.arange(1, vshape[0] + 1, 1)
|
161
|
+
elif primary_axis == "ensemble":
|
162
|
+
ensemble[:] = np.arange(1, vshape[0] + 1, 1)
|
163
|
+
else:
|
164
|
+
raise ValueError(f"Invalid axis_option: {axis_option}.")
|
165
|
+
|
141
166
|
varid[i][0 : vshape[0], 0 : vshape[1], 0 : vshape[2]] = var.T
|
142
167
|
|
143
168
|
# Add global attributes if provided
|
@@ -152,7 +177,7 @@ def main(infile, outfile, attributes=None):
|
|
152
177
|
outnc.close()
|
153
178
|
|
154
179
|
|
155
|
-
def vlead_nc(infile, outfile, attributes=None):
|
180
|
+
def vlead_nc(infile, outfile, time, axis_option=None, attributes=None, t0="hours since 2000-01-01"):
|
156
181
|
"""
|
157
182
|
Function to create ncfile containing Variable Leader.
|
158
183
|
|
@@ -163,12 +188,29 @@ def vlead_nc(infile, outfile, attributes=None):
|
|
163
188
|
outnc = nc4.Dataset(outfile, "w", format="NETCDF4")
|
164
189
|
|
165
190
|
# Dimensions
|
166
|
-
|
191
|
+
# Define the primary axis based on axis_option
|
192
|
+
if axis_option == "ensemble":
|
193
|
+
outnc.createDimension("ensemble", None)
|
194
|
+
primary_axis = "ensemble"
|
195
|
+
ensemble = outnc.createVariable("ensemble", "i4", ("ensemble",))
|
196
|
+
ensemble.axis = "T"
|
197
|
+
elif axis_option == "time":
|
198
|
+
tsize = len(time)
|
199
|
+
outnc.createDimension("time", tsize)
|
200
|
+
primary_axis = "time"
|
201
|
+
time_var = outnc.createVariable("time", "i4", ("time",))
|
202
|
+
time_var.axis = "T"
|
203
|
+
time_var.units = t0
|
204
|
+
time_var.long_name = "time"
|
205
|
+
|
206
|
+
# Convert time_data to numerical format
|
207
|
+
nctime = pd2nctime(time, t0)
|
208
|
+
time_var[:] = nctime
|
209
|
+
|
210
|
+
else:
|
211
|
+
raise ValueError(f"Invalid axis_option: {axis_option}.")
|
167
212
|
|
168
213
|
# Variables
|
169
|
-
# Dimension Variables
|
170
|
-
ensemble = outnc.createVariable("ensemble", "i4", ("ensemble",))
|
171
|
-
ensemble.axis = "T"
|
172
214
|
|
173
215
|
vlead = rd.VariableLeader(infile)
|
174
216
|
vdict = vlead.vleader
|
@@ -179,12 +221,17 @@ def vlead_nc(infile, outfile, attributes=None):
|
|
179
221
|
for key, values in vdict.items():
|
180
222
|
format_item = key.replace(" ", "_")
|
181
223
|
varid[i] = outnc.createVariable(
|
182
|
-
format_item, "i4",
|
224
|
+
format_item, "i4", primary_axis, fill_value=-32768
|
183
225
|
)
|
184
226
|
var = values
|
185
227
|
vshape = var.shape
|
186
228
|
if i == 0:
|
187
|
-
|
229
|
+
if primary_axis == "time":
|
230
|
+
time[:] = np.arange(1, vshape[0] + 1, 1)
|
231
|
+
elif primary_axis == "ensemble":
|
232
|
+
ensemble[:] = np.arange(1, vshape[0] + 1, 1)
|
233
|
+
else:
|
234
|
+
raise ValueError(f"Invalid axis_option: {axis_option}.")
|
188
235
|
|
189
236
|
varid[i][0 : vshape[0]] = var
|
190
237
|
i += 1
|
@@ -208,6 +255,20 @@ def finalnc(outfile, depth, time, data, t0="hours since 2000-01-01", attributes=
|
|
208
255
|
data (numpy array): Velocity (beam, depth, time)
|
209
256
|
t0 (string): Time unit and origin
|
210
257
|
"""
|
258
|
+
fill = -32768
|
259
|
+
|
260
|
+
# Change velocity to cm/s
|
261
|
+
data = data.astype(np.float64)
|
262
|
+
data[data > fill] /= 10
|
263
|
+
|
264
|
+
# Change depth to positive
|
265
|
+
depth = abs(depth)
|
266
|
+
|
267
|
+
# Reverse the arrays if depth in descending order
|
268
|
+
if np.all(depth[:-1] >= depth[1:]):
|
269
|
+
depth = depth[::-1]
|
270
|
+
data = data[:, ::-1, :]
|
271
|
+
|
211
272
|
ncfile = nc4.Dataset(outfile, mode="w", format="NETCDF4")
|
212
273
|
# Check if depth is scalar or array
|
213
274
|
if np.isscalar(depth):
|
@@ -221,21 +282,22 @@ def finalnc(outfile, depth, time, data, t0="hours since 2000-01-01", attributes=
|
|
221
282
|
z = ncfile.createVariable("depth", np.float32, ("depth"))
|
222
283
|
z.units = "m"
|
223
284
|
z.long_name = "depth"
|
285
|
+
z.positive = "down"
|
224
286
|
|
225
287
|
t = ncfile.createVariable("time", np.float32, ("time"))
|
226
288
|
t.units = t0
|
227
289
|
t.long_name = "time"
|
228
290
|
|
229
291
|
# Create 2D variables
|
230
|
-
uvel = ncfile.createVariable("u", np.float32, ("time", "depth"), fill_value
|
292
|
+
uvel = ncfile.createVariable("u", np.float32, ("time", "depth"), fill_value=fill)
|
231
293
|
uvel.units = "cm/s"
|
232
294
|
uvel.long_name = "zonal_velocity"
|
233
295
|
|
234
|
-
vvel = ncfile.createVariable("v", np.float32, ("time", "depth"), fill_value
|
296
|
+
vvel = ncfile.createVariable("v", np.float32, ("time", "depth"), fill_value=fill)
|
235
297
|
vvel.units = "cm/s"
|
236
298
|
vvel.long_name = "meridional_velocity"
|
237
299
|
|
238
|
-
wvel = ncfile.createVariable("w", np.float32, ("time", "depth"), fill_value
|
300
|
+
wvel = ncfile.createVariable("w", np.float32, ("time", "depth"), fill_value=fill)
|
239
301
|
wvel.units = "cm/s"
|
240
302
|
wvel.long_name = "vertical_velocity"
|
241
303
|
|
@@ -247,7 +309,7 @@ def finalnc(outfile, depth, time, data, t0="hours since 2000-01-01", attributes=
|
|
247
309
|
|
248
310
|
nctime = pd2nctime(time, t0)
|
249
311
|
# write data
|
250
|
-
z[:] = depth
|
312
|
+
z[:] = depth
|
251
313
|
t[:] = nctime
|
252
314
|
uvel[:, :] = data[0, :, :].T
|
253
315
|
vvel[:, :] = data[1, :, :].T
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: pyadps
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.2.0b0
|
4
4
|
Summary: A Python package for ADCP data processing
|
5
5
|
Home-page: https://example.com
|
6
6
|
License: MIT
|
@@ -12,6 +12,7 @@ Classifier: License :: OSI Approved :: MIT License
|
|
12
12
|
Classifier: Operating System :: OS Independent
|
13
13
|
Classifier: Programming Language :: Python :: 3
|
14
14
|
Classifier: Programming Language :: Python :: 3.12
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
15
16
|
Provides-Extra: tests
|
16
17
|
Requires-Dist: cmake (>=3.30.2)
|
17
18
|
Requires-Dist: matplotlib (>=3.8.4)
|
@@ -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=nN05FfZZ1wWOY0T1HRKQ9e2SGoKcc1eQLnTQnmQlfQw,8904
|
5
|
+
pyadps/pages/02_View_Raw_Data.py,sha256=-Txl4seQG_c1iAyKRDGONebOARmgEelTgYw19DajToo,3675
|
6
|
+
pyadps/pages/03_Download_Raw_File.py,sha256=XBpn4Jt4f9XjZoELS7svJW8S5JBFJnKPUkuIgsHlz_w,8787
|
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.0b0.dist-info/LICENSE,sha256=sfY_7DzQF5FxnO2T6ek74dfm5uBmwEp1oEg_WlzNsb8,1092
|
28
|
+
pyadps-0.2.0b0.dist-info/METADATA,sha256=bcnpYpROIyXwlFdsDSTHRnryh1CokPj6bqi5jTY1LVw,4238
|
29
|
+
pyadps-0.2.0b0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
30
|
+
pyadps-0.2.0b0.dist-info/entry_points.txt,sha256=qS5lbmTJLC4Ys0nu4-2tJoBpAHxTREta30KFrDyTfsY,90
|
31
|
+
pyadps-0.2.0b0.dist-info/RECORD,,
|
pyadps-0.1.0b0.dist-info/RECORD
DELETED
@@ -1,29 +0,0 @@
|
|
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=ndBslgOHxbk6U6AMKL2uEnwCFL7rukpx8CqfM-_LXz8,8788
|
5
|
-
pyadps/pages/02_View_Raw_Data.py,sha256=-Txl4seQG_c1iAyKRDGONebOARmgEelTgYw19DajToo,3675
|
6
|
-
pyadps/pages/03_Download_Raw_File.py,sha256=YdGnlx6ZsJ_vAEK8086sCIHewvi9gg0d2yWl7s7qeNU,8216
|
7
|
-
pyadps/pages/04_QC_Test.py,sha256=uawHLN9X7X7ykOZtI_viMMG-OlEEerm2X8uJFyWiRzo,8363
|
8
|
-
pyadps/pages/05_Profile_Test.py,sha256=wQ_jXaaaEPCdb4yWzITHuGlkbGdw97ZnlK_4ppF7XS4,12114
|
9
|
-
pyadps/pages/06_Velocity_Test.py,sha256=8AtUC3V7BJPuxVe1gMkrdwG0_XZwE0DE4bRCW86Luto,9666
|
10
|
-
pyadps/pages/07_Write_File.py,sha256=7SBx4IDV4Oi6CBPvTzV7dJCvjGOimr6FwSEksk_rQBk,13481
|
11
|
-
pyadps/pages/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
12
|
-
pyadps/utils/__init__.py,sha256=EyjpjGiv-IEL7Q09pBvVJ6O7rnRyUdb1dkNlOFTn_xQ,362
|
13
|
-
pyadps/utils/cutbin.py,sha256=JioME3mo4wZKiJ7lOWqNo0MvxHNFYv2enirBoD0oh6E,15911
|
14
|
-
pyadps/utils/metadata/flmeta.json,sha256=diIB9nht_0uw9YJNSFGdZYGzeVbR-07zIZS9Nf4VPSE,14245
|
15
|
-
pyadps/utils/metadata/vlmeta.json,sha256=_dkQlGkkUvpAIM7S6kEUenSaiCpOrwXg8n1aU3dDF3s,22535
|
16
|
-
pyadps/utils/plotgen.py,sha256=ylYPxBmrtPc_ssgEwyUixc6p3QuNcTs88LgJHWk_Vag,7129
|
17
|
-
pyadps/utils/profile_test.py,sha256=1Ot8_1z9VUfX4bmVp-_P_QStrnbkVDwLth2pQQCJTrM,5652
|
18
|
-
pyadps/utils/pyreadrdi.py,sha256=MX5xe5qKwFMF1RWeCQ3-vBDxm9nP0UbHsEJzSDewnuY,34807
|
19
|
-
pyadps/utils/readrdi.py,sha256=jRtzMsaAd_raDD5fmAjVXK5M18QgukmW7SmmACI98o0,44975
|
20
|
-
pyadps/utils/regrid.py,sha256=Oh1s4g83EWOvCfOkFiEpNoEI3ARwMukjlmVCi834KYM,3269
|
21
|
-
pyadps/utils/script.py,sha256=yf3AZS3FMS2xk77rwezGA8WefwV03vIRQ6HraoeLuBA,4965
|
22
|
-
pyadps/utils/signal_quality.py,sha256=E1lZWZfdUnbc5c02px5WWU8b12DnkeCo-gRHjIoe18s,4170
|
23
|
-
pyadps/utils/velocity_test.py,sha256=keNd2DNBF0E0FhkqGHXM-zapA5xCEvvh8eyBd3xacvU,3555
|
24
|
-
pyadps/utils/writenc.py,sha256=fJi7KSUS5AqZt-YNVsfM74Q0Dq54FUiPyMkNFRc83MQ,7663
|
25
|
-
pyadps-0.1.0b0.dist-info/LICENSE,sha256=sfY_7DzQF5FxnO2T6ek74dfm5uBmwEp1oEg_WlzNsb8,1092
|
26
|
-
pyadps-0.1.0b0.dist-info/METADATA,sha256=EYXVTygVzbyau6IJ4ro7iWq0Yv_3YobAO4KPoNeQp4c,4187
|
27
|
-
pyadps-0.1.0b0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
28
|
-
pyadps-0.1.0b0.dist-info/entry_points.txt,sha256=jFrXjOakSOPFOv2iDeYx_fI9FxdL1wXQ6FghECFpsvg,51
|
29
|
-
pyadps-0.1.0b0.dist-info/RECORD,,
|
File without changes
|