pyadps 0.3.0b0__tar.gz → 0.3.1b0__tar.gz

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.
Files changed (32) hide show
  1. {pyadps-0.3.0b0 → pyadps-0.3.1b0}/PKG-INFO +1 -1
  2. {pyadps-0.3.0b0 → pyadps-0.3.1b0}/pyproject.toml +1 -1
  3. {pyadps-0.3.0b0 → pyadps-0.3.1b0}/src/pyadps/pages/06_Profile_Test.py +38 -39
  4. {pyadps-0.3.0b0 → pyadps-0.3.1b0}/src/pyadps/pages/08_Write_File.py +3 -0
  5. {pyadps-0.3.0b0 → pyadps-0.3.1b0}/src/pyadps/utils/autoprocess.py +139 -40
  6. {pyadps-0.3.0b0 → pyadps-0.3.1b0}/LICENSE +0 -0
  7. {pyadps-0.3.0b0 → pyadps-0.3.1b0}/README.md +0 -0
  8. {pyadps-0.3.0b0 → pyadps-0.3.1b0}/src/pyadps/Home_Page.py +0 -0
  9. {pyadps-0.3.0b0 → pyadps-0.3.1b0}/src/pyadps/__init__.py +0 -0
  10. {pyadps-0.3.0b0 → pyadps-0.3.1b0}/src/pyadps/__main__.py +0 -0
  11. {pyadps-0.3.0b0 → pyadps-0.3.1b0}/src/pyadps/pages/01_Read_File.py +0 -0
  12. {pyadps-0.3.0b0 → pyadps-0.3.1b0}/src/pyadps/pages/02_View_Raw_Data.py +0 -0
  13. {pyadps-0.3.0b0 → pyadps-0.3.1b0}/src/pyadps/pages/03_Download_Raw_File.py +0 -0
  14. {pyadps-0.3.0b0 → pyadps-0.3.1b0}/src/pyadps/pages/04_Sensor_Health.py +0 -0
  15. {pyadps-0.3.0b0 → pyadps-0.3.1b0}/src/pyadps/pages/05_QC_Test.py +0 -0
  16. {pyadps-0.3.0b0 → pyadps-0.3.1b0}/src/pyadps/pages/07_Velocity_Test.py +0 -0
  17. {pyadps-0.3.0b0 → pyadps-0.3.1b0}/src/pyadps/pages/09_Auto_process.py +0 -0
  18. {pyadps-0.3.0b0 → pyadps-0.3.1b0}/src/pyadps/pages/__init__.py +0 -0
  19. {pyadps-0.3.0b0 → pyadps-0.3.1b0}/src/pyadps/utils/__init__.py +0 -0
  20. {pyadps-0.3.0b0 → pyadps-0.3.1b0}/src/pyadps/utils/metadata/config.ini +0 -0
  21. {pyadps-0.3.0b0 → pyadps-0.3.1b0}/src/pyadps/utils/metadata/demo.000 +0 -0
  22. {pyadps-0.3.0b0 → pyadps-0.3.1b0}/src/pyadps/utils/metadata/flmeta.json +0 -0
  23. {pyadps-0.3.0b0 → pyadps-0.3.1b0}/src/pyadps/utils/metadata/vlmeta.json +0 -0
  24. {pyadps-0.3.0b0 → pyadps-0.3.1b0}/src/pyadps/utils/plotgen.py +0 -0
  25. {pyadps-0.3.0b0 → pyadps-0.3.1b0}/src/pyadps/utils/profile_test.py +0 -0
  26. {pyadps-0.3.0b0 → pyadps-0.3.1b0}/src/pyadps/utils/pyreadrdi.py +0 -0
  27. {pyadps-0.3.0b0 → pyadps-0.3.1b0}/src/pyadps/utils/readrdi.py +0 -0
  28. {pyadps-0.3.0b0 → pyadps-0.3.1b0}/src/pyadps/utils/script.py +0 -0
  29. {pyadps-0.3.0b0 → pyadps-0.3.1b0}/src/pyadps/utils/sensor_health.py +0 -0
  30. {pyadps-0.3.0b0 → pyadps-0.3.1b0}/src/pyadps/utils/signal_quality.py +0 -0
  31. {pyadps-0.3.0b0 → pyadps-0.3.1b0}/src/pyadps/utils/velocity_test.py +0 -0
  32. {pyadps-0.3.0b0 → pyadps-0.3.1b0}/src/pyadps/utils/writenc.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pyadps
3
- Version: 0.3.0b0
3
+ Version: 0.3.1b0
4
4
  Summary: A Python package for ADCP data processing
5
5
  Home-page: https://example.com
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "pyadps"
3
- version = "0.3.0-beta"
3
+ version = "0.3.1-beta"
4
4
  description = "A Python package for ADCP data processing"
5
5
  authors = ["P. Amol <prakashamol@gmail.com>"]
6
6
  readme = "README.md"
@@ -114,38 +114,6 @@ def hard_reset(option):
114
114
  )
115
115
 
116
116
 
117
- # Giving infromations and warnings according to the state of masks.
118
- if st.session_state.isQCTest or st.session_state.isSensorTest:
119
- st.write(":grey[Working on a saved mask file ...]")
120
- if st.session_state.isProfilePageReturn:
121
- st.write(
122
- ":orange[Warning: Profile test already completed. Reset to change settings.]"
123
- )
124
- reset_selectbox = st.selectbox(
125
- "Choose reset option",
126
- ("Sensor Test", "QC Test", "Default"),
127
- index=None,
128
- placeholder="Reset mask to ...",
129
- )
130
- # Selecting the original mask file.
131
- if reset_selectbox == "Default":
132
- st.write("Default mask file selected")
133
- elif reset_selectbox == "Sensor Test":
134
- st.write("Sensor Test mask file selected")
135
- elif reset_selectbox == "QC Test":
136
- st.write("QC Test mask file selected")
137
- if reset_selectbox is not None:
138
- hard_reset(reset_selectbox)
139
- elif st.session_state.isFirstProfileVisit:
140
- reset_profiletest()
141
- st.session_state.isFirstProfileVisit = False
142
- else:
143
- if st.session_state.isFirstProfileVisit:
144
- reset_profiletest()
145
- st.session_state.isFirstProfileVisit = False
146
- st.write(":orange[Creating a new mask file ...]")
147
-
148
-
149
117
  # Load data
150
118
  ds = st.session_state.ds
151
119
  flobj = st.session_state.flead
@@ -466,6 +434,37 @@ def save_profiletest():
466
434
  st.session_state.isQCPageReturn = True
467
435
 
468
436
 
437
+ # Giving infromations and warnings according to the state of masks.
438
+ if st.session_state.isQCTest or st.session_state.isSensorTest:
439
+ st.write(":grey[Working on a saved mask file ...]")
440
+ if st.session_state.isProfilePageReturn:
441
+ st.write(
442
+ ":orange[Warning: Profile test already completed. Reset to change settings.]"
443
+ )
444
+ reset_selectbox = st.selectbox(
445
+ "Choose reset option",
446
+ ("Sensor Test", "QC Test", "Default"),
447
+ index=None,
448
+ placeholder="Reset mask to ...",
449
+ )
450
+ # Selecting the original mask file.
451
+ if reset_selectbox == "Default":
452
+ st.write("Default mask file selected")
453
+ elif reset_selectbox == "Sensor Test":
454
+ st.write("Sensor Test mask file selected")
455
+ elif reset_selectbox == "QC Test":
456
+ st.write("QC Test mask file selected")
457
+ if reset_selectbox is not None:
458
+ hard_reset(reset_selectbox)
459
+ elif st.session_state.isFirstProfileVisit:
460
+ reset_profiletest()
461
+ st.session_state.isFirstProfileVisit = False
462
+ else:
463
+ if st.session_state.isFirstProfileVisit:
464
+ reset_profiletest()
465
+ st.session_state.isFirstProfileVisit = False
466
+ st.write(":orange[Creating a new mask file ...]")
467
+
469
468
  st.header("Profile Test")
470
469
  # Creating tabs for each actions
471
470
  tab1, tab2, tab3, tab4, tab5 = st.tabs(
@@ -486,6 +485,11 @@ with tab1:
486
485
  start_ens = st.slider("Deployment Ensembles", 0, ens_range, 0)
487
486
  end_ens = st.slider("Recovery Ensembles", x[-1] - ens_range, x[-1] + 1, x[-1] + 1)
488
487
 
488
+ n = int(ens_range)
489
+ if start_ens or end_ens:
490
+ trim_ends(start_ens=int(start_ens), end_ens=int(end_ens), ens_range=n)
491
+ # st.session_state.update_mask = False
492
+
489
493
  st.session_state.trimends_ens_range = int(ens_range)
490
494
  st.session_state.trimends_start_ens = start_ens
491
495
  st.session_state.trimends_end_ens = end_ens
@@ -493,11 +497,6 @@ with tab1:
493
497
  [st.session_state.trimends_start_ens, st.session_state.trimends_end_ens]
494
498
  )
495
499
 
496
- n = 20
497
- if start_ens or end_ens:
498
- trim_ends(start_ens=start_ens, end_ens=end_ens, ens_range=n)
499
- # st.session_state.update_mask = False
500
-
501
500
  left_te, right_te = st.columns([1, 1])
502
501
  with left_te:
503
502
  trimends_mask_button = st.button("Trim Ends", on_click=set_button_trimends)
@@ -655,7 +654,7 @@ with tab3:
655
654
  if delete_cell_button:
656
655
  st.write("Deleted cell: ", st.session_state.profile_delete_cell)
657
656
 
658
- elif delete_option == "Ensemble":
657
+ if delete_option == "Ensemble":
659
658
  # Option to delete a specific ensemble across all cells
660
659
  st.write("Select a specific ensemble to delete across all cells")
661
660
 
@@ -670,7 +669,7 @@ with tab3:
670
669
  )
671
670
 
672
671
  if delete_ensemble_button:
673
- st.write("Deleted cell: ", st.session_state.profile_delete_ensemble)
672
+ st.write("Deleted Ensemble: ", st.session_state.profile_delete_ensemble)
674
673
 
675
674
  velocity = st.session_state.velocity_temp
676
675
  # Map variable selection to corresponding data
@@ -370,9 +370,12 @@ if generate_config_radio == "Yes":
370
370
  if st.session_state.isSensorTest:
371
371
  config["SensorTest"]["sensor_test"] = "True"
372
372
  if st.session_state.isRollCheck:
373
+ config["RollTest"]["roll_test"] = "True"
373
374
  config["SensorTest"]["roll_cutoff"] = str(
374
375
  st.session_state.sensor_roll_cutoff
375
376
  )
377
+ else:
378
+ config["RollTest"]["roll_test"] = "False"
376
379
  if st.session_state.isRollCheck:
377
380
  config["SensorTest"]["pitch_cutoff"] = str(
378
381
  st.session_state.sensor_pitch_cutoff
@@ -5,7 +5,7 @@ import numpy as np
5
5
  import pandas as pd
6
6
  import pyadps.utils.writenc as wr
7
7
  from pyadps.utils import readrdi
8
- from pyadps.utils.profile_test import side_lobe_beam_angle,manual_cut_bins
8
+ from pyadps.utils.profile_test import side_lobe_beam_angle, manual_cut_bins
9
9
  from pyadps.utils.profile_test import regrid2d, regrid3d
10
10
  from pyadps.utils.signal_quality import (
11
11
  default_mask,
@@ -13,16 +13,17 @@ from pyadps.utils.signal_quality import (
13
13
  false_target,
14
14
  pg_check,
15
15
  echo_check,
16
- correlation_check
16
+ correlation_check,
17
17
  )
18
18
  from pyadps.utils.velocity_test import (
19
19
  despike,
20
20
  flatline,
21
21
  velocity_cutoff,
22
22
  wmm2020api,
23
- velocity_modifier
23
+ velocity_modifier,
24
24
  )
25
25
 
26
+
26
27
  def main():
27
28
  # Get the config file
28
29
  try:
@@ -33,21 +34,23 @@ def main():
33
34
  print("File not found!")
34
35
  except Exception as e:
35
36
  import traceback
37
+
36
38
  print("Error: Unable to process the data.")
37
39
  traceback.print_exc()
38
40
 
39
- def autoprocess(config_file,binary_file_path=None):
41
+
42
+ def autoprocess(config_file, binary_file_path=None):
40
43
  # Load configuration
41
44
  config = configparser.ConfigParser()
42
45
 
43
46
  # Decode and parse the config file
44
47
  # Check if config_file is a file-like object or a file path
45
- if hasattr(config_file, 'read'):
48
+ if hasattr(config_file, "read"):
46
49
  # If it's a file-like object, read its content
47
50
  config_content = config_file.read().decode("utf-8")
48
51
  else:
49
52
  # If it's a file path, open the file and read its content
50
- with open(config_file, 'r', encoding="utf-8") as file:
53
+ with open(config_file, "r", encoding="utf-8") as file:
51
54
  config_content = file.read()
52
55
  config.read_string(config_content)
53
56
 
@@ -73,7 +76,7 @@ def autoprocess(config_file,binary_file_path=None):
73
76
  cells = flobj.field()["Cells"]
74
77
  fdata = flobj.fleader
75
78
  vdata = vlobj.vleader
76
- # depth = ds.variableleader.depth_of_transducer
79
+ # depth = ds.variableleader.depth_of_transducer
77
80
 
78
81
  # Initialize mask
79
82
  mask = default_mask(ds)
@@ -83,8 +86,13 @@ def autoprocess(config_file,binary_file_path=None):
83
86
  y = np.arange(0, cells, 1)
84
87
  depth = None
85
88
 
86
- axis_option = config.get("DownloadOptions","axis_option")
89
+ axis_option = config.get("DownloadOptions", "axis_option")
87
90
 
91
+ # Sensor Test
92
+ isSensorTest = config.getboolean("SensorTest", "sensor_test")
93
+ isRollTest = config.getboolean("RollTest", "roll_test")
94
+ # if isSensorTest:
95
+ # if isRollTest:
88
96
 
89
97
  # QC Test
90
98
  isQCTest = config.getboolean("QCTest", "qc_test")
@@ -134,24 +142,24 @@ def autoprocess(config_file,binary_file_path=None):
134
142
  mask,
135
143
  orientation=orientation,
136
144
  water_column_depth=water_column_depth,
137
- extra_cells=add_cells
138
- )
139
- else :
145
+ extra_cells=add_cells,
146
+ )
147
+ else:
140
148
  mask = side_lobe_beam_angle(
141
149
  ds,
142
150
  mask,
143
151
  orientation=orientation,
144
152
  water_column_depth=water_column_depth,
145
- extra_cells=add_cells
146
- )
153
+ extra_cells=add_cells,
154
+ )
147
155
 
148
156
  print("Cutbins complete.")
149
157
 
150
- #Manual Cut Bins
158
+ # Manual Cut Bins
151
159
  isManual_cutbins = config.getboolean("ProfileTest", "manual_cutbins")
152
160
  if isManual_cutbins:
153
161
  raw_bins = config.get("ProfileTest", "manual_cut_bins")
154
- bin_groups = raw_bins.split("]")
162
+ bin_groups = raw_bins.split("]")
155
163
 
156
164
  for group in bin_groups:
157
165
  if group.strip(): # Ignore empty parts
@@ -159,11 +167,12 @@ def autoprocess(config_file,binary_file_path=None):
159
167
  clean_group = group.replace("[", "").strip()
160
168
  values = list(map(int, clean_group.split(",")))
161
169
  min_cell, max_cell, min_ensemble, max_ensemble = values
162
- mask = manual_cut_bins(mask, min_cell, max_cell, min_ensemble, max_ensemble)
170
+ mask = manual_cut_bins(
171
+ mask, min_cell, max_cell, min_ensemble, max_ensemble
172
+ )
163
173
 
164
174
  print("Manual cut bins applied.")
165
175
 
166
-
167
176
  isRegrid = config.getboolean("ProfileTest", "regrid")
168
177
  if isRegrid:
169
178
  print("File regridding started. This will take a few seconds ...")
@@ -172,19 +181,99 @@ def autoprocess(config_file,binary_file_path=None):
172
181
  interpolate = config.get("ProfileTest", "regrid_interpolation")
173
182
  boundary = 0
174
183
  if regrid_option == "Manual":
175
- boundary = config.get("ProfileTest","transducer_depth")
176
- z, velocity = regrid3d(ds,velocity, -32768,trimends=endpoints,orientation=orientation,method=interpolate,boundary_limit=boundary)
177
- z, echo = regrid3d(ds,echo, -32768,trimends=endpoints,orientation=orientation,method=interpolate,boundary_limit=boundary)
178
- z, correlation = regrid3d(ds,correlation, -32768,trimends=endpoints,orientation=orientation,method=interpolate,boundary_limit=boundary)
179
- z, pgood = regrid3d(ds,pgood, -32768,trimends=endpoints,orientation=orientation,method=interpolate,boundary_limit=boundary)
180
- z, mask = regrid2d(ds,mask, 1,trimends=endpoints,orientation=orientation,method=interpolate,boundary_limit=boundary)
184
+ boundary = config.get("ProfileTest", "transducer_depth")
185
+ z, velocity = regrid3d(
186
+ ds,
187
+ velocity,
188
+ -32768,
189
+ trimends=endpoints,
190
+ orientation=orientation,
191
+ method=interpolate,
192
+ boundary_limit=boundary,
193
+ )
194
+ z, echo = regrid3d(
195
+ ds,
196
+ echo,
197
+ -32768,
198
+ trimends=endpoints,
199
+ orientation=orientation,
200
+ method=interpolate,
201
+ boundary_limit=boundary,
202
+ )
203
+ z, correlation = regrid3d(
204
+ ds,
205
+ correlation,
206
+ -32768,
207
+ trimends=endpoints,
208
+ orientation=orientation,
209
+ method=interpolate,
210
+ boundary_limit=boundary,
211
+ )
212
+ z, pgood = regrid3d(
213
+ ds,
214
+ pgood,
215
+ -32768,
216
+ trimends=endpoints,
217
+ orientation=orientation,
218
+ method=interpolate,
219
+ boundary_limit=boundary,
220
+ )
221
+ z, mask = regrid2d(
222
+ ds,
223
+ mask,
224
+ 1,
225
+ trimends=endpoints,
226
+ orientation=orientation,
227
+ method=interpolate,
228
+ boundary_limit=boundary,
229
+ )
181
230
  depth = z
182
- else :
183
- z, velocity = regrid3d(ds,velocity, -32768,trimends=endpoints,orientation=orientation,method=interpolate,boundary_limit=boundary)
184
- z, echo = regrid3d(ds,echo, -32768,trimends=endpoints,orientation=orientation,method=interpolate,boundary_limit=boundary)
185
- z, correlation = regrid3d(ds,correlation, -32768,trimends=endpoints,orientation=orientation,method=interpolate,boundary_limit=boundary)
186
- z, pgood = regrid3d(ds,pgood, -32768,trimends=endpoints,orientation=orientation,method=interpolate,boundary_limit=boundary)
187
- z, mask = regrid2d(ds,mask, 1,trimends=endpoints,orientation=orientation,method=interpolate,boundary_limit=boundary)
231
+ else:
232
+ z, velocity = regrid3d(
233
+ ds,
234
+ velocity,
235
+ -32768,
236
+ trimends=endpoints,
237
+ orientation=orientation,
238
+ method=interpolate,
239
+ boundary_limit=boundary,
240
+ )
241
+ z, echo = regrid3d(
242
+ ds,
243
+ echo,
244
+ -32768,
245
+ trimends=endpoints,
246
+ orientation=orientation,
247
+ method=interpolate,
248
+ boundary_limit=boundary,
249
+ )
250
+ z, correlation = regrid3d(
251
+ ds,
252
+ correlation,
253
+ -32768,
254
+ trimends=endpoints,
255
+ orientation=orientation,
256
+ method=interpolate,
257
+ boundary_limit=boundary,
258
+ )
259
+ z, pgood = regrid3d(
260
+ ds,
261
+ pgood,
262
+ -32768,
263
+ trimends=endpoints,
264
+ orientation=orientation,
265
+ method=interpolate,
266
+ boundary_limit=boundary,
267
+ )
268
+ z, mask = regrid2d(
269
+ ds,
270
+ mask,
271
+ 1,
272
+ trimends=endpoints,
273
+ orientation=orientation,
274
+ method=interpolate,
275
+ boundary_limit=boundary,
276
+ )
188
277
  depth = z
189
278
 
190
279
  print("Regrid Complete.")
@@ -202,13 +291,10 @@ def autoprocess(config_file,binary_file_path=None):
202
291
  magdep = config.getfloat("VelocityTest", "depth")
203
292
  magyear = config.getfloat("VelocityTest", "year")
204
293
  year = int(magyear)
205
- # mag = config.getfloat("VelocityTest", "mag")
206
-
294
+ # mag = config.getfloat("VelocityTest", "mag")
207
295
 
208
- mag = wmm2020api(
209
- maglat, maglon, year
210
- )
211
- velocity = velocity_modifier(velocity,mag)
296
+ mag = wmm2020api(maglat, maglon, year)
297
+ velocity = velocity_modifier(velocity, mag)
212
298
  print(f"Magnetic Declination applied. The value is {mag[0]} degrees.")
213
299
  isCutOff = config.getboolean("VelocityTest", "cutoff")
214
300
  if isCutOff:
@@ -262,7 +348,7 @@ def autoprocess(config_file,binary_file_path=None):
262
348
  kernal_size=despike_kernal,
263
349
  cutoff=despike_cutoff,
264
350
  )
265
-
351
+
266
352
  print("Flatlines in velocity removed.")
267
353
 
268
354
  print("Velocity Test complete.")
@@ -323,13 +409,20 @@ def autoprocess(config_file,binary_file_path=None):
323
409
  isWriteRawNC = config.get("DownloadOptions", "download_raw")
324
410
  isWriteVleadNC = config.get("DownloadOptions", "download_vlead")
325
411
  isWriteProcNC = config.get("DownloadOptions", "download_processed")
326
-
412
+
327
413
  if isWriteRawNC:
328
414
  filepath = config.get("FileSettings", "output_file_path")
329
415
  filename = config.get("FileSettings", "output_file_name_raw")
330
416
  output_file_path = os.path.join(filepath, filename)
331
417
  if isAttributes:
332
- wr.rawnc(full_input_file_path, output_file_path, date_raw, axis_option, attributes, isAttributes)
418
+ wr.rawnc(
419
+ full_input_file_path,
420
+ output_file_path,
421
+ date_raw,
422
+ axis_option,
423
+ attributes,
424
+ isAttributes,
425
+ )
333
426
 
334
427
  print("Raw file written.")
335
428
 
@@ -338,11 +431,17 @@ def autoprocess(config_file,binary_file_path=None):
338
431
  filename = config.get("FileSettings", "output_file_name_vlead")
339
432
  output_file_path = os.path.join(filepath, filename)
340
433
  if isAttributes:
341
- wr.vlead_nc(full_input_file_path, output_file_path, date_vlead, axis_option, attributes, isAttributes)
434
+ wr.vlead_nc(
435
+ full_input_file_path,
436
+ output_file_path,
437
+ date_vlead,
438
+ axis_option,
439
+ attributes,
440
+ isAttributes,
441
+ )
342
442
 
343
443
  print("Vlead file written.")
344
444
 
345
-
346
445
  depth1 = depth
347
446
 
348
447
  if isWriteProcNC:
File without changes
File without changes