pyadps 0.1.1__py3-none-any.whl → 0.1.3__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 +3 -2
- pyadps/pages/03_Download_Raw_File.py +69 -24
- pyadps/pages/05_QC_Test.py +20 -3
- pyadps/pages/06_Profile_Test.py +10 -10
- pyadps/pages/08_Write_File.py +26 -5
- pyadps/utils/autoprocess.py +10 -5
- pyadps/utils/metadata/flmeta.json +420 -420
- pyadps/utils/plotgen.py +1 -1
- pyadps/utils/profile_test.py +228 -2
- pyadps/utils/pyreadrdi.py +112 -83
- pyadps/utils/readrdi.py +34 -3
- pyadps/utils/signal_quality.py +16 -4
- pyadps/utils/writenc.py +101 -52
- {pyadps-0.1.1.dist-info → pyadps-0.1.3.dist-info}/METADATA +1 -1
- pyadps-0.1.3.dist-info/RECORD +33 -0
- 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__/regrid.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-0.1.1.dist-info/RECORD +0 -47
- {pyadps-0.1.1.dist-info → pyadps-0.1.3.dist-info}/LICENSE +0 -0
- {pyadps-0.1.1.dist-info → pyadps-0.1.3.dist-info}/WHEEL +0 -0
- {pyadps-0.1.1.dist-info → pyadps-0.1.3.dist-info}/entry_points.txt +0 -0
pyadps/pages/01_Read_File.py
CHANGED
@@ -20,10 +20,10 @@ if "fname" not in st.session_state:
|
|
20
20
|
st.session_state.fname = "No file selected"
|
21
21
|
|
22
22
|
if "rawfilename" not in st.session_state:
|
23
|
-
st.session_state.rawfilename = "
|
23
|
+
st.session_state.rawfilename = "RAW_DAT.nc"
|
24
24
|
|
25
25
|
if "vleadfilename" not in st.session_state:
|
26
|
-
st.session_state.vleadfilename = "
|
26
|
+
st.session_state.vleadfilename = "RAW_VAR.nc"
|
27
27
|
|
28
28
|
|
29
29
|
################ Functions #######################
|
@@ -132,6 +132,7 @@ if uploaded_file is not None:
|
|
132
132
|
st.session_state.salinity = (
|
133
133
|
ds.variableleader.salinity.data * ds.variableleader.salinity.scale
|
134
134
|
)
|
135
|
+
st.session_state.filename = (ds.filename)
|
135
136
|
|
136
137
|
# st.session_state.flead = flead
|
137
138
|
# st.session_state.vlead = vlead
|
@@ -18,13 +18,13 @@ if "fname" not in st.session_state:
|
|
18
18
|
st.session_state.fname = "No file selected"
|
19
19
|
|
20
20
|
if "rawfilename" not in st.session_state:
|
21
|
-
st.session_state.rawfilename = "
|
21
|
+
st.session_state.rawfilename = "RAW_DAT.nc"
|
22
22
|
|
23
23
|
if "fleadfilename" not in st.session_state:
|
24
|
-
st.session_state.fleadfilename = "
|
24
|
+
st.session_state.fleadfilename = "RAW_FIX.nc"
|
25
25
|
|
26
26
|
if "vleadfilename" not in st.session_state:
|
27
|
-
st.session_state.vleadfilename = "
|
27
|
+
st.session_state.vleadfilename = "RAW_VAR.nc"
|
28
28
|
|
29
29
|
if "attributes" not in st.session_state:
|
30
30
|
st.session_state.attributes = {}
|
@@ -32,6 +32,18 @@ if "attributes" not in st.session_state:
|
|
32
32
|
if "add_attributes_DRW" not in st.session_state:
|
33
33
|
st.session_state.add_attributes_DRW = "No" # Default value
|
34
34
|
|
35
|
+
if "file_prefix" not in st.session_state:
|
36
|
+
raw_basename = os.path.basename(st.session_state.fname)
|
37
|
+
st.session_state.filename = os.path.splitext(raw_basename)[0]
|
38
|
+
st.session_state.file_prefix = st.session_state.filename
|
39
|
+
|
40
|
+
|
41
|
+
if "prefix_saved" not in st.session_state:
|
42
|
+
st.session_state.prefix_saved = False
|
43
|
+
|
44
|
+
if "filename" not in st.session_state:
|
45
|
+
st.session_state.filename = "" # <-- Default file name if not passed
|
46
|
+
|
35
47
|
|
36
48
|
################ Functions #######################
|
37
49
|
@st.cache_data()
|
@@ -51,59 +63,66 @@ def read_file(filepath):
|
|
51
63
|
st.session_state.ds = ds
|
52
64
|
|
53
65
|
|
66
|
+
@st.cache_data
|
67
|
+
def get_prefixed_filename(base_name):
|
68
|
+
"""Generates the file name with the optional prefix."""
|
69
|
+
if st.session_state.file_prefix:
|
70
|
+
return f"{st.session_state.file_prefix}_{base_name}"
|
71
|
+
return base_name
|
72
|
+
|
73
|
+
|
54
74
|
@st.cache_data
|
55
75
|
def file_write(path, axis_option, add_attributes=True):
|
56
76
|
tempdirname = tempfile.TemporaryDirectory(delete=False)
|
57
|
-
st.session_state.rawfilename =
|
77
|
+
st.session_state.rawfilename = os.path.join(
|
78
|
+
tempdirname.name, get_prefixed_filename("RAW_DAT.nc")
|
79
|
+
)
|
58
80
|
|
59
81
|
if add_attributes:
|
60
82
|
wr.rawnc(
|
61
83
|
path,
|
62
84
|
st.session_state.rawfilename,
|
63
|
-
|
64
|
-
axis_option,
|
85
|
+
axis_option=axis_option,
|
65
86
|
attributes=st.session_state.attributes,
|
66
87
|
)
|
67
88
|
else:
|
68
|
-
wr.rawnc(
|
69
|
-
|
70
|
-
)
|
89
|
+
wr.rawnc(path, st.session_state.rawfilename, axis_option)
|
90
|
+
|
71
91
|
|
72
92
|
@st.cache_data
|
73
93
|
def file_write_flead(path, axis_option, add_attributes=True):
|
74
94
|
tempvardirname = tempfile.TemporaryDirectory(delete=False)
|
75
|
-
st.session_state.fleadfilename =
|
95
|
+
st.session_state.fleadfilename = os.path.join(
|
96
|
+
tempvardirname.name, get_prefixed_filename("RAW_FIX.nc")
|
97
|
+
)
|
76
98
|
|
77
99
|
if add_attributes:
|
78
100
|
wr.flead_nc(
|
79
101
|
path,
|
80
102
|
st.session_state.fleadfilename,
|
81
|
-
|
82
|
-
axis_option,
|
103
|
+
axis_option=axis_option,
|
83
104
|
attributes=st.session_state.attributes,
|
84
105
|
)
|
85
106
|
else:
|
86
|
-
wr.flead_nc(
|
87
|
-
|
88
|
-
)
|
107
|
+
wr.flead_nc(path, st.session_state.fleadfilename, axis_option)
|
108
|
+
|
89
109
|
|
90
110
|
@st.cache_data
|
91
111
|
def file_write_vlead(path, axis_option, add_attributes=True):
|
92
112
|
tempvardirname = tempfile.TemporaryDirectory(delete=False)
|
93
|
-
st.session_state.vleadfilename =
|
113
|
+
st.session_state.vleadfilename = os.path.join(
|
114
|
+
tempvardirname.name, get_prefixed_filename("RAW_VAR.nc")
|
115
|
+
)
|
94
116
|
|
95
117
|
if add_attributes:
|
96
118
|
wr.vlead_nc(
|
97
119
|
path,
|
98
120
|
st.session_state.vleadfilename,
|
99
|
-
|
100
|
-
axis_option,
|
121
|
+
axis_option=axis_option,
|
101
122
|
attributes=st.session_state.attributes,
|
102
123
|
)
|
103
124
|
else:
|
104
|
-
wr.vlead_nc(
|
105
|
-
path, st.session_state.vleadfilename, st.session_state.date3, axis_option
|
106
|
-
)
|
125
|
+
wr.vlead_nc(path, st.session_state.vleadfilename, axis_option)
|
107
126
|
|
108
127
|
|
109
128
|
if "axis_option" not in st.session_state:
|
@@ -149,6 +168,32 @@ if st.session_state.add_attributes_DRW == "Yes":
|
|
149
168
|
|
150
169
|
st.write("Attributes will be added to the NetCDF file once you submit.")
|
151
170
|
|
171
|
+
|
172
|
+
st.info(f"Current file name: **{st.session_state.filename}**")
|
173
|
+
|
174
|
+
# Prefix editing option
|
175
|
+
st.session_state.use_custom_filename = st.radio(
|
176
|
+
"Do you want to edit Output Filename?",
|
177
|
+
["No", "Yes"],
|
178
|
+
horizontal=True,
|
179
|
+
)
|
180
|
+
|
181
|
+
if st.session_state.use_custom_filename == "Yes" and not st.session_state.prefix_saved:
|
182
|
+
st.session_state.file_prefix = st.text_input(
|
183
|
+
"Enter file name (e.g., GD10A000)",
|
184
|
+
value=st.session_state.file_prefix,
|
185
|
+
)
|
186
|
+
|
187
|
+
if st.button("Save Filename"):
|
188
|
+
if st.session_state.file_prefix.strip():
|
189
|
+
st.session_state.prefix_saved = True
|
190
|
+
st.rerun()
|
191
|
+
else:
|
192
|
+
st.warning("Please enter a valid filename before saving.")
|
193
|
+
|
194
|
+
if st.session_state.prefix_saved:
|
195
|
+
st.success(f"Filename saved as: **{st.session_state.file_prefix}**")
|
196
|
+
|
152
197
|
# Dropdown for axis_option
|
153
198
|
st.session_state.axis_option_DRW = st.selectbox(
|
154
199
|
"Select x-axis option:",
|
@@ -179,7 +224,7 @@ if st.session_state.rawnc_download_DRW:
|
|
179
224
|
st.download_button(
|
180
225
|
label="Download Raw File",
|
181
226
|
data=file,
|
182
|
-
file_name="
|
227
|
+
file_name=get_prefixed_filename("RAW_DAT.nc"),
|
183
228
|
)
|
184
229
|
|
185
230
|
if st.session_state.fleadnc_download_DRW:
|
@@ -193,7 +238,7 @@ if st.session_state.fleadnc_download_DRW:
|
|
193
238
|
st.download_button(
|
194
239
|
label="Download Fixed Leader",
|
195
240
|
data=file,
|
196
|
-
file_name="
|
241
|
+
file_name=get_prefixed_filename("RAW_FIX.nc"),
|
197
242
|
)
|
198
243
|
|
199
244
|
if st.session_state.vleadnc_download_DRW:
|
@@ -207,7 +252,7 @@ if st.session_state.vleadnc_download_DRW:
|
|
207
252
|
st.download_button(
|
208
253
|
label="Download Variable Leader",
|
209
254
|
data=file,
|
210
|
-
file_name="
|
255
|
+
file_name=get_prefixed_filename("RAW_VAR.nc"),
|
211
256
|
)
|
212
257
|
|
213
258
|
|
pyadps/pages/05_QC_Test.py
CHANGED
@@ -92,11 +92,12 @@ def qc_submit():
|
|
92
92
|
evt = st.session_state.evt_QCT
|
93
93
|
ft = st.session_state.ft_QCT
|
94
94
|
is3beam = st.session_state.is3beam_QCT
|
95
|
+
beam_ignore = st.session_state.beam_to_ignore
|
95
96
|
mask = pg_check(ds, mask, pgt, threebeam=is3beam)
|
96
|
-
mask = correlation_check(ds, mask, ct)
|
97
|
-
mask = echo_check(ds, mask, et)
|
97
|
+
mask = correlation_check(ds, mask, ct,is3beam,beam_ignore=beam_ignore)
|
98
|
+
mask = echo_check(ds, mask, et,is3beam,beam_ignore=beam_ignore)
|
98
99
|
mask = ev_check(ds, mask, evt)
|
99
|
-
mask = false_target(ds, mask, ft, threebeam=
|
100
|
+
mask = false_target(ds, mask, ft, threebeam=is3beam, beam_ignore=beam_ignore)
|
100
101
|
# Store the processed mask in a temporary mask
|
101
102
|
st.session_state.qc_mask_temp = mask
|
102
103
|
|
@@ -337,6 +338,22 @@ with tab2:
|
|
337
338
|
"Would you like to use a three-beam solution?", (True, False)
|
338
339
|
)
|
339
340
|
|
341
|
+
if st.session_state.is3beam_QCT:
|
342
|
+
beam_label_to_value = {
|
343
|
+
"None": None,
|
344
|
+
"Beam 1": 0,
|
345
|
+
"Beam 2": 1,
|
346
|
+
"Beam 3": 2,
|
347
|
+
"Beam 4": 3
|
348
|
+
}
|
349
|
+
|
350
|
+
selected_beam = st.selectbox(
|
351
|
+
"Select Beam to Ignore",
|
352
|
+
options=list(beam_label_to_value.keys()),
|
353
|
+
index=0 # Default is "None"
|
354
|
+
)
|
355
|
+
st.session_state.beam_to_ignore = beam_label_to_value[selected_beam]
|
356
|
+
|
340
357
|
st.session_state.pgt_QCT = st.number_input(
|
341
358
|
"Select Percent Good Threshold",
|
342
359
|
0,
|
pyadps/pages/06_Profile_Test.py
CHANGED
@@ -797,8 +797,8 @@ with tab4:
|
|
797
797
|
orientation=st.session_state.beam_direction_QCT,
|
798
798
|
method=st.session_state.interpolate_PT,
|
799
799
|
boundary_limit=boundary,
|
800
|
-
cells=
|
801
|
-
cell_size=
|
800
|
+
cells=fdata['Cells'],
|
801
|
+
cell_size=fdata['Depth Cell Len'],
|
802
802
|
bin1dist=bin1dist,
|
803
803
|
beams=beams,
|
804
804
|
)
|
@@ -813,8 +813,8 @@ with tab4:
|
|
813
813
|
orientation=st.session_state.beam_direction_QCT,
|
814
814
|
method=st.session_state.interpolate_PT,
|
815
815
|
boundary_limit=boundary,
|
816
|
-
cells=
|
817
|
-
cell_size=
|
816
|
+
cells=fdata['Cells'],
|
817
|
+
cell_size=fdata['Depth Cell Len'],
|
818
818
|
bin1dist=bin1dist,
|
819
819
|
beams=beams,
|
820
820
|
)
|
@@ -829,8 +829,8 @@ with tab4:
|
|
829
829
|
orientation=st.session_state.beam_direction_QCT,
|
830
830
|
method=st.session_state.interpolate_PT,
|
831
831
|
boundary_limit=boundary,
|
832
|
-
cells=
|
833
|
-
cell_size=
|
832
|
+
cells=fdata['Cells'],
|
833
|
+
cell_size=fdata['Depth Cell Len'],
|
834
834
|
bin1dist=bin1dist,
|
835
835
|
beams=beams,
|
836
836
|
)
|
@@ -845,8 +845,8 @@ with tab4:
|
|
845
845
|
orientation=st.session_state.beam_direction_QCT,
|
846
846
|
method=st.session_state.interpolate_PT,
|
847
847
|
boundary_limit=boundary,
|
848
|
-
cells=
|
849
|
-
cell_size=
|
848
|
+
cells=fdata['Cells'],
|
849
|
+
cell_size=fdata['Depth Cell Len'],
|
850
850
|
bin1dist=bin1dist,
|
851
851
|
beams=beams,
|
852
852
|
)
|
@@ -862,8 +862,8 @@ with tab4:
|
|
862
862
|
orientation=st.session_state.beam_direction_QCT,
|
863
863
|
method="nearest",
|
864
864
|
boundary_limit=boundary,
|
865
|
-
cells=
|
866
|
-
cell_size=
|
865
|
+
cells=fdata['Cells'],
|
866
|
+
cell_size=fdata['Depth Cell Len'],
|
867
867
|
bin1dist=bin1dist,
|
868
868
|
)
|
869
869
|
|
pyadps/pages/08_Write_File.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import configparser
|
2
2
|
import tempfile
|
3
|
-
|
3
|
+
import os
|
4
4
|
import numpy as np
|
5
5
|
import pandas as pd
|
6
6
|
import plotly.graph_objects as go
|
@@ -16,10 +16,23 @@ if "fname" not in st.session_state:
|
|
16
16
|
st.session_state.fname = "No file selected"
|
17
17
|
|
18
18
|
if "rawfilename" not in st.session_state:
|
19
|
-
st.session_state.rawfilename = "
|
19
|
+
st.session_state.rawfilename = "RAW_DAT.nc"
|
20
20
|
|
21
21
|
if "vleadfilename" not in st.session_state:
|
22
|
-
st.session_state.vleadfilename = "
|
22
|
+
st.session_state.vleadfilename = "RAW_VAR.nc"
|
23
|
+
|
24
|
+
if "file_prefix" not in st.session_state:
|
25
|
+
raw_basename = os.path.basename(st.session_state.fname)
|
26
|
+
st.session_state.filename = os.path.splitext(raw_basename)[0]
|
27
|
+
st.session_state.file_prefix = st.session_state.filename
|
28
|
+
|
29
|
+
|
30
|
+
if "prefix_saved" not in st.session_state:
|
31
|
+
st.session_state.prefix_saved = False
|
32
|
+
|
33
|
+
if "filename" not in st.session_state:
|
34
|
+
st.session_state.filename = "" # <-- Default file name if not passed
|
35
|
+
|
23
36
|
|
24
37
|
|
25
38
|
# Check if attributes exist in session state
|
@@ -72,9 +85,15 @@ else:
|
|
72
85
|
if "depth_axis" not in st.session_state:
|
73
86
|
st.session_state.isRegridCheck_PT = False
|
74
87
|
|
88
|
+
@st.cache_data
|
89
|
+
def get_prefixed_filename(base_name):
|
90
|
+
"""Generates the file name with the optional prefix."""
|
91
|
+
if st.session_state.file_prefix:
|
92
|
+
return f"{st.session_state.file_prefix}_{base_name}"
|
93
|
+
return base_name
|
75
94
|
|
76
95
|
@st.cache_data
|
77
|
-
def file_write(filename="
|
96
|
+
def file_write(filename=get_prefixed_filename("PRO_DAT.nc")):
|
78
97
|
tempdirname = tempfile.TemporaryDirectory(delete=False)
|
79
98
|
outfilepath = tempdirname.name + "/" + filename
|
80
99
|
return outfilepath
|
@@ -297,7 +316,7 @@ if download_button:
|
|
297
316
|
st.download_button(
|
298
317
|
label="Download NetCDF File",
|
299
318
|
data=file,
|
300
|
-
file_name="
|
319
|
+
file_name=get_prefixed_filename("PRO_DAT.nc"),
|
301
320
|
)
|
302
321
|
|
303
322
|
if st.session_state.file_type_WF == "CSV":
|
@@ -487,6 +506,8 @@ if generate_config_radio == "Yes":
|
|
487
506
|
config["QCTest"]["error_velocity"] = str(st.session_state.evt_QCT)
|
488
507
|
config["QCTest"]["false_target"] = str(st.session_state.ft_QCT)
|
489
508
|
config["QCTest"]["three_beam"] = str(st.session_state.is3beam_QCT)
|
509
|
+
if st.session_state.is3beam_QCT:
|
510
|
+
config["QCTest"]["beam_ignore"] = str(st.session_state.beam_to_ignore)
|
490
511
|
config["QCTest"]["percent_good"] = str(st.session_state.pgt_QCT)
|
491
512
|
|
492
513
|
# Tab 4
|
pyadps/utils/autoprocess.py
CHANGED
@@ -192,15 +192,20 @@ def autoprocess(config_file, binary_file_path=None):
|
|
192
192
|
evt = config.getint("QCTest", "error_velocity")
|
193
193
|
et = config.getint("QCTest", "echo_intensity")
|
194
194
|
ft = config.getint("QCTest", "false_target")
|
195
|
-
|
195
|
+
is3beam = config.getboolean("QCTest", "three_beam")
|
196
|
+
if is3beam != None:
|
197
|
+
is3beam = int(is3beam)
|
198
|
+
beam_ignore = config.get("QCTest","beam_ignore")
|
196
199
|
pgt = config.getint("QCTest", "percent_good")
|
197
200
|
orientation = config.get("QCTest", "orientation")
|
201
|
+
beam_ignore = config.getboolean("QCTest",)
|
198
202
|
|
199
|
-
mask = pg_check(ds, mask, pgt, threebeam=
|
200
|
-
mask = correlation_check(ds, mask, ct)
|
201
|
-
mask = echo_check(ds, mask, et)
|
203
|
+
mask = pg_check(ds, mask, pgt, threebeam=is3beam)
|
204
|
+
mask = correlation_check(ds, mask, ct,is3beam,beam_ignore=beam_ignore)
|
205
|
+
mask = echo_check(ds, mask, et,is3beam,beam_ignore=beam_ignore)
|
202
206
|
mask = ev_check(ds, mask, evt)
|
203
|
-
mask = false_target(ds, mask, ft, threebeam=
|
207
|
+
mask = false_target(ds, mask, ft, threebeam=is3beam, beam_ignore=beam_ignore)
|
208
|
+
|
204
209
|
|
205
210
|
print("QC Check Complete.")
|
206
211
|
|