pyadps 0.2.0b0__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 -211
  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.0b0.dist-info → pyadps-0.3.0.dist-info}/METADATA +63 -33
  29. pyadps-0.3.0.dist-info/RECORD +35 -0
  30. {pyadps-0.2.0b0.dist-info → pyadps-0.3.0.dist-info}/WHEEL +1 -1
  31. {pyadps-0.2.0b0.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.0b0.dist-info/RECORD +0 -31
  39. {pyadps-0.2.0b0.dist-info → pyadps-0.3.0.dist-info}/LICENSE +0 -0
@@ -1,8 +1,7 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: pyadps
3
- Version: 0.2.0b0
3
+ Version: 0.3.0
4
4
  Summary: A Python package for ADCP data processing
5
- Home-page: https://example.com
6
5
  License: MIT
7
6
  Keywords: adcp,data-processing,oceanography
8
7
  Author: P. Amol
@@ -13,27 +12,39 @@ Classifier: Operating System :: OS Independent
13
12
  Classifier: Programming Language :: Python :: 3
14
13
  Classifier: Programming Language :: Python :: 3.12
15
14
  Classifier: Programming Language :: Python :: 3.13
16
- Provides-Extra: tests
17
15
  Requires-Dist: cmake (>=3.30.2)
18
- Requires-Dist: matplotlib (>=3.8.4)
16
+ Requires-Dist: matplotlib (>=3.8.4,<3.9.0)
19
17
  Requires-Dist: meson (>=1.4.1)
20
- Requires-Dist: netCDF4 (>=1.7.1)
21
- Requires-Dist: numpy (>=1.26.4)
22
- Requires-Dist: pandas (>=2.2.2)
23
- Requires-Dist: plotly (>=5.22.0)
24
- Requires-Dist: plotly-resampler (>=0.10.0)
25
- Requires-Dist: scipy (>=1.14.0)
26
- Requires-Dist: streamlit (>=1.36.0)
27
- Requires-Dist: wmm2020 (>=1.1.1)
28
- Project-URL: Documentation, https://example.com/docs
18
+ Requires-Dist: netCDF4 (>=1.7.1,<1.8.0)
19
+ Requires-Dist: numpy (>=1.26.4,<1.27.0)
20
+ Requires-Dist: pandas (>=2.2.2,<2.3.0)
21
+ Requires-Dist: plotly (>=5.22.0,<5.23.0)
22
+ Requires-Dist: plotly-resampler (>=0.10.0,<0.11.0)
23
+ Requires-Dist: pygeomag (>=1.1.0,<2.0.0)
24
+ Requires-Dist: scipy (>=1.14.0,<1.15.0)
25
+ Requires-Dist: streamlit (>=1.36.0,<1.37.0)
26
+ Project-URL: Documentation, https://pyadps.readthedocs.io/en/latest/index.html
29
27
  Project-URL: Repository, https://github.com/p-amol/pyadps
28
+ Project-URL: homepage, https://pyadps.readthedocs.io/en/latest/index.html
30
29
  Description-Content-Type: text/markdown
31
30
 
32
31
  # pyadps
33
32
 
34
- `pyadps` is a Python package for processing moored Acoustic Doppler Current Profiler (ADCP) data. It provides various functionalities such as data reading, quality control tests, NetCDF file creation, and visualization.
33
+ `pyadps` is a Python package for processing moored Acoustic Doppler
34
+ Current Profiler (ADCP) data. It provides various functionalities
35
+ such as data reading, quality control tests, NetCDF file creation,
36
+ and visualization.
35
37
 
36
- This software offers both a graphical interface (`Streamlit`) for those new to Python and direct Python package access for experienced users. Please note that `pyadps` is primarily designed for Teledyne RDI workhorse ADCPs. Other company's ADCP files are not compatible, and while some other RDI models may work, they might require additional considerations.
38
+ This software offers both a graphical interface (`Streamlit`) for
39
+ those new to Python and direct Python package access for experienced
40
+ users. Please note that `pyadps` is primarily designed for Teledyne
41
+ RDI workhorse ADCPs. Other company's ADCP files are not compatible,
42
+ and while some other RDI models may work, they might require additional
43
+ considerations.
44
+
45
+ - Documentation: <https://pyadps.readthedocs.io>
46
+ - Source code: <https://github.com/p-amol/pyadps>
47
+ - Bug reports: <https://github.com/p-amol/pyadps/issues>
37
48
 
38
49
  ## Table of Contents
39
50
 
@@ -43,37 +54,49 @@ This software offers both a graphical interface (`Streamlit`) for those new to P
43
54
 
44
55
  ## Installation
45
56
 
46
- We recommend installing the package within a virtual environment. At present, the package is compatible exclusively with Python version 3.12.
47
- You can create a Python environment using tools like `venv` or `conda`. Below are instructions for both methods.
57
+ We recommend installing the package within a virtual environment.
58
+ At present, the package is compatible exclusively with Python version 3.12.
59
+ You can create a Python environment using tools like `venv` or `conda`.
60
+ Below are instructions for both methods.
48
61
 
49
62
  ### 1. Using `venv` (Built-in Python Tool)
50
63
 
51
64
  #### Step 1: Install Python version 3.12 (if not already installed)
65
+
52
66
  Ensure you have Python installed. You can download the latest version from [python.org](https://www.python.org/downloads/).
53
67
 
54
- #### Step 2: Create a Virtual Environment
68
+ #### Step 2: Create a Virtual Environment
69
+
55
70
  - Open your terminal or command prompt.
56
71
  - Navigate to your project folder:
72
+
57
73
  ```bash
58
74
  cd /path/to/your/project
59
75
  ```
60
- - Run the following command to create a virtual environment (replace adpsenv with your preferred environment name):
76
+
77
+ - Run the following command to create a virtual environment
78
+ (replace adpsenv with your preferred environment name):
61
79
 
62
80
  ```bash
63
81
  python -m venv adpsenv
64
82
  ```
65
83
 
66
84
  #### Step 3: Activate the Environment
85
+
67
86
  - On Windows:
87
+
68
88
  ```bash
69
89
  adpsenv\Scripts\activate
70
90
  ```
71
91
 
72
92
  - On macOS/Linux:
93
+
73
94
  ```bash
74
95
  source adpsenv/bin/activate
75
96
  ```
76
- You’ll see the environment name in your terminal prompt indicating the environment is active.
97
+
98
+ You’ll see the environment name in your terminal prompt
99
+ indicating the environment is active.
77
100
 
78
101
  #### Step 4: Install Dependencies
79
102
 
@@ -84,44 +107,51 @@ pip install pyadps
84
107
  ```
85
108
 
86
109
  #### Step 5: Deactivate the Environment
110
+
87
111
  When you’re done working in the environment, deactivate it by running:
88
112
 
89
113
  ```bash
90
114
  deactivate
91
115
  ```
92
116
 
93
-
94
-
95
-
96
- ### 2. Using `conda` (Anaconda/Miniconda):
117
+ ### 2. Using `conda` (Anaconda/Miniconda)
97
118
 
98
119
  #### Step 1: Install Conda
120
+
99
121
  First, you need to have Conda installed on your system. You can either install:
100
122
 
101
123
  - [Anaconda (Full Distribution)](https://www.anaconda.com/products/individual)
102
124
  - [Miniconda (Lightweight Version)](https://docs.conda.io/en/latest/miniconda.html)
103
125
 
104
126
  #### Step 2: Create a Conda Environment with Python 3.12
105
- Once Conda is installed, open a terminal or command prompt and run the following to create a new environment (replace `adpsenv` with your preferred environment name):
127
+
128
+ Once Conda is installed, open a terminal or command prompt and run
129
+ the following to create a new environment (replace `adpsenv` with
130
+ your preferred environment name):
106
131
 
107
132
  ```bash
108
133
  conda create --name adpsenv python=3.12
109
134
  ```
110
135
 
111
- #### Step 3: Activate the Environment
136
+ #### Step 3: Activate the Conda Environment
137
+
112
138
  ```bash
113
139
  conda activate adpsenv
114
140
  ```
115
141
 
116
- #### Step 4: Install Dependencies
117
- You can install packages with pip inside Conda environments.
142
+ #### Step 4: Install pyadps Dependencies
143
+
144
+ You can install packages with pip inside Conda environments.
145
+
118
146
  ```bash
119
147
  pip install pyadps
120
148
  ```
121
149
 
122
- #### Step 5: Deactivate the Environment
123
- When done, deactivate the environment by running:
124
- ```
150
+ #### Step 5: Deactivate the Conda Environment
151
+
152
+ When done working in the environment, deactivate the environment by running:
153
+
154
+ ```bash
125
155
  conda deactivate
126
156
  ```
127
157
 
@@ -130,11 +160,11 @@ conda deactivate
130
160
  ### Streamlit web interface
131
161
 
132
162
  Open a terminal or command prompt, activate the environment, and run the command.
163
+
133
164
  ```bash
134
165
  run-pyadps
135
166
  ```
136
167
 
137
-
138
168
  ## License
139
169
 
140
170
  This project is licensed under the MIT License. See the LICENSE file for details.
@@ -0,0 +1,35 @@
1
+ pyadps/Home_Page.py,sha256=j_-3fsp1hkhpNEl5jE-CEQvClDGpMi1H3ZQPXfuKWBg,1782
2
+ pyadps/__init__.py,sha256=bNCm6_WIhiwvaUeOZhRkyLZyzzUKfSH80Fslg0JPJyk,232
3
+ pyadps/__main__.py,sha256=cIFUayxPnKl00oIR99L6IUEvc8trW7dijtfBQCAen5c,356
4
+ pyadps/pages/01_Read_File.py,sha256=JY3NJ_uqA7QsIKZz5HjwIvaX6BzD_CFGDfL_P5axRQU,24694
5
+ pyadps/pages/02_View_Raw_Data.py,sha256=wpTVe76oS9Jj2Q4x4yORLExpUjr_60xNi0V1EKhDI-8,6359
6
+ pyadps/pages/03_Download_Raw_File.py,sha256=ebZu17STL3HhM8ExQvSWNfquI2CrmdJPxOeNjV-lvvU,12214
7
+ pyadps/pages/04_Sensor_Health.py,sha256=2Qnwl7D46H-f8LmXLVZj5X36h8MjRwmVRK6Bs_wuB_k,33905
8
+ pyadps/pages/05_QC_Test.py,sha256=6YjQTg_t0_Qll9xQ3SYieCBS2cDEMz9znovW3olPFwc,16566
9
+ pyadps/pages/06_Profile_Test.py,sha256=Vir91oRIWApbO2elBm4I59rdf83NtspUmtzAyWdsIiY,34891
10
+ pyadps/pages/07_Velocity_Test.py,sha256=K4vEiLPMXrU4JMLj-mIA1G4H5ORozMbHMiMov3ZZXP0,23008
11
+ pyadps/pages/08_Write_File.py,sha256=cr8Ctwh8USTMHuRiR_JlHjKZelY6Yyx0g_DxWByd460,23742
12
+ pyadps/pages/09_Add-Ons.py,sha256=lweofAxcvKLxzfCJl6vybmUmxWgcm4jEn5DjFaTHbpI,5986
13
+ pyadps/pages/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
+ pyadps/utils/__init__.py,sha256=JDIy5Yx6meDGxfLGyB5135TFWQc0lyNxu_cWrfSEDhU,485
15
+ pyadps/utils/autoprocess.py,sha256=oQFmfMvCkZJHpCPvCl4bXOnGRfoOB8f2ZaGik5-9tq4,21095
16
+ pyadps/utils/logging_utils.py,sha256=-b6rwnpF-g6ZSIj3PVyxiz4-blBKvKqh1HW1KRKpmyY,8492
17
+ pyadps/utils/metadata/config.ini,sha256=TC7htzGwUukIXt_u3JR5ycyvOoDj_JxWgGY6khjNeck,2154
18
+ pyadps/utils/metadata/demo.000,sha256=qxB3sgjABrpv4DNXkwjpbSxk5sc4UwAI8kgQX0--PM8,234468
19
+ pyadps/utils/metadata/flmeta.json,sha256=wyoCCK1Nb7-U3NR2ZZxTfxH-vh_yzuOrg2T5f9goTNo,12439
20
+ pyadps/utils/metadata/vlmeta.json,sha256=sdwCsCEDKDVpYaXG96qU9MQqjkq-585Eeu3be_bK7og,21606
21
+ pyadps/utils/multifile.py,sha256=cXPYNJ3y-VkoeCtriR7TxBo0_mc34vUxK672ddXC6tM,10105
22
+ pyadps/utils/plotgen.py,sha256=c7TUA9unErUxppYc14LZ2o_stzNMmmZ5X542iI5v1tA,26346
23
+ pyadps/utils/profile_test.py,sha256=gnbS6ZsqKvv2tcHTj-Fi_VNOszbxDcPxl77_n4dLzSo,29237
24
+ pyadps/utils/pyreadrdi.py,sha256=6ruA0QfVoMHd7vpLObjKj7dN1__a9ZCr9kIJduaOq28,38534
25
+ pyadps/utils/readrdi.py,sha256=h6QXj5ynT-0u-PTaKEhpYAFFz5uE-zVHKG-_3yA5Meg,55829
26
+ pyadps/utils/script.py,sha256=TKMCYe0HEz-2GFpNxKVzpg0p4MM-Cu2rcMZc51GgLn4,6534
27
+ pyadps/utils/sensor_health.py,sha256=aHRaU4kMJZ9dGmYypKpCCgq-owWoNjvcl1I_9I7dG68,3973
28
+ pyadps/utils/signal_quality.py,sha256=PjedVk38suwe3MSht_Z4yxNMqTFbGqE6MdlaJ3ypuUA,18506
29
+ pyadps/utils/velocity_test.py,sha256=O8dgjv_5pxhJq6QuWHxysMjNzxSnob_2KPLInmO1kHI,6112
30
+ pyadps/utils/writenc.py,sha256=KDolQ11Whh2bi4L2wfrgjXym5BWL8ikp0xvo4Pa0r4E,14455
31
+ pyadps-0.3.0.dist-info/LICENSE,sha256=sfY_7DzQF5FxnO2T6ek74dfm5uBmwEp1oEg_WlzNsb8,1092
32
+ pyadps-0.3.0.dist-info/METADATA,sha256=NXjYlGQqxSAe5FHHGKzkxxzYcnMcQ6mEI6IeuymNIBA,4569
33
+ pyadps-0.3.0.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
34
+ pyadps-0.3.0.dist-info/entry_points.txt,sha256=-oZhbbJq8Q29uNVh5SmzOLp9OeFM9VUzHVxovfI4LXA,126
35
+ pyadps-0.3.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.9.1
2
+ Generator: poetry-core 2.0.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -1,4 +1,5 @@
1
1
  [console_scripts]
2
2
  run-auto=pyadps.utils.autoprocess:main
3
3
  run-pyadps=pyadps.__main__:main
4
+ run-script=pyadps.utils.script:main
4
5
 
@@ -1,334 +0,0 @@
1
- import numpy as np
2
- import pandas as pd
3
- import plotly.express as px
4
- import plotly.graph_objects as go
5
- import streamlit as st
6
- from plotly.subplots import make_subplots
7
- from plotly_resampler import FigureResampler
8
- from streamlit.runtime.state import session_state
9
- from utils.signal_quality import ev_check, false_target, pg_check, qc_check
10
-
11
- if "flead" not in st.session_state:
12
- st.write(":red[Please Select Data!]")
13
- st.stop()
14
-
15
- # `mask` holds the temporary changes in the page
16
- # `qcmask` holds the final changes in the page
17
- if "mask" not in st.session_state:
18
- st.session_state.mask = np.copy(st.session_state.orig_mask)
19
-
20
- if not st.session_state.isQCMask:
21
- st.write(":grey[Creating a new mask file ...]")
22
- st.session_state.qc_mask = np.copy(st.session_state.orig_mask)
23
- st.session_state.isSubmit = False
24
- else:
25
- st.write(":grey[Working on a saved mask file ...]")
26
- st.write(":orange[WARNING! QC test already completed. Reset to change settings.]")
27
- reset_button1 = st.button("Reset Mask Data")
28
- if reset_button1:
29
- st.session_state.mask = np.copy(st.session_state.orig_mask)
30
- st.session_state.qc_mask = np.copy(st.session_state.orig_mask)
31
- st.write(":green[Mask data is reset to default]")
32
-
33
- if "isThresh" not in st.session_state:
34
- st.session_state.isThresh = False
35
-
36
- # Load data
37
- flobj = st.session_state.flead
38
- vlobj = st.session_state.vlead
39
- velocity = st.session_state.velocity
40
- echo = st.session_state.echo
41
- correlation = st.session_state.correlation
42
- pgood = st.session_state.pgood
43
- ensembles = st.session_state.head.ensembles
44
- cells = flobj.field()["Cells"]
45
- fdata = flobj.fleader
46
- vdata = vlobj.vleader
47
- x = np.arange(0, ensembles, 1)
48
- y = np.arange(0, cells, 1)
49
-
50
-
51
- @st.cache_data
52
- def fillplot_plotly(data, colorscale="balance"):
53
- fig = FigureResampler(go.Figure())
54
- data1 = np.where(data == -32768, np.nan, data)
55
- fig.add_trace(
56
- go.Heatmap(z=data1[:, 0:-1], x=x, y=y, colorscale=colorscale, hoverongaps=False)
57
- )
58
- st.plotly_chart(fig)
59
-
60
-
61
- @st.cache_data
62
- def plot_noise(dep=0, rec=-1):
63
- n = dep
64
- m = rec
65
- colorleft = [
66
- "rgb(240, 255, 255)",
67
- "rgb(115, 147, 179)",
68
- "rgb(100, 149, 237)",
69
- "rgb(15, 82, 186)",
70
- ]
71
- colorright = [
72
- "rgb(250, 200, 152)",
73
- "rgb(255, 165, 0)",
74
- "rgb(255, 95, 31)",
75
- "rgb(139, 64, 0)",
76
- ]
77
- fig = make_subplots(
78
- rows=1,
79
- cols=2,
80
- subplot_titles=[
81
- f"Deployment Ensemble ({x[n]+1})",
82
- f"Recovery Ensemble ({x[m]+1})",
83
- ],
84
- )
85
- for i in range(4):
86
- fig.add_trace(
87
- go.Scatter(
88
- x=echo[i, :, n],
89
- y=y,
90
- name=f"Beam (D) {i+1}",
91
- line=dict(color=colorleft[i]),
92
- ),
93
- row=1,
94
- col=1,
95
- )
96
- for i in range(4):
97
- fig.add_trace(
98
- go.Scatter(
99
- x=echo[i, :, m],
100
- y=y,
101
- name=f"Beam (R) {i+1}",
102
- line=dict(color=colorright[i]),
103
- ),
104
- row=1,
105
- col=2,
106
- )
107
-
108
- fig.update_layout(height=600, width=800, title_text="Echo Intensity")
109
- fig.update_xaxes(title="Echo (count)")
110
- fig.update_yaxes(title="Cells")
111
- st.plotly_chart(fig)
112
-
113
- ######### NOISE FLOOR IDENTIFICATION ##############
114
- dn = rn = 1
115
- st.header("Noise Floor Identification", divider="blue")
116
- st.write(
117
- """
118
- If the ADCP has collected data from the air either
119
- before deployment or after recovery, this data can
120
- be used to estimate the echo intensity threshold.
121
- The plots below show the echo intensity from the first
122
- and last ensembles. The noise level is typically around
123
- 30-40 counts throughout the entire profile.
124
- """
125
- )
126
- dn = st.number_input("Deployment Ensemble", x[0] + 1, x[-1] + 1, x[0] + 1)
127
- # r = st.number_input("Recovery Ensemble", -1 * (x[-1] + 1), -1 * (x[0] + 1), -1)
128
- rn = st.number_input("Recovery Ensemble", x[0] + 1, x[-1] + 1, x[-1] + 1)
129
- dn = dn - 1
130
- rn = rn - 1
131
-
132
- plot_noise(dep=dn, rec=rn)
133
-
134
-
135
- ################## QC Test ###################
136
-
137
- st.header("Quality Control Tests", divider="blue")
138
- st.write("")
139
-
140
- left, right = st.columns([1, 1])
141
- with left:
142
- st.write(""" Teledyne RDI recommends these quality control tests,
143
- some of which can be configured before deployment.
144
- The pre-deployment values configured for the ADCP are listed
145
- in the table below. The noise-floor identification graph above
146
- can assist in determining the echo intensity threshold.
147
- For more information about these tests,
148
- refer to *Acoustic Doppler Current Profiler Principles of
149
- Operation: A Practical Primer* by Teledyne RDI.""")
150
- fdata = st.session_state.flead.field()
151
- st.divider()
152
- st.write(":blue-background[Additional Information:]")
153
- st.write(f"Number of Pings per Ensemble: `{fdata["Pings"]}`")
154
- st.write(f"Number of Beams: `{fdata["Beams"]}`")
155
- st.divider()
156
- st.write(":red-background[Thresholds used during deployment:]")
157
- thresh = pd.DataFrame(
158
- [
159
- ["Correlation", fdata["Correlation Thresh"]],
160
- ["Error Velocity", fdata["Error Velocity Thresh"]],
161
- ["Echo Intensity", 0],
162
- ["False Target", fdata["False Target Thresh"]],
163
- ["Percentage Good", fdata["Percent Good Min"]],
164
- ],
165
- columns=["Threshold", "Values"],
166
- )
167
-
168
- st.write(thresh)
169
-
170
- with right:
171
- with st.form(key="my_form"):
172
- st.write("Would you like to apply new threshold?")
173
-
174
- ct = st.number_input(
175
- "Select Correlation Threshold",
176
- 0,
177
- 255,
178
- fdata["Correlation Thresh"],
179
- )
180
-
181
- evt = st.number_input(
182
- "Select Error Velocity Threshold",
183
- 0,
184
- 9999,
185
- fdata["Error Velocity Thresh"],
186
- )
187
-
188
- et = st.number_input(
189
- "Select Echo Intensity Threshold",
190
- 0,
191
- 255,
192
- 0,
193
- )
194
-
195
- ft = st.number_input(
196
- "Select False Target Threshold",
197
- 0,
198
- 255,
199
- fdata["False Target Thresh"],
200
- )
201
-
202
- option = st.selectbox(
203
- "Would you like to use a three-beam solution?", (True, False)
204
- )
205
-
206
- pgt = st.number_input(
207
- "Select Percent Good Threshold",
208
- 0,
209
- 100,
210
- fdata["Percent Good Min"],
211
- )
212
- submit_button = st.form_submit_button(label="Submit")
213
-
214
-
215
- mask = st.session_state.mask
216
- with left:
217
- if submit_button:
218
- st.session_state.newthresh = pd.DataFrame(
219
- [
220
- ["Correlation", str(ct)],
221
- ["Error Velocity", str(evt)],
222
- ["Echo Intensity", str(et)],
223
- ["False Target", str(ft)],
224
- ["Three Beam", str(option)],
225
- ["Percentage Good", str(pgt)],
226
- ],
227
- columns=["Threshold", "Values"],
228
- )
229
- st.session_state.isThresh = True
230
- # st.write(st.session_state.newthresh)
231
-
232
- mask = pg_check(pgood, mask, pgt, threebeam=option)
233
- mask = qc_check(correlation, mask, ct)
234
- mask = qc_check(echo, mask, et)
235
- mask = ev_check(velocity[3, :, :], mask, evt)
236
- mask = false_target(echo, mask, ft, threebeam=True)
237
- st.session_state.mask = mask
238
-
239
- if st.session_state.isThresh:
240
- st.write(":green-background[Current Thresholds]")
241
- st.write(st.session_state.newthresh)
242
-
243
-
244
-
245
- st.header("Mask File", divider="blue")
246
- st.write(
247
- """
248
- Displayed the mask file.
249
- Ensure to save any necessary changes or apply additional thresholds if needed.
250
- """
251
- )
252
-
253
-
254
- if st.button("Display mask file"):
255
- st.subheader("Default Mask File")
256
- st.write(
257
- """
258
- ADCP assigns missing values based on thresholds set before deployment.
259
- These values cannot be recovered and the default
260
- """
261
- )
262
- fillplot_plotly(st.session_state.orig_mask, colorscale="greys")
263
-
264
-
265
- st.subheader("Update Mask File")
266
- st.write(
267
- """
268
- Update, display and save the updated mask file after applying threshold.
269
- If thresholds are not saved, default mask file is used.
270
- """
271
- )
272
- # values, counts = np.unique(mask, return_counts=True)
273
- fillplot_plotly(st.session_state.mask, colorscale="greys")
274
-
275
- ############## SENSOR HEALTH ######################
276
- st.header("Sensor Health", divider="blue")
277
- st.write("The following details can be used to determine whether the additional sensors are functioning properly.")
278
- # ################## Pressure Sensor Check ###################
279
- # st.subheader("Pressure Sensor Check", divider="orange")
280
- #
281
- # st.subheader("Temperature Sensor Check", divider="orange")
282
- #
283
- # st.subheader("Tilt Sensor Check", divider="orange")
284
- ################## Fix Orientation ###################
285
- st.subheader("Fix Orientation", divider="orange")
286
-
287
-
288
- if st.session_state.beam_direction == 'Up':
289
- beamalt = 'Down'
290
- else:
291
- beamalt = 'Up'
292
- st.write(f"The current orientation of ADCP is `{st.session_state.beam_direction}`. Use the below option to correct the orientation.")
293
-
294
- beamdir_select = st.radio(f'Change orientation to {beamalt}', ['No', 'Yes'])
295
- if beamdir_select == 'Yes':
296
- st.session_state.beam_direction = beamalt
297
- st.write(f"The orientation changed to `{st.session_state.beam_direction}`")
298
-
299
-
300
-
301
-
302
- ################## Save Button #############
303
- st.header("Save Data", divider="blue")
304
- col1, col2 = st.columns([1, 1])
305
- with col1:
306
- save_mask_button = st.button(label="Save Mask Data")
307
-
308
- if save_mask_button:
309
- # st.session_state.mask = mask
310
- st.session_state.qc_mask = np.copy(st.session_state.mask)
311
- st.session_state.isQCMask = True
312
- st.session_state.isProfileMask = False
313
- st.session_state.isGridSave = False
314
- st.session_state.isVelocityMask = False
315
- st.write(":green[Mask file saved]")
316
- else:
317
- st.write(":red[Mask data not saved]")
318
- with col2:
319
- reset_mask_button = st.button("Reset mask Data")
320
- if reset_mask_button:
321
- st.session_state.mask = np.copy(st.session_state.orig_mask)
322
- st.session_state.isQCMask = False
323
- st.session_state.isGrid = False
324
- st.session_state.isProfileMask = False
325
- st.session_state.isVelocityMask = False
326
- st.write(":green[Mask data is reset to default]")
327
-
328
-
329
-
330
-
331
-
332
-
333
-
334
-