pyadps 0.1.1__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/Home_Page.py +5 -11
- pyadps/pages/01_Read_File.py +17 -190
- 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.0b0.dist-info}/METADATA +24 -55
- pyadps-0.2.0b0.dist-info/RECORD +31 -0
- {pyadps-0.1.1.dist-info → pyadps-0.2.0b0.dist-info}/WHEEL +1 -1
- {pyadps-0.1.1.dist-info → pyadps-0.2.0b0.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.0b0.dist-info}/LICENSE +0 -0
pyadps/utils/autoprocess.py
CHANGED
@@ -4,28 +4,22 @@ 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
|
8
7
|
from pyadps.utils import readrdi
|
9
|
-
from pyadps.utils.profile_test import side_lobe_beam_angle
|
10
|
-
from pyadps.utils.
|
8
|
+
from pyadps.utils.profile_test import side_lobe_beam_angle
|
9
|
+
from pyadps.utils.regrid import regrid2d, regrid3d
|
11
10
|
from pyadps.utils.signal_quality import (
|
12
11
|
default_mask,
|
13
12
|
ev_check,
|
14
13
|
false_target,
|
15
14
|
pg_check,
|
16
|
-
|
17
|
-
correlation_check,
|
15
|
+
qc_check,
|
18
16
|
)
|
19
17
|
from pyadps.utils.velocity_test import (
|
20
18
|
despike,
|
21
19
|
flatline,
|
20
|
+
magnetic_declination,
|
22
21
|
velocity_cutoff,
|
23
|
-
magdec,
|
24
|
-
wmm2020api,
|
25
|
-
velocity_modifier,
|
26
22
|
)
|
27
|
-
from pyadps.utils.sensor_health import sound_speed_correction, tilt_sensor_check
|
28
|
-
|
29
23
|
|
30
24
|
def main():
|
31
25
|
# Get the config file
|
@@ -35,34 +29,16 @@ def main():
|
|
35
29
|
autoprocess(filepath)
|
36
30
|
else:
|
37
31
|
print("File not found!")
|
38
|
-
except
|
39
|
-
import traceback
|
40
|
-
|
32
|
+
except:
|
41
33
|
print("Error: Unable to process the data.")
|
42
|
-
traceback.print_exc()
|
43
|
-
|
44
34
|
|
45
|
-
def autoprocess(
|
46
|
-
# Load configuration
|
35
|
+
def autoprocess(filepath):
|
47
36
|
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")
|
48
40
|
|
49
|
-
|
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
|
41
|
+
full_input_file_path = os.path.join(input_file_path, input_file_name)
|
66
42
|
|
67
43
|
print("File reading started. Please wait for a few seconds ...")
|
68
44
|
ds = readrdi.ReadFile(full_input_file_path)
|
@@ -75,148 +51,44 @@ def autoprocess(config_file, binary_file_path=None):
|
|
75
51
|
echo = ds.echo.data
|
76
52
|
correlation = ds.correlation.data
|
77
53
|
pgood = ds.percentgood.data
|
78
|
-
roll = ds.variableleader.roll.data
|
79
|
-
pitch = ds.variableleader.pitch.data
|
80
|
-
sound = ds.variableleader.speed_of_sound.data
|
81
|
-
depth = ds.variableleader.depth_of_transducer.data
|
82
|
-
temperature = (
|
83
|
-
ds.variableleader.temperature.data * ds.variableleader.temperature.scale
|
84
|
-
)
|
85
|
-
salinity = ds.variableleader.salinity.data * ds.variableleader.salinity.scale
|
86
|
-
orientation = ds.fixedleader.system_configuration()["Beam Direction"]
|
87
54
|
ensembles = header.ensembles
|
88
55
|
cells = flobj.field()["Cells"]
|
89
|
-
beams = flobj.field()["Beams"]
|
90
|
-
cell_size = flobj.field()["Depth Cell Len"]
|
91
|
-
bin1dist = flobj.field()["Bin 1 Dist"]
|
92
|
-
beam_angle = int(flobj.system_configuration()["Beam Angle"])
|
93
56
|
fdata = flobj.fleader
|
94
57
|
vdata = vlobj.vleader
|
95
|
-
# depth = ds.variableleader.depth_of_transducer
|
96
58
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
# Debugging statement
|
59
|
+
mask = default_mask(flobj, velocity)
|
60
|
+
print("Default Mask created.")
|
101
61
|
x = np.arange(0, ensembles, 1)
|
102
62
|
y = np.arange(0, cells, 1)
|
103
|
-
|
104
|
-
axis_option = config.get("DownloadOptions", "axis_option")
|
105
|
-
|
106
|
-
# Sensor Test
|
107
|
-
isSensorTest = config.getboolean("SensorTest", "sensor_test")
|
108
|
-
if isSensorTest:
|
109
|
-
isDepthModified = config.getboolean("SensorTest", "is_depth_modified")
|
110
|
-
if isDepthModified:
|
111
|
-
depth_option = config.get("SensorTest", "depth_input_option")
|
112
|
-
if depth_option == "Fixed Value":
|
113
|
-
fixed_depth = config.getfloat("SensorTest", "fixed_depth")
|
114
|
-
depth = np.full(ensembles, fixed_depth)
|
115
|
-
depth *= 10
|
116
|
-
elif depth_option == "File Upload":
|
117
|
-
depth_file_path = config.get("SensorTest", "depth_file_path")
|
118
|
-
df = pd.read_csv(depth_file_path)
|
119
|
-
depth = np.squeeze(df)
|
120
|
-
if len(depth) != ensembles:
|
121
|
-
print("""
|
122
|
-
Error: Uploaded file ensembles and
|
123
|
-
actual ensembles mismatch
|
124
|
-
""")
|
125
|
-
else:
|
126
|
-
print("Depth file uploaded.")
|
127
|
-
|
128
|
-
isSalinityModified = config.getboolean("SensorTest", "is_salinity_modified")
|
129
|
-
if isSalinityModified:
|
130
|
-
salinity_option = config.get("SensorTest", "salinity_input_option")
|
131
|
-
if salinity_option == "Fixed Value":
|
132
|
-
fixed_salinity = config.getfloat("SensorTest", "fixed_salinity")
|
133
|
-
salinity = np.full(ensembles, fixed_salinity)
|
134
|
-
salinity *= 10
|
135
|
-
elif salinity_option == "File Upload":
|
136
|
-
salinity_file_path = config.get("SensorTest", "salinity_file_path")
|
137
|
-
df = pd.read_csv(salinity_file_path)
|
138
|
-
salinity = np.squeeze(df)
|
139
|
-
if len(salinity) != ensembles:
|
140
|
-
print("""
|
141
|
-
Error: Uploaded file ensembles and
|
142
|
-
actual ensembles mismatch
|
143
|
-
""")
|
144
|
-
else:
|
145
|
-
print("Salinity file uploaded.")
|
146
|
-
|
147
|
-
isTemperatureModified = config.getboolean(
|
148
|
-
"SensorTest", "is_temperature_modified"
|
149
|
-
)
|
150
|
-
if isTemperatureModified:
|
151
|
-
temperature_option = config.get("SensorTest", "temperature_input_option")
|
152
|
-
if temperature_option == "Fixed Value":
|
153
|
-
fixed_temperature = config.getfloat("SensorTest", "fixed_temperature")
|
154
|
-
temperature = np.full(ensembles, fixed_temperature)
|
155
|
-
temperature *= 10
|
156
|
-
elif temperature_option == "File Upload":
|
157
|
-
temperature_file_path = config.get(
|
158
|
-
"SensorTest", "temperature_file_path"
|
159
|
-
)
|
160
|
-
df = pd.read_csv(temperature_file_path)
|
161
|
-
temperature = np.squeeze(df)
|
162
|
-
if len(temperature) != ensembles:
|
163
|
-
print("""
|
164
|
-
Error: Uploaded file ensembles and
|
165
|
-
actual ensembles mismatch
|
166
|
-
""")
|
167
|
-
else:
|
168
|
-
print("Temperature file uploaded.")
|
169
|
-
|
170
|
-
isRollCheck = config.getboolean("SensorTest", "roll_check")
|
171
|
-
if isRollCheck:
|
172
|
-
roll_cutoff = config.getint("SensorTest", "roll_cutoff")
|
173
|
-
mask = tilt_sensor_check(roll, mask, cutoff=roll_cutoff)
|
174
|
-
|
175
|
-
isPitchCheck = config.getboolean("SensorTest", "pitch_check")
|
176
|
-
if isPitchCheck:
|
177
|
-
pitch_cutoff = config.getint("SensorTest", "pitch_cutoff")
|
178
|
-
mask = tilt_sensor_check(pitch, mask, cutoff=pitch_cutoff)
|
179
|
-
|
180
|
-
isVelocityModified = config.getboolean("SensorTest", "velocity_modified")
|
181
|
-
if isVelocityModified:
|
182
|
-
velocity = sound_speed_correction(
|
183
|
-
velocity, sound, temperature, salinity, depth
|
184
|
-
)
|
63
|
+
depth = None
|
185
64
|
|
186
65
|
# QC Test
|
187
66
|
isQCTest = config.getboolean("QCTest", "qc_test")
|
67
|
+
|
188
68
|
if isQCTest:
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
mask = false_target(ds, mask, ft, threebeam=True)
|
204
|
-
|
205
|
-
print("QC Check Complete.")
|
206
|
-
|
207
|
-
isBeamModified = config.getboolean("QCTest", "beam_modified")
|
208
|
-
if isBeamModified:
|
209
|
-
orientation = config.get("QCTest", "orientation")
|
210
|
-
print("Beam orientation changed.")
|
211
|
-
|
212
|
-
# Profile Test
|
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.")
|
82
|
+
|
213
83
|
endpoints = None
|
214
84
|
isProfileTest = config.getboolean("ProfileTest", "profile_test")
|
215
85
|
if isProfileTest:
|
216
|
-
isTrimEnds = config.getboolean("ProfileTest", "
|
86
|
+
isTrimEnds = config.getboolean("ProfileTest", "trim_ends")
|
217
87
|
if isTrimEnds:
|
218
|
-
start_index = config.getint("ProfileTest", "
|
219
|
-
end_index = config.getint("ProfileTest", "
|
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
|
+
|
220
92
|
if start_index > 0:
|
221
93
|
mask[:, :start_index] = 1
|
222
94
|
|
@@ -227,116 +99,31 @@ def autoprocess(config_file, binary_file_path=None):
|
|
227
99
|
|
228
100
|
print("Trim Ends complete.")
|
229
101
|
|
230
|
-
isCutBins = config.getboolean("ProfileTest", "
|
102
|
+
isCutBins = config.getboolean("ProfileTest", "cut_bins")
|
231
103
|
if isCutBins:
|
232
|
-
|
233
|
-
|
234
|
-
mask = side_lobe_beam_angle(
|
235
|
-
depth,
|
236
|
-
mask,
|
237
|
-
orientation=orientation,
|
238
|
-
water_column_depth=water_column_depth,
|
239
|
-
extra_cells=extra_cells,
|
240
|
-
cells=cells,
|
241
|
-
cell_size=cell_size,
|
242
|
-
bin1dist=bin1dist,
|
243
|
-
beam_angle=beam_angle,
|
244
|
-
)
|
245
|
-
print("Cutbins complete.")
|
104
|
+
add_cells = config.getint("ProfileTest", "cut_bins_add_cells")
|
105
|
+
mask = side_lobe_beam_angle(flobj, vlobj, mask, extra_cells=add_cells)
|
246
106
|
|
247
|
-
|
248
|
-
# isManual_cutbins = config.getboolean("ProfileTest", "manual_cutbins")
|
249
|
-
# if isManual_cutbins:
|
250
|
-
# raw_bins = config.get("ProfileTest", "manual_cut_bins")
|
251
|
-
# bin_groups = raw_bins.split("]")
|
252
|
-
#
|
253
|
-
# for group in bin_groups:
|
254
|
-
# if group.strip(): # Ignore empty parts
|
255
|
-
# # Clean and split the values
|
256
|
-
# clean_group = group.replace("[", "").strip()
|
257
|
-
# values = list(map(int, clean_group.split(",")))
|
258
|
-
# min_cell, max_cell, min_ensemble, max_ensemble = values
|
259
|
-
# mask = manual_cut_bins(
|
260
|
-
# mask, min_cell, max_cell, min_ensemble, max_ensemble
|
261
|
-
# )
|
262
|
-
#
|
263
|
-
# print("Manual cut bins applied.")
|
107
|
+
print("Cutbins complete.")
|
264
108
|
|
265
109
|
isRegrid = config.getboolean("ProfileTest", "regrid")
|
266
110
|
if isRegrid:
|
267
111
|
print("File regridding started. This will take a few seconds ...")
|
268
|
-
|
269
|
-
# regrid_option = config.get("ProfileTest", "regrid_option")
|
270
|
-
end_cell_option = config.get("ProfileTest", "end_cell_option")
|
271
|
-
interpolate = config.get("ProfileTest", "interpolate")
|
272
|
-
boundary = config.getint("ProfileTest", "boundary")
|
112
|
+
regrid_option = config.get("ProfileTest", "regrid_option")
|
273
113
|
z, velocity = regrid3d(
|
274
|
-
|
114
|
+
flobj,
|
115
|
+
vlobj,
|
275
116
|
velocity,
|
276
117
|
-32768,
|
277
118
|
trimends=endpoints,
|
278
|
-
orientation=orientation,
|
279
|
-
end_cell_option=end_cell_option,
|
280
|
-
method=interpolate,
|
281
|
-
boundary_limit=boundary,
|
282
|
-
cells=cells,
|
283
|
-
cell_size=cell_size,
|
284
|
-
bin1dist=bin1dist,
|
285
|
-
beams=beams,
|
286
|
-
)
|
287
|
-
z, echo = regrid3d(
|
288
|
-
depth,
|
289
|
-
echo,
|
290
|
-
-32768,
|
291
|
-
trimends=endpoints,
|
292
|
-
orientation=orientation,
|
293
|
-
method=interpolate,
|
294
|
-
boundary_limit=boundary,
|
295
|
-
cells=cells,
|
296
|
-
cell_size=cell_size,
|
297
|
-
bin1dist=bin1dist,
|
298
|
-
beams=beams,
|
299
119
|
)
|
120
|
+
z, echo = regrid3d(flobj, vlobj, echo, -32768, trimends=endpoints)
|
300
121
|
z, correlation = regrid3d(
|
301
|
-
|
302
|
-
correlation,
|
303
|
-
-32768,
|
304
|
-
trimends=endpoints,
|
305
|
-
orientation=orientation,
|
306
|
-
method=interpolate,
|
307
|
-
boundary_limit=boundary,
|
308
|
-
cells=cells,
|
309
|
-
cell_size=cell_size,
|
310
|
-
bin1dist=bin1dist,
|
311
|
-
beams=beams,
|
312
|
-
)
|
313
|
-
z, pgood = regrid3d(
|
314
|
-
depth,
|
315
|
-
pgood,
|
316
|
-
-32768,
|
317
|
-
trimends=endpoints,
|
318
|
-
orientation=orientation,
|
319
|
-
method=interpolate,
|
320
|
-
boundary_limit=boundary,
|
321
|
-
cells=cells,
|
322
|
-
cell_size=cell_size,
|
323
|
-
bin1dist=bin1dist,
|
324
|
-
beams=beams,
|
325
|
-
)
|
326
|
-
z, mask = regrid2d(
|
327
|
-
depth,
|
328
|
-
mask,
|
329
|
-
1,
|
330
|
-
trimends=endpoints,
|
331
|
-
orientation=orientation,
|
332
|
-
method=interpolate,
|
333
|
-
boundary_limit=boundary,
|
334
|
-
cells=cells,
|
335
|
-
cell_size=cell_size,
|
336
|
-
bin1dist=bin1dist,
|
122
|
+
flobj, vlobj, correlation, -32768, trimends=endpoints
|
337
123
|
)
|
124
|
+
z, pgood = regrid3d(flobj, vlobj, pgood, -32768, trimends=endpoints)
|
125
|
+
z, mask = regrid2d(flobj, vlobj, mask, 1, trimends=endpoints)
|
338
126
|
depth = z
|
339
|
-
|
340
127
|
print("Regrid Complete.")
|
341
128
|
|
342
129
|
print("Profile Test complete.")
|
@@ -347,23 +134,14 @@ def autoprocess(config_file, binary_file_path=None):
|
|
347
134
|
"VelocityTest", "magnetic_declination"
|
348
135
|
)
|
349
136
|
if isMagneticDeclination:
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
if magmethod == "pygeomag":
|
359
|
-
mag = magdec(maglat, maglon, magdep, magyear)
|
360
|
-
elif magmethod.lower() == "api":
|
361
|
-
mag = wmm2020api(maglat, maglon, year)
|
362
|
-
elif magmethod.lower() == "manual":
|
363
|
-
mag = config.getint("VelocityTest", "magnet_user_input")
|
364
|
-
else:
|
365
|
-
mag = 0
|
366
|
-
velocity = velocity_modifier(velocity, mag)
|
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
|
+
)
|
367
145
|
print(f"Magnetic Declination applied. The value is {mag[0]} degrees.")
|
368
146
|
|
369
147
|
isCutOff = config.getboolean("VelocityTest", "cutoff")
|
@@ -378,47 +156,46 @@ def autoprocess(config_file, binary_file_path=None):
|
|
378
156
|
|
379
157
|
isDespike = config.getboolean("VelocityTest", "despike")
|
380
158
|
if isDespike:
|
381
|
-
|
382
|
-
despike_cutoff = config.
|
159
|
+
despike_kernal = config.getint("VelocityTest", "despike_kernal_size")
|
160
|
+
despike_cutoff = config.getint("VelocityTest", "despike_cutoff")
|
383
161
|
|
384
162
|
mask = despike(
|
385
163
|
velocity[0, :, :],
|
386
164
|
mask,
|
387
|
-
|
165
|
+
kernal_size=despike_kernal,
|
388
166
|
cutoff=despike_cutoff,
|
389
167
|
)
|
390
168
|
mask = despike(
|
391
169
|
velocity[1, :, :],
|
392
170
|
mask,
|
393
|
-
|
171
|
+
kernal_size=despike_kernal,
|
394
172
|
cutoff=despike_cutoff,
|
395
173
|
)
|
396
174
|
print("Velocity data despiked.")
|
397
175
|
|
398
176
|
isFlatline = config.getboolean("VelocityTest", "flatline")
|
399
177
|
if isFlatline:
|
400
|
-
|
178
|
+
despike_kernal = config.getint("VelocityTest", "flatline_kernal_size")
|
401
179
|
despike_cutoff = config.getint("VelocityTest", "flatline_deviation")
|
402
180
|
|
403
181
|
mask = flatline(
|
404
182
|
velocity[0, :, :],
|
405
183
|
mask,
|
406
|
-
|
184
|
+
kernal_size=despike_kernal,
|
407
185
|
cutoff=despike_cutoff,
|
408
186
|
)
|
409
187
|
mask = flatline(
|
410
188
|
velocity[1, :, :],
|
411
189
|
mask,
|
412
|
-
|
190
|
+
kernal_size=despike_kernal,
|
413
191
|
cutoff=despike_cutoff,
|
414
192
|
)
|
415
193
|
mask = flatline(
|
416
194
|
velocity[2, :, :],
|
417
195
|
mask,
|
418
|
-
|
196
|
+
kernal_size=despike_kernal,
|
419
197
|
cutoff=despike_cutoff,
|
420
198
|
)
|
421
|
-
|
422
199
|
print("Flatlines in velocity removed.")
|
423
200
|
|
424
201
|
print("Velocity Test complete.")
|
@@ -462,82 +239,39 @@ def autoprocess(config_file, binary_file_path=None):
|
|
462
239
|
}
|
463
240
|
)
|
464
241
|
|
465
|
-
|
466
|
-
date_flead = pd.to_datetime(date_df)
|
467
|
-
date_vlead = pd.to_datetime(date_df)
|
468
|
-
date_final = pd.to_datetime(date_df)
|
242
|
+
date = pd.to_datetime(date_df)
|
469
243
|
|
470
244
|
print("Time axis created.")
|
471
245
|
|
472
|
-
|
246
|
+
isWriteRawNC = config.get("DownloadOptions", "download_raw")
|
247
|
+
isWriteProcNC = config.get("DownloadOptions", "download_processed")
|
248
|
+
isAttributes = config.get("Optional", "attributes")
|
249
|
+
|
473
250
|
if isAttributes:
|
474
|
-
attributes = [att for att in config["
|
475
|
-
attributes = dict(config["
|
476
|
-
del attributes["
|
251
|
+
attributes = [att for att in config["Optional"]]
|
252
|
+
attributes = dict(config["Optional"].items())
|
253
|
+
del attributes["attributes"]
|
477
254
|
else:
|
478
255
|
attributes = None
|
479
256
|
|
480
|
-
isWriteRawNC = config.getboolean("DownloadOptions", "download_raw_netcdf")
|
481
|
-
isWritefleadNc = config.getboolean("DownloadOptions", "download_flead_netcdf")
|
482
|
-
isWriteVleadNC = config.getboolean("DownloadOptions", "download_vlead_netcdf")
|
483
|
-
isWriteProcNC = config.getboolean("DownloadOptions", "download_processed_netcdf")
|
484
|
-
filepath = config.get("FileSettings", "output_file_path")
|
485
|
-
|
486
|
-
print(isWriteRawNC)
|
487
257
|
if isWriteRawNC:
|
488
|
-
|
258
|
+
filepath = config.get("FileSettings", "output_file_path")
|
259
|
+
filename = config.get("FileSettings", "output_file_name_raw")
|
489
260
|
output_file_path = os.path.join(filepath, filename)
|
490
|
-
|
491
|
-
|
492
|
-
full_input_file_path,
|
493
|
-
output_file_path,
|
494
|
-
date_raw,
|
495
|
-
axis_option=axis_option,
|
496
|
-
attributes=attributes,
|
497
|
-
)
|
261
|
+
if isAttributes:
|
262
|
+
wr.rawnc(full_input_file_path, output_file_path, attributes=attributes)
|
498
263
|
|
499
264
|
print("Raw file written.")
|
500
265
|
|
501
|
-
if isWritefleadNc:
|
502
|
-
filename = config.get("FileSettings", "output_file_name_flead_netcdf")
|
503
|
-
output_file_path = os.path.join(filepath, filename)
|
504
|
-
wr.flead_nc(
|
505
|
-
full_input_file_path,
|
506
|
-
output_file_path,
|
507
|
-
date_flead,
|
508
|
-
axis_option=axis_option,
|
509
|
-
attributes=attributes,
|
510
|
-
)
|
511
|
-
|
512
|
-
print("Flead File written")
|
513
|
-
|
514
|
-
if isWriteVleadNC:
|
515
|
-
filename = config.get("FileSettings", "output_file_name_vlead_netcdf")
|
516
|
-
output_file_path = os.path.join(filepath, filename)
|
517
|
-
wr.vlead_nc(
|
518
|
-
full_input_file_path,
|
519
|
-
output_file_path,
|
520
|
-
date_vlead,
|
521
|
-
axis_option=axis_option,
|
522
|
-
attributes=attributes,
|
523
|
-
)
|
524
|
-
|
525
|
-
print("Vlead file written.")
|
526
|
-
|
527
|
-
depth1 = depth
|
528
|
-
|
529
266
|
if isWriteProcNC:
|
530
|
-
|
531
|
-
|
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)
|
532
270
|
|
533
271
|
wr.finalnc(
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
echo,
|
538
|
-
correlation,
|
539
|
-
pgood,
|
540
|
-
date_final,
|
272
|
+
full_file_path,
|
273
|
+
depth,
|
274
|
+
date,
|
541
275
|
velocity,
|
542
276
|
attributes=attributes, # Pass edited attributes
|
543
277
|
)
|