pyadps 0.2.1b0__py3-none-any.whl → 0.3.0__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.
Files changed (39) hide show
  1. pyadps/Home_Page.py +11 -5
  2. pyadps/pages/01_Read_File.py +623 -215
  3. pyadps/pages/02_View_Raw_Data.py +97 -41
  4. pyadps/pages/03_Download_Raw_File.py +200 -67
  5. pyadps/pages/04_Sensor_Health.py +905 -0
  6. pyadps/pages/05_QC_Test.py +493 -0
  7. pyadps/pages/06_Profile_Test.py +971 -0
  8. pyadps/pages/07_Velocity_Test.py +600 -0
  9. pyadps/pages/08_Write_File.py +623 -0
  10. pyadps/pages/09_Add-Ons.py +168 -0
  11. pyadps/utils/__init__.py +5 -3
  12. pyadps/utils/autoprocess.py +371 -80
  13. pyadps/utils/logging_utils.py +269 -0
  14. pyadps/utils/metadata/config.ini +22 -4
  15. pyadps/utils/metadata/demo.000 +0 -0
  16. pyadps/utils/metadata/flmeta.json +420 -420
  17. pyadps/utils/metadata/vlmeta.json +611 -565
  18. pyadps/utils/multifile.py +292 -0
  19. pyadps/utils/plotgen.py +505 -3
  20. pyadps/utils/profile_test.py +720 -125
  21. pyadps/utils/pyreadrdi.py +164 -92
  22. pyadps/utils/readrdi.py +436 -186
  23. pyadps/utils/script.py +197 -147
  24. pyadps/utils/sensor_health.py +120 -0
  25. pyadps/utils/signal_quality.py +472 -68
  26. pyadps/utils/velocity_test.py +79 -31
  27. pyadps/utils/writenc.py +222 -39
  28. {pyadps-0.2.1b0.dist-info → pyadps-0.3.0.dist-info}/METADATA +13 -14
  29. pyadps-0.3.0.dist-info/RECORD +35 -0
  30. {pyadps-0.2.1b0.dist-info → pyadps-0.3.0.dist-info}/WHEEL +1 -1
  31. {pyadps-0.2.1b0.dist-info → pyadps-0.3.0.dist-info}/entry_points.txt +1 -0
  32. pyadps/pages/04_QC_Test.py +0 -334
  33. pyadps/pages/05_Profile_Test.py +0 -575
  34. pyadps/pages/06_Velocity_Test.py +0 -341
  35. pyadps/pages/07_Write_File.py +0 -452
  36. pyadps/utils/cutbin.py +0 -413
  37. pyadps/utils/regrid.py +0 -279
  38. pyadps-0.2.1b0.dist-info/RECORD +0 -31
  39. {pyadps-0.2.1b0.dist-info → pyadps-0.3.0.dist-info}/LICENSE +0 -0
@@ -4,22 +4,28 @@ import os
4
4
  import numpy as np
5
5
  import pandas as pd
6
6
  import pyadps.utils.writenc as wr
7
+ from netCDF4 import date2num
7
8
  from pyadps.utils import readrdi
8
- from pyadps.utils.profile_test import side_lobe_beam_angle
9
- from pyadps.utils.regrid import regrid2d, regrid3d
9
+ from pyadps.utils.profile_test import side_lobe_beam_angle, manual_cut_bins
10
+ from pyadps.utils.profile_test import regrid2d, regrid3d
10
11
  from pyadps.utils.signal_quality import (
11
12
  default_mask,
12
13
  ev_check,
13
14
  false_target,
14
15
  pg_check,
15
- qc_check,
16
+ echo_check,
17
+ correlation_check,
16
18
  )
17
19
  from pyadps.utils.velocity_test import (
18
20
  despike,
19
21
  flatline,
20
- magnetic_declination,
21
22
  velocity_cutoff,
23
+ magdec,
24
+ wmm2020api,
25
+ velocity_modifier,
22
26
  )
27
+ from pyadps.utils.sensor_health import sound_speed_correction, tilt_sensor_check
28
+
23
29
 
24
30
  def main():
25
31
  # Get the config file
@@ -29,16 +35,34 @@ def main():
29
35
  autoprocess(filepath)
30
36
  else:
31
37
  print("File not found!")
32
- except:
38
+ except Exception as e:
39
+ import traceback
40
+
33
41
  print("Error: Unable to process the data.")
42
+ traceback.print_exc()
34
43
 
35
- def autoprocess(filepath):
44
+
45
+ def autoprocess(config_file, binary_file_path=None):
46
+ # Load configuration
36
47
  config = configparser.ConfigParser()
37
- config.read(filepath)
38
- input_file_name = config.get("FileSettings", "input_file_name")
39
- input_file_path = config.get("FileSettings", "input_file_path")
40
48
 
41
- full_input_file_path = os.path.join(input_file_path, input_file_name)
49
+ # Decode and parse the config file
50
+ # Check if config_file is a file-like object or a file path
51
+ if hasattr(config_file, "read"):
52
+ # If it's a file-like object, read its content
53
+ config_content = config_file.read().decode("utf-8")
54
+ else:
55
+ # If it's a file path, open the file and read its content
56
+ with open(config_file, "r", encoding="utf-8") as file:
57
+ config_content = file.read()
58
+ config.read_string(config_content)
59
+
60
+ if not binary_file_path:
61
+ input_file_name = config.get("FileSettings", "input_file_name")
62
+ input_file_path = config.get("FileSettings", "input_file_path")
63
+ full_input_file_path = os.path.join(input_file_path, input_file_name)
64
+ else:
65
+ full_input_file_path = binary_file_path
42
66
 
43
67
  print("File reading started. Please wait for a few seconds ...")
44
68
  ds = readrdi.ReadFile(full_input_file_path)
@@ -51,44 +75,173 @@ def autoprocess(filepath):
51
75
  echo = ds.echo.data
52
76
  correlation = ds.correlation.data
53
77
  pgood = ds.percentgood.data
78
+ roll = ds.roll.data
79
+ pitch = ds.pitch.data
80
+ sound = ds.speed_of_sound.data
81
+ depth = ds.depth_of_transducer.data
82
+ temperature = ds.temperature.data * ds.temperature.scale
83
+ salinity = ds.salinity.data * ds.salinity.scale
84
+ orientation = ds.fixedleader.system_configuration()["Beam Direction"]
54
85
  ensembles = header.ensembles
55
86
  cells = flobj.field()["Cells"]
56
- fdata = flobj.fleader
57
- vdata = vlobj.vleader
87
+ beams = flobj.field()["Beams"]
88
+ cell_size = flobj.field()["Depth Cell Len"]
89
+ bin1dist = flobj.field()["Bin 1 Dist"]
90
+ beam_angle = int(flobj.system_configuration()["Beam Angle"])
91
+
92
+ # Initialize mask
93
+ mask = default_mask(ds)
58
94
 
59
- mask = default_mask(flobj, velocity)
60
- print("Default Mask created.")
95
+ # Debugging statement
61
96
  x = np.arange(0, ensembles, 1)
62
- y = np.arange(0, cells, 1)
63
- depth = None
97
+
98
+ axis_option = config.get("DownloadOptions", "axis_option")
99
+
100
+ # Time Correction
101
+ isTimeAxisModified = config.getboolean("FixTime", "is_time_axis_modified")
102
+
103
+ if isTimeAxisModified:
104
+ isSnapTimeAxis = config.getboolean("FixTime", "is_snap_time_axis")
105
+ if isSnapTimeAxis:
106
+ time_snap_frequency = config.get("FixTime", "time_snap_frequency")
107
+ time_snap_tolerance = config.get("FixTime", "time_snap_tolerance")
108
+ time_target_minute = config.get("FixTime", "time_target_minute")
109
+ success, message = ds.snap_time_axis(
110
+ freq=time_snap_frequency,
111
+ tolerance=time_snap_tolerance,
112
+ target_minute=time_target_minute,
113
+ )
114
+ if success:
115
+ print(message)
116
+
117
+ isTimeGapFilled = config.getboolean("FixTime", "is_time_gap_filled")
118
+ if isTimeGapFilled:
119
+ success, message = ds.fill_time_axis()
120
+ if success:
121
+ print(message)
122
+
123
+ # Sensor Test
124
+ isSensorTest = config.getboolean("SensorTest", "sensor_test")
125
+ if isSensorTest:
126
+ isDepthModified = config.getboolean("SensorTest", "is_depth_modified")
127
+ if isDepthModified:
128
+ depth_option = config.get("SensorTest", "depth_input_option")
129
+ if depth_option == "Fixed Value":
130
+ fixed_depth = config.getfloat("SensorTest", "fixed_depth")
131
+ depth = np.full(ensembles, fixed_depth)
132
+ depth *= 10
133
+ elif depth_option == "File Upload":
134
+ depth_file_path = config.get("SensorTest", "depth_file_path")
135
+ df = pd.read_csv(depth_file_path)
136
+ depth = np.squeeze(df)
137
+ if len(depth) != ensembles:
138
+ print("""
139
+ Error: Uploaded file ensembles and
140
+ actual ensembles mismatch
141
+ """)
142
+ else:
143
+ print("Depth file uploaded.")
144
+
145
+ isSalinityModified = config.getboolean("SensorTest", "is_salinity_modified")
146
+ if isSalinityModified:
147
+ salinity_option = config.get("SensorTest", "salinity_input_option")
148
+ if salinity_option == "Fixed Value":
149
+ fixed_salinity = config.getfloat("SensorTest", "fixed_salinity")
150
+ salinity = np.full(ensembles, fixed_salinity)
151
+ salinity *= 10
152
+ elif salinity_option == "File Upload":
153
+ salinity_file_path = config.get("SensorTest", "salinity_file_path")
154
+ df = pd.read_csv(salinity_file_path)
155
+ salinity = np.squeeze(df)
156
+ if len(salinity) != ensembles:
157
+ print("""
158
+ Error: Uploaded file ensembles and
159
+ actual ensembles mismatch
160
+ """)
161
+ else:
162
+ print("Salinity file uploaded.")
163
+
164
+ isTemperatureModified = config.getboolean(
165
+ "SensorTest", "is_temperature_modified"
166
+ )
167
+ if isTemperatureModified:
168
+ temperature_option = config.get("SensorTest", "temperature_input_option")
169
+ if temperature_option == "Fixed Value":
170
+ fixed_temperature = config.getfloat("SensorTest", "fixed_temperature")
171
+ temperature = np.full(ensembles, fixed_temperature)
172
+ temperature *= 10
173
+ elif temperature_option == "File Upload":
174
+ temperature_file_path = config.get(
175
+ "SensorTest", "temperature_file_path"
176
+ )
177
+ df = pd.read_csv(temperature_file_path)
178
+ temperature = np.squeeze(df)
179
+ if len(temperature) != ensembles:
180
+ print("""
181
+ Error: Uploaded file ensembles and
182
+ actual ensembles mismatch
183
+ """)
184
+ else:
185
+ print("Temperature file uploaded.")
186
+
187
+ isRollCheck = config.getboolean("SensorTest", "roll_check")
188
+ if isRollCheck:
189
+ roll_cutoff = config.getint("SensorTest", "roll_cutoff")
190
+ mask = tilt_sensor_check(roll, mask, cutoff=roll_cutoff)
191
+
192
+ isPitchCheck = config.getboolean("SensorTest", "pitch_check")
193
+ if isPitchCheck:
194
+ pitch_cutoff = config.getint("SensorTest", "pitch_cutoff")
195
+ mask = tilt_sensor_check(pitch, mask, cutoff=pitch_cutoff)
196
+
197
+ isVelocityModified = config.getboolean("SensorTest", "velocity_modified")
198
+ if isVelocityModified:
199
+ velocity = sound_speed_correction(
200
+ velocity, sound, temperature, salinity, depth
201
+ )
64
202
 
65
203
  # QC Test
66
204
  isQCTest = config.getboolean("QCTest", "qc_test")
67
-
68
205
  if isQCTest:
69
- ct = config.getint("QCTest", "correlation")
70
- evt = config.getint("QCTest", "error_velocity")
71
- et = config.getint("QCTest", "echo_intensity")
72
- ft = config.getint("QCTest", "false_target")
73
- is3Beam = config.getboolean("QCTest", "three_beam")
74
- pgt = config.getint("QCTest", "percentage_good")
75
-
76
- mask = pg_check(pgood, mask, pgt, threebeam=is3Beam)
77
- mask = qc_check(correlation, mask, ct)
78
- mask = qc_check(echo, mask, et)
79
- mask = ev_check(velocity[3, :, :], mask, evt)
80
- mask = false_target(echo, mask, ft, threebeam=True)
81
- print("QC Test complete.")
206
+ isQCCheck = config.get("QCTest", "qc_check")
207
+ if isQCCheck:
208
+ ct = config.getint("QCTest", "correlation")
209
+ evt = config.getint("QCTest", "error_velocity")
210
+ et = config.getint("QCTest", "echo_intensity")
211
+ ft = config.getint("QCTest", "false_target")
212
+ is3beam = config.getboolean("QCTest", "three_beam")
213
+ if is3beam != None:
214
+ is3beam = int(is3beam)
215
+ beam_ignore = config.get("QCTest", "beam_ignore")
216
+ pgt = config.getint("QCTest", "percent_good")
217
+ orientation = config.get("QCTest", "orientation")
218
+ beam_ignore = config.getboolean(
219
+ "QCTest",
220
+ )
82
221
 
222
+ mask = pg_check(ds, mask, pgt, threebeam=is3beam)
223
+ mask = correlation_check(ds, mask, ct, is3beam, beam_ignore=beam_ignore)
224
+ mask = echo_check(ds, mask, et, is3beam, beam_ignore=beam_ignore)
225
+ mask = ev_check(ds, mask, evt)
226
+ mask = false_target(
227
+ ds, mask, ft, threebeam=is3beam, beam_ignore=beam_ignore
228
+ )
229
+
230
+ print("QC Check Complete.")
231
+
232
+ isBeamModified = config.getboolean("QCTest", "beam_modified")
233
+ if isBeamModified:
234
+ orientation = config.get("QCTest", "orientation")
235
+ print("Beam orientation changed.")
236
+
237
+ # Profile Test
83
238
  endpoints = None
84
239
  isProfileTest = config.getboolean("ProfileTest", "profile_test")
85
240
  if isProfileTest:
86
- isTrimEnds = config.getboolean("ProfileTest", "trim_ends")
241
+ isTrimEnds = config.getboolean("ProfileTest", "trim_ends_check")
87
242
  if isTrimEnds:
88
- start_index = config.getint("ProfileTest", "trim_ends_start_index")
89
- end_index = config.getint("ProfileTest", "trim_ends_end_index")
90
- # if start_index < 0 or start_index > ensembles:
91
-
243
+ start_index = config.getint("ProfileTest", "trim_start_ensemble")
244
+ end_index = config.getint("ProfileTest", "trim_end_ensemble")
92
245
  if start_index > 0:
93
246
  mask[:, :start_index] = 1
94
247
 
@@ -99,31 +252,116 @@ def autoprocess(filepath):
99
252
 
100
253
  print("Trim Ends complete.")
101
254
 
102
- isCutBins = config.getboolean("ProfileTest", "cut_bins")
255
+ isCutBins = config.getboolean("ProfileTest", "cutbins_sidelobe_check")
103
256
  if isCutBins:
104
- add_cells = config.getint("ProfileTest", "cut_bins_add_cells")
105
- mask = side_lobe_beam_angle(flobj, vlobj, mask, extra_cells=add_cells)
106
-
257
+ water_column_depth = config.getint("ProfileTest", "water_depth")
258
+ extra_cells = config.getint("ProfileTest", "extra_cells")
259
+ mask = side_lobe_beam_angle(
260
+ depth,
261
+ mask,
262
+ orientation=orientation,
263
+ water_column_depth=water_column_depth,
264
+ extra_cells=extra_cells,
265
+ cells=cells,
266
+ cell_size=cell_size,
267
+ bin1dist=bin1dist,
268
+ beam_angle=beam_angle,
269
+ )
107
270
  print("Cutbins complete.")
108
271
 
272
+ # Manual Cut Bins
273
+ # isManual_cutbins = config.getboolean("ProfileTest", "manual_cutbins")
274
+ # if isManual_cutbins:
275
+ # raw_bins = config.get("ProfileTest", "manual_cut_bins")
276
+ # bin_groups = raw_bins.split("]")
277
+ #
278
+ # for group in bin_groups:
279
+ # if group.strip(): # Ignore empty parts
280
+ # # Clean and split the values
281
+ # clean_group = group.replace("[", "").strip()
282
+ # values = list(map(int, clean_group.split(",")))
283
+ # min_cell, max_cell, min_ensemble, max_ensemble = values
284
+ # mask = manual_cut_bins(
285
+ # mask, min_cell, max_cell, min_ensemble, max_ensemble
286
+ # )
287
+ #
288
+ # print("Manual cut bins applied.")
289
+
109
290
  isRegrid = config.getboolean("ProfileTest", "regrid")
110
291
  if isRegrid:
111
292
  print("File regridding started. This will take a few seconds ...")
112
- regrid_option = config.get("ProfileTest", "regrid_option")
293
+
294
+ # regrid_option = config.get("ProfileTest", "regrid_option")
295
+ end_cell_option = config.get("ProfileTest", "end_cell_option")
296
+ interpolate = config.get("ProfileTest", "interpolate")
297
+ boundary = config.getint("ProfileTest", "boundary")
113
298
  z, velocity = regrid3d(
114
- flobj,
115
- vlobj,
299
+ depth,
116
300
  velocity,
117
301
  -32768,
118
302
  trimends=endpoints,
303
+ orientation=orientation,
304
+ end_cell_option=end_cell_option,
305
+ method=interpolate,
306
+ boundary_limit=boundary,
307
+ cells=cells,
308
+ cell_size=cell_size,
309
+ bin1dist=bin1dist,
310
+ beams=beams,
311
+ )
312
+ z, echo = regrid3d(
313
+ depth,
314
+ echo,
315
+ -32768,
316
+ trimends=endpoints,
317
+ orientation=orientation,
318
+ method=interpolate,
319
+ boundary_limit=boundary,
320
+ cells=cells,
321
+ cell_size=cell_size,
322
+ bin1dist=bin1dist,
323
+ beams=beams,
119
324
  )
120
- z, echo = regrid3d(flobj, vlobj, echo, -32768, trimends=endpoints)
121
325
  z, correlation = regrid3d(
122
- flobj, vlobj, correlation, -32768, trimends=endpoints
326
+ depth,
327
+ correlation,
328
+ -32768,
329
+ trimends=endpoints,
330
+ orientation=orientation,
331
+ method=interpolate,
332
+ boundary_limit=boundary,
333
+ cells=cells,
334
+ cell_size=cell_size,
335
+ bin1dist=bin1dist,
336
+ beams=beams,
337
+ )
338
+ z, pgood = regrid3d(
339
+ depth,
340
+ pgood,
341
+ -32768,
342
+ trimends=endpoints,
343
+ orientation=orientation,
344
+ method=interpolate,
345
+ boundary_limit=boundary,
346
+ cells=cells,
347
+ cell_size=cell_size,
348
+ bin1dist=bin1dist,
349
+ beams=beams,
350
+ )
351
+ z, mask = regrid2d(
352
+ depth,
353
+ mask,
354
+ 1,
355
+ trimends=endpoints,
356
+ orientation=orientation,
357
+ method=interpolate,
358
+ boundary_limit=boundary,
359
+ cells=cells,
360
+ cell_size=cell_size,
361
+ bin1dist=bin1dist,
123
362
  )
124
- z, pgood = regrid3d(flobj, vlobj, pgood, -32768, trimends=endpoints)
125
- z, mask = regrid2d(flobj, vlobj, mask, 1, trimends=endpoints)
126
363
  depth = z
364
+
127
365
  print("Regrid Complete.")
128
366
 
129
367
  print("Profile Test complete.")
@@ -134,14 +372,23 @@ def autoprocess(filepath):
134
372
  "VelocityTest", "magnetic_declination"
135
373
  )
136
374
  if isMagneticDeclination:
137
- maglat = config.getfloat("VelocityTest", "latitude")
138
- maglon = config.getfloat("VelocityTest", "longitude")
139
- magdep = config.getfloat("VelocityTest", "depth")
140
- magyear = config.getfloat("VelocityTest", "year")
141
-
142
- velocity, mag = magnetic_declination(
143
- velocity, maglat, maglon, magdep, magyear
144
- )
375
+ magmethod = config.get("VelocityTest", "magnet_method")
376
+ maglat = config.getfloat("VelocityTest", "magnet_latitude")
377
+ maglon = config.getfloat("VelocityTest", "magnet_longitude")
378
+ magdep = config.getfloat("VelocityTest", "magnet_depth")
379
+ magyear = config.getfloat("VelocityTest", "magnet_year")
380
+ year = int(magyear)
381
+ # mag = config.getfloat("VelocityTest", "mag")
382
+
383
+ if magmethod == "pygeomag":
384
+ mag = magdec(maglat, maglon, magdep, magyear)
385
+ elif magmethod.lower() == "api":
386
+ mag = wmm2020api(maglat, maglon, year)
387
+ elif magmethod.lower() == "manual":
388
+ mag = config.getint("VelocityTest", "magnet_user_input")
389
+ else:
390
+ mag = 0
391
+ velocity = velocity_modifier(velocity, mag)
145
392
  print(f"Magnetic Declination applied. The value is {mag[0]} degrees.")
146
393
 
147
394
  isCutOff = config.getboolean("VelocityTest", "cutoff")
@@ -156,46 +403,47 @@ def autoprocess(filepath):
156
403
 
157
404
  isDespike = config.getboolean("VelocityTest", "despike")
158
405
  if isDespike:
159
- despike_kernal = config.getint("VelocityTest", "despike_kernal_size")
160
- despike_cutoff = config.getint("VelocityTest", "despike_cutoff")
406
+ despike_kernel = config.getint("VelocityTest", "despike_kernel_size")
407
+ despike_cutoff = config.getfloat("VelocityTest", "despike_cutoff")
161
408
 
162
409
  mask = despike(
163
410
  velocity[0, :, :],
164
411
  mask,
165
- kernal_size=despike_kernal,
412
+ kernel_size=despike_kernel,
166
413
  cutoff=despike_cutoff,
167
414
  )
168
415
  mask = despike(
169
416
  velocity[1, :, :],
170
417
  mask,
171
- kernal_size=despike_kernal,
418
+ kernel_size=despike_kernel,
172
419
  cutoff=despike_cutoff,
173
420
  )
174
421
  print("Velocity data despiked.")
175
422
 
176
423
  isFlatline = config.getboolean("VelocityTest", "flatline")
177
424
  if isFlatline:
178
- despike_kernal = config.getint("VelocityTest", "flatline_kernal_size")
425
+ despike_kernel = config.getint("VelocityTest", "flatline_kernel_size")
179
426
  despike_cutoff = config.getint("VelocityTest", "flatline_deviation")
180
427
 
181
428
  mask = flatline(
182
429
  velocity[0, :, :],
183
430
  mask,
184
- kernal_size=despike_kernal,
431
+ kernel_size=despike_kernel,
185
432
  cutoff=despike_cutoff,
186
433
  )
187
434
  mask = flatline(
188
435
  velocity[1, :, :],
189
436
  mask,
190
- kernal_size=despike_kernal,
437
+ kernel_size=despike_kernel,
191
438
  cutoff=despike_cutoff,
192
439
  )
193
440
  mask = flatline(
194
441
  velocity[2, :, :],
195
442
  mask,
196
- kernal_size=despike_kernal,
443
+ kernel_size=despike_kernel,
197
444
  cutoff=despike_cutoff,
198
445
  )
446
+
199
447
  print("Flatlines in velocity removed.")
200
448
 
201
449
  print("Velocity Test complete.")
@@ -239,39 +487,82 @@ def autoprocess(filepath):
239
487
  }
240
488
  )
241
489
 
242
- date = pd.to_datetime(date_df)
490
+ date_raw = pd.to_datetime(date_df)
491
+ date_flead = pd.to_datetime(date_df)
492
+ date_vlead = pd.to_datetime(date_df)
493
+ date_final = pd.to_datetime(date_df)
243
494
 
244
495
  print("Time axis created.")
245
496
 
246
- isWriteRawNC = config.get("DownloadOptions", "download_raw")
247
- isWriteProcNC = config.get("DownloadOptions", "download_processed")
248
- isAttributes = config.get("Optional", "attributes")
249
-
497
+ isAttributes = config.getboolean("DownloadOptions", "add_attributes_processed")
250
498
  if isAttributes:
251
- attributes = [att for att in config["Optional"]]
252
- attributes = dict(config["Optional"].items())
253
- del attributes["attributes"]
499
+ attributes = [att for att in config["DownloadOptions"]]
500
+ attributes = dict(config["DownloadOptions"].items())
501
+ del attributes["add_attributes_processed"]
254
502
  else:
255
503
  attributes = None
256
504
 
505
+ isWriteRawNC = config.getboolean("DownloadOptions", "download_raw_netcdf")
506
+ isWritefleadNc = config.getboolean("DownloadOptions", "download_flead_netcdf")
507
+ isWriteVleadNC = config.getboolean("DownloadOptions", "download_vlead_netcdf")
508
+ isWriteProcNC = config.getboolean("DownloadOptions", "download_processed_netcdf")
509
+ filepath = config.get("FileSettings", "output_file_path")
510
+
511
+ print(isWriteRawNC)
257
512
  if isWriteRawNC:
258
- filepath = config.get("FileSettings", "output_file_path")
259
- filename = config.get("FileSettings", "output_file_name_raw")
513
+ filename = config.get("FileSettings", "output_file_name_raw_netcdf")
260
514
  output_file_path = os.path.join(filepath, filename)
261
- if isAttributes:
262
- wr.rawnc(full_input_file_path, output_file_path, attributes=attributes)
515
+ print(date_raw.shape)
516
+ wr.rawnc(
517
+ full_input_file_path,
518
+ output_file_path,
519
+ date_raw,
520
+ axis_option=axis_option,
521
+ attributes=attributes,
522
+ )
263
523
 
264
524
  print("Raw file written.")
265
525
 
526
+ if isWritefleadNc:
527
+ filename = config.get("FileSettings", "output_file_name_flead_netcdf")
528
+ output_file_path = os.path.join(filepath, filename)
529
+ wr.flead_nc(
530
+ full_input_file_path,
531
+ output_file_path,
532
+ date_flead,
533
+ axis_option=axis_option,
534
+ attributes=attributes,
535
+ )
536
+
537
+ print("Flead File written")
538
+
539
+ if isWriteVleadNC:
540
+ filename = config.get("FileSettings", "output_file_name_vlead_netcdf")
541
+ output_file_path = os.path.join(filepath, filename)
542
+ wr.vlead_nc(
543
+ full_input_file_path,
544
+ output_file_path,
545
+ date_vlead,
546
+ axis_option=axis_option,
547
+ attributes=attributes,
548
+ )
549
+
550
+ print("Vlead file written.")
551
+
552
+ depth1 = depth
553
+
266
554
  if isWriteProcNC:
267
- filepath = config.get("FileSettings", "output_file_path")
268
- filename = config.get("FileSettings", "output_file_name_processed")
269
- full_file_path = os.path.join(filepath, filename)
555
+ filename = config.get("FileSettings", "output_file_name_processed_netcdf")
556
+ output_file_path = os.path.join(filepath, filename)
270
557
 
271
558
  wr.finalnc(
272
- full_file_path,
273
- depth,
274
- date,
559
+ output_file_path,
560
+ depth1,
561
+ mask,
562
+ echo,
563
+ correlation,
564
+ pgood,
565
+ date_final,
275
566
  velocity,
276
567
  attributes=attributes, # Pass edited attributes
277
568
  )