oceanarray 0.1.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.
- oceanarray/__init__.py +20 -0
- oceanarray/_version.py +1 -0
- oceanarray/cli.py +1343 -0
- oceanarray/clock_offset.py +675 -0
- oceanarray/config/OS1_sensor_attrs.yaml +49 -0
- oceanarray/config/OS1_var_names.yaml +5 -0
- oceanarray/config/OS1_vocab_attrs.yaml +84 -0
- oceanarray/config/legacy/project_RAPID.yaml +69 -0
- oceanarray/config/legacy/rodb_keys.txt +206 -0
- oceanarray/config/legacy/rodb_keys.yaml +1012 -0
- oceanarray/config/logging.yaml +28 -0
- oceanarray/legacy/__init__.py +47 -0
- oceanarray/legacy/caldip.py +753 -0
- oceanarray/legacy/convertOS.py +527 -0
- oceanarray/legacy/find_deployment.py +489 -0
- oceanarray/legacy/mooring_rodb.py +429 -0
- oceanarray/legacy/process_rodb.py +369 -0
- oceanarray/legacy/rodb.py +330 -0
- oceanarray/logger.py +192 -0
- oceanarray/logsheet/__init__.py +60 -0
- oceanarray/logsheet/_columns.py +97 -0
- oceanarray/logsheet/_config.py +245 -0
- oceanarray/logsheet/_firmware.py +43 -0
- oceanarray/logsheet/_latex.py +128 -0
- oceanarray/logsheet/_render.py +126 -0
- oceanarray/logsheet/builders/__init__.py +13 -0
- oceanarray/logsheet/builders/caldip_download.py +195 -0
- oceanarray/logsheet/builders/caldip_setup.py +188 -0
- oceanarray/logsheet/builders/deployment_setup.py +218 -0
- oceanarray/logsheet/builders/mooring_download.py +243 -0
- oceanarray/logsheet/builders/recovery.py +157 -0
- oceanarray/logsheet/data/column_defs.yaml +686 -0
- oceanarray/logsheet/data/latex_templates/_base_instrument.tex.j2 +42 -0
- oceanarray/logsheet/data/latex_templates/caldip_download.tex.j2 +47 -0
- oceanarray/logsheet/data/latex_templates/caldip_setup.tex.j2 +70 -0
- oceanarray/logsheet/data/latex_templates/deployment_setup.tex.j2 +97 -0
- oceanarray/logsheet/data/latex_templates/mooring_download.tex.j2 +54 -0
- oceanarray/logsheet/data/latex_templates/recovery.tex.j2 +103 -0
- oceanarray/mooring_level.py +1368 -0
- oceanarray/oceanarray.mplstyle +18 -0
- oceanarray/parameters.py +270 -0
- oceanarray/plotter.py +942 -0
- oceanarray/plotters/__init__.py +97 -0
- oceanarray/plotters/_animation.py +261 -0
- oceanarray/plotters/_current.py +705 -0
- oceanarray/plotters/_diagnostic.py +667 -0
- oceanarray/plotters/_helpers.py +57 -0
- oceanarray/plotters/_primitives.py +101 -0
- oceanarray/plotters/_section.py +16 -0
- oceanarray/plotters/_timeseries.py +11 -0
- oceanarray/rapid_interp.py +739 -0
- oceanarray/read_rbr_hex.py +541 -0
- oceanarray/readers.py +303 -0
- oceanarray/report/__init__.py +5 -0
- oceanarray/report/_array.py +386 -0
- oceanarray/report/_grid.py +539 -0
- oceanarray/report/_html_helpers.py +1004 -0
- oceanarray/report/_instrument.py +853 -0
- oceanarray/report/_mooring.py +1385 -0
- oceanarray/report/_plots.py +4284 -0
- oceanarray/report/_stack.py +941 -0
- oceanarray/stage1.py +1959 -0
- oceanarray/stage2.py +1160 -0
- oceanarray/stage3.py +2494 -0
- oceanarray/time_gridding.py +958 -0
- oceanarray/tools.py +400 -0
- oceanarray/transports.py +1 -0
- oceanarray/utilities.py +538 -0
- oceanarray/validation.py +389 -0
- oceanarray/writers.py +99 -0
- oceanarray-0.1.0.dist-info/METADATA +503 -0
- oceanarray-0.1.0.dist-info/RECORD +76 -0
- oceanarray-0.1.0.dist-info/WHEEL +5 -0
- oceanarray-0.1.0.dist-info/entry_points.txt +2 -0
- oceanarray-0.1.0.dist-info/licenses/LICENSE +21 -0
- oceanarray-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
axes.titlesize : 15
|
|
2
|
+
axes.labelsize : 12
|
|
3
|
+
date.autoformatter.day: %Y-%m-%d
|
|
4
|
+
date.converter: auto
|
|
5
|
+
figure.figsize: 8, 4
|
|
6
|
+
figure.dpi: 100
|
|
7
|
+
savefig.dpi: 150
|
|
8
|
+
font.family: sans-serif
|
|
9
|
+
font.style: normal
|
|
10
|
+
font.size: 12
|
|
11
|
+
legend.fontsize: 12
|
|
12
|
+
lines.linewidth : 1
|
|
13
|
+
lines.linestyle: -
|
|
14
|
+
lines.markersize : 10
|
|
15
|
+
xtick.labelsize : 12
|
|
16
|
+
xtick.alignment: center
|
|
17
|
+
ytick.labelsize : 12
|
|
18
|
+
axes.grid : False
|
oceanarray/parameters.py
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
"""Package-level defaults for oceanarray.
|
|
2
|
+
|
|
3
|
+
Matplotlib appearance (font sizes, figure size, DPI, grid style) belongs in
|
|
4
|
+
``oceanarray.mplstyle`` — that is the right place for anything that maps to a
|
|
5
|
+
matplotlib rcParam.
|
|
6
|
+
|
|
7
|
+
This file holds the things the mplstyle *cannot* express: instrument
|
|
8
|
+
abbreviations, colorbar percentile clipping, downsample interval, and
|
|
9
|
+
figure sizes that differ from the per-plot mplstyle default.
|
|
10
|
+
|
|
11
|
+
Import and reassign any value here to override it globally, e.g.::
|
|
12
|
+
|
|
13
|
+
import oceanarray.parameters as P
|
|
14
|
+
P.DOWNSAMPLE_SECONDS = 60
|
|
15
|
+
P.DEFAULT_COLORMAP = "viridis"
|
|
16
|
+
|
|
17
|
+
These values are read at call time, so assignment before calling a function
|
|
18
|
+
is sufficient.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
from pathlib import Path
|
|
22
|
+
|
|
23
|
+
# ---------------------------------------------------------------------------
|
|
24
|
+
# Matplotlib style path (used by plotters via plt.style.use)
|
|
25
|
+
# ---------------------------------------------------------------------------
|
|
26
|
+
MPLSTYLE = Path(__file__).parent / "oceanarray.mplstyle"
|
|
27
|
+
|
|
28
|
+
# ---------------------------------------------------------------------------
|
|
29
|
+
# Figure sizes for plot types that differ from the mplstyle default (8×4)
|
|
30
|
+
# ---------------------------------------------------------------------------
|
|
31
|
+
FIGURE_SIZE_WIDE = (14, 6) # multi-instrument overview (scatter / line)
|
|
32
|
+
FIGURE_SIZE_TALL = (12, 8) # stacked single-instrument panels
|
|
33
|
+
|
|
34
|
+
# ---------------------------------------------------------------------------
|
|
35
|
+
# Resampling
|
|
36
|
+
# ---------------------------------------------------------------------------
|
|
37
|
+
DOWNSAMPLE_SECONDS = 120 # default resample interval for mooring plots
|
|
38
|
+
|
|
39
|
+
# ---------------------------------------------------------------------------
|
|
40
|
+
# Colormaps and colorbar clipping
|
|
41
|
+
# (these have no mplstyle equivalent)
|
|
42
|
+
# ---------------------------------------------------------------------------
|
|
43
|
+
DEFAULT_COLORMAP = "RdBu_r" # red (warm) → blue (cold); good for temperature
|
|
44
|
+
COLORBAR_PLOW = 5 # lower percentile for vmin
|
|
45
|
+
COLORBAR_PHIGH = 95 # upper percentile for vmax
|
|
46
|
+
|
|
47
|
+
# ---------------------------------------------------------------------------
|
|
48
|
+
# Density reference pressure (dbar) for potential density anomaly at stack step.
|
|
49
|
+
# 0 → sigma-0 (suitable for shallow moorings < ~1000 m)
|
|
50
|
+
# 2000 → sigma-2 (suitable for deep moorings)
|
|
51
|
+
# Override per mooring in YAML: density_reference: 2000
|
|
52
|
+
# ---------------------------------------------------------------------------
|
|
53
|
+
DENSITY_REFERENCE = 0
|
|
54
|
+
DENSITY_COLORMAP = "BuPu" # ColorBrewer sequential: light-cyan → dark-purple
|
|
55
|
+
# Iso-density contour lines overlaid on sigma pcolormesh plots.
|
|
56
|
+
# Set to [] to suppress. Values are in kg m-3 (above 1000).
|
|
57
|
+
SIGMA_CONTOUR_LEVELS = [27.7, 27.8]
|
|
58
|
+
|
|
59
|
+
# Colors for instrument types in stack-level time series plots.
|
|
60
|
+
# Keys match the 'instrument' field in the mooring YAML.
|
|
61
|
+
INSTRUMENT_COLORS = {
|
|
62
|
+
"microcat": "#1f77b4", # blue
|
|
63
|
+
"aquadopp": "#d62728", # red
|
|
64
|
+
"rbr": "#2ca02c", # green
|
|
65
|
+
"rbr-solo": "#2ca02c",
|
|
66
|
+
"rbr-duet": "#17becf", # teal
|
|
67
|
+
"default": "#7f7f7f", # gray for unknown types
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
# ---------------------------------------------------------------------------
|
|
71
|
+
# Instrument abbreviations (instrument directory name → short label prefix)
|
|
72
|
+
#
|
|
73
|
+
# Used to build labels like "MC2942 868m" in multi-instrument plots.
|
|
74
|
+
# Add entries here to support new instrument types without editing plotters.
|
|
75
|
+
# ---------------------------------------------------------------------------
|
|
76
|
+
# ---------------------------------------------------------------------------
|
|
77
|
+
# OceanSITES QC flag table (Reference Table 2)
|
|
78
|
+
# Applied to *_qc companion variables in _stage2.nc and stage 3 output.
|
|
79
|
+
# ---------------------------------------------------------------------------
|
|
80
|
+
QC_CONVENTION = "OceanSITES reference table 2"
|
|
81
|
+
QC_FLAG_VALUES = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
82
|
+
QC_FLAG_MEANINGS = (
|
|
83
|
+
"no_qc_performed good_data probably_good_data probably_bad_data "
|
|
84
|
+
"bad_data value_changed not_in_use nominal_value "
|
|
85
|
+
"interpolated_value missing_value"
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
# ---------------------------------------------------------------------------
|
|
89
|
+
# QARTOD gross-range test thresholds (global ocean defaults).
|
|
90
|
+
#
|
|
91
|
+
# fail_span : values outside this range are flagged 4 (bad).
|
|
92
|
+
# suspect_span: values outside this but inside fail_span → flag 3 (suspect).
|
|
93
|
+
#
|
|
94
|
+
# Stage 3 normalises conductivity to mS/cm before applying QC, so thresholds
|
|
95
|
+
# here are always interpreted in the units shown in the comments below.
|
|
96
|
+
# Override per mooring in the YAML top-level key ``qc_ranges``, or per
|
|
97
|
+
# instrument in each clamp entry's ``qc_ranges`` key.
|
|
98
|
+
# ---------------------------------------------------------------------------
|
|
99
|
+
QC_GROSS_RANGE: dict = {
|
|
100
|
+
"temperature": {"fail_span": (-2.5, 40.0), "suspect_span": (-2.0, 35.0)}, # degC
|
|
101
|
+
"conductivity": {
|
|
102
|
+
"fail_span": (0.0, 75.0),
|
|
103
|
+
"suspect_span": (0.0, 65.0),
|
|
104
|
+
}, # mS/cm (ocean: 20–60)
|
|
105
|
+
"salinity": {
|
|
106
|
+
"fail_span": (0.0, 40.0),
|
|
107
|
+
"suspect_span": (2.0, 40.0),
|
|
108
|
+
}, # PSU (ocean: 30–38)
|
|
109
|
+
"pressure": {"fail_span": (-5.0, 7000.0), "suspect_span": (-0.5, 7000.0)}, # dbar
|
|
110
|
+
"east_velocity": {"fail_span": (-5.0, 5.0), "suspect_span": (-3.0, 3.0)}, # m/s
|
|
111
|
+
"north_velocity": {"fail_span": (-5.0, 5.0), "suspect_span": (-3.0, 3.0)}, # m/s
|
|
112
|
+
"up_velocity": {"fail_span": (-1.0, 1.0), "suspect_span": (-0.5, 0.5)}, # m/s
|
|
113
|
+
# Turbidity: negative values are physically impossible (no lower bound in nature).
|
|
114
|
+
# Upper bound is generous — coastal resuspension events can reach 1000 NTU.
|
|
115
|
+
# Override per mooring if the sensor range is known to be tighter.
|
|
116
|
+
"turbidity": {
|
|
117
|
+
"fail_span": (-10.0, 4000.0),
|
|
118
|
+
"suspect_span": (-5.0, 1000.0),
|
|
119
|
+
}, # NTU; lower bounds unverified — sensors can read slightly negative near zero
|
|
120
|
+
# Dissolved oxygen (SBE ODO sensor, µmol/L). Deep North Atlantic: 200–320 µmol/L.
|
|
121
|
+
# Negative values are physically impossible → fail. >500 µmol/L is unrealistic
|
|
122
|
+
# even near the surface (photosynthetic supersaturation ~350–400 µmol/L).
|
|
123
|
+
# Override per mooring via qc_ranges YAML key.
|
|
124
|
+
"dissolved_oxygen": {
|
|
125
|
+
"fail_span": (0.0, 500.0),
|
|
126
|
+
"suspect_span": (0.0, 450.0),
|
|
127
|
+
}, # umol/L
|
|
128
|
+
# O2 % saturation: >200 % would indicate severe bubble entrainment or sensor fault.
|
|
129
|
+
"oxygen_saturation_pct": {"fail_span": (0.0, 200.0), "suspect_span": (0.0, 150.0)},
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
# ---------------------------------------------------------------------------
|
|
133
|
+
# QARTOD spike test thresholds (global ocean defaults).
|
|
134
|
+
#
|
|
135
|
+
# The spike test flags a point n if |x[n] - (x[n-2]+x[n+1])/2| exceeds the
|
|
136
|
+
# threshold. Thresholds therefore scale with the *typical* variability at the
|
|
137
|
+
# sampling interval in use — these defaults assume a fixed mooring in the deep
|
|
138
|
+
# ocean sampled at O(60–120 s). Shallower or more energetic moorings may
|
|
139
|
+
# need smaller suspect_threshold values set via YAML.
|
|
140
|
+
#
|
|
141
|
+
# Units match the NC variable units.
|
|
142
|
+
# ---------------------------------------------------------------------------
|
|
143
|
+
QC_SPIKE: dict = {
|
|
144
|
+
"temperature": {"suspect_threshold": 2.0, "fail_threshold": 6.0}, # degC
|
|
145
|
+
"conductivity": {
|
|
146
|
+
"suspect_threshold": 2.0,
|
|
147
|
+
"fail_threshold": 5.0,
|
|
148
|
+
}, # mS/cm (low spikes: biofouling)
|
|
149
|
+
"salinity": {
|
|
150
|
+
"suspect_threshold": 1,
|
|
151
|
+
"fail_threshold": 2.0,
|
|
152
|
+
}, # PSU (timing issues on unpumped sensors)
|
|
153
|
+
"pressure": {"suspect_threshold": 10.0, "fail_threshold": 50.0}, # dbar
|
|
154
|
+
# Velocity spike test omitted: burst-mode Aquadopps generate false
|
|
155
|
+
# positives at every burst boundary, and real oceanic events can produce
|
|
156
|
+
# large velocity changes on short time scales. Add per-instrument via
|
|
157
|
+
# qc_spike: YAML key if needed for a specific deployment.
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
# ---------------------------------------------------------------------------
|
|
161
|
+
# QARTOD flat-line (stuck-value) test thresholds.
|
|
162
|
+
#
|
|
163
|
+
# Applied to pressure only by default. A value is considered "stuck" when it
|
|
164
|
+
# does not change by more than ``tolerance`` over a contiguous window.
|
|
165
|
+
#
|
|
166
|
+
# suspect_n : flag SUSPECT when stuck for this many consecutive samples
|
|
167
|
+
# fail_n : flag FAIL when stuck for this many consecutive samples
|
|
168
|
+
# tolerance : maximum allowed change that is still considered "flat" (default 0)
|
|
169
|
+
#
|
|
170
|
+
# In ``_apply_qc_tests`` (stage3.py), ``suspect_n`` / ``fail_n`` are multiplied
|
|
171
|
+
# by the median inter-sample interval (seconds) before being passed to
|
|
172
|
+
# ``ioos_qc.qartod.flat_line_test``, which takes its thresholds in seconds.
|
|
173
|
+
# Override per mooring via ``qc_flat_line`` YAML key.
|
|
174
|
+
# ---------------------------------------------------------------------------
|
|
175
|
+
QC_FLAT_LINE: dict = {
|
|
176
|
+
# tolerance must be > 0: ioos_qc flags when range < tolerance over the
|
|
177
|
+
# window, so tolerance=0 means range < 0 which is never true.
|
|
178
|
+
# 0.001 dbar is below any real mooring pressure variability and catches
|
|
179
|
+
# sensors returning the exact same value (e.g. 4959 stuck at 0 dbar).
|
|
180
|
+
"pressure": {"suspect_n": 3, "fail_n": 10, "tolerance": 0.001},
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
# ---------------------------------------------------------------------------
|
|
184
|
+
# Tilt QC thresholds for Aquadopp (applied to velocity variables when |roll|
|
|
185
|
+
# exceeds these values; degrees).
|
|
186
|
+
#
|
|
187
|
+
# suspect_threshold : 3 (suspect/possibly bad)
|
|
188
|
+
# fail_threshold : 4 (bad/probably bad)
|
|
189
|
+
#
|
|
190
|
+
# Override per mooring in ``tilt_qc`` YAML key, or per instrument.
|
|
191
|
+
# ---------------------------------------------------------------------------
|
|
192
|
+
QC_TILT: dict = {
|
|
193
|
+
"suspect_threshold": 30.0,
|
|
194
|
+
"fail_threshold": 50.0,
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
# ---------------------------------------------------------------------------
|
|
198
|
+
# ADCP-specific QC thresholds.
|
|
199
|
+
#
|
|
200
|
+
# percent_good_bad : bins where percent_good column 3 (fraction of 4-beam
|
|
201
|
+
# solutions) falls below this threshold are flagged bad (4).
|
|
202
|
+
# Column 3 is used — NOT the mean across beams — because
|
|
203
|
+
# a cross-beam mean would give ~25 % even for perfect data.
|
|
204
|
+
# percent_good_suspect : bins between percent_good_bad and this threshold
|
|
205
|
+
# are flagged suspect (3).
|
|
206
|
+
# error_velocity_threshold : bins where |error_velocity| exceeds this value
|
|
207
|
+
# are flagged bad (4). m/s.
|
|
208
|
+
# ---------------------------------------------------------------------------
|
|
209
|
+
QC_ADCP: dict = {
|
|
210
|
+
"percent_good_bad": 25.0,
|
|
211
|
+
"percent_good_suspect": 50.0,
|
|
212
|
+
"error_velocity_threshold": 0.3,
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
# ---------------------------------------------------------------------------
|
|
216
|
+
# ADCP bin dimension name.
|
|
217
|
+
# Never hard-code "N_BINS" — reference this constant everywhere so the
|
|
218
|
+
# dimension can be renamed to "N_LEVELS" later by changing one line.
|
|
219
|
+
# ---------------------------------------------------------------------------
|
|
220
|
+
ADCP_BIN_DIM: str = "N_BINS"
|
|
221
|
+
|
|
222
|
+
INSTRUMENT_ABBREV = {
|
|
223
|
+
"microcat": "MC",
|
|
224
|
+
"aquadopp": "AQ",
|
|
225
|
+
"rbrsolo": "RS",
|
|
226
|
+
"rbrduet": "RD",
|
|
227
|
+
"sbe56": "SB",
|
|
228
|
+
"sbe16": "SB",
|
|
229
|
+
"tr1050": "TR",
|
|
230
|
+
"adcp": "AD",
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
# ---------------------------------------------------------------------------
|
|
234
|
+
# Instrument type → allowed file_type values for the mooring YAML.
|
|
235
|
+
#
|
|
236
|
+
# ``instrument:`` is the human-readable name stored in instrument_type
|
|
237
|
+
# coordinates and used to dispatch Aquadopp-specific plots,
|
|
238
|
+
# declination correction, tilt QC, etc.
|
|
239
|
+
#
|
|
240
|
+
# ``file_type:`` is the seasenselib reader key that controls how the raw
|
|
241
|
+
# file is parsed. Each instrument may have several variants.
|
|
242
|
+
#
|
|
243
|
+
# To add a new instrument class: add an entry here. Everything that checks
|
|
244
|
+
# instrument type (reports, mooring_level, plotters) reads KNOWN_INSTRUMENT_TYPES
|
|
245
|
+
# from this dict.
|
|
246
|
+
# ---------------------------------------------------------------------------
|
|
247
|
+
INSTRUMENT_FILE_TYPES: dict = {
|
|
248
|
+
"microcat": ["sbe-cnv", "sbe-ascii", "sbe-hex"],
|
|
249
|
+
"aquadopp": ["nortek-aqd", "nortek-ascii", "nortek-csv"],
|
|
250
|
+
"tr1050": ["rbr-hex"], # RBR TR-1050 thermistor chain
|
|
251
|
+
"rbrsolo": ["rbr-rsk"], # RBR soloT — single-channel temperature
|
|
252
|
+
"rbrduet": ["rbr-rsk"], # RBR duet — temperature + pressure or T+C
|
|
253
|
+
"seapoint": ["rbr-rsk"], # Seapoint turbidity sensor via RBR logger
|
|
254
|
+
"ADCP": [
|
|
255
|
+
"rdi-raw", # RDI Workhorse / Sentinel via dolfyn (mhkit[dolfyn] required)
|
|
256
|
+
"adcp-matlab-rdadcp",
|
|
257
|
+
"adcp-matlab-uhhds",
|
|
258
|
+
], # Generic ADCP (instrument: ADCP in YAML — note uppercase)
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
# Derived: set of allowed ``instrument:`` values in mooring YAML files.
|
|
262
|
+
KNOWN_INSTRUMENT_TYPES: frozenset = frozenset(INSTRUMENT_FILE_TYPES.keys())
|
|
263
|
+
|
|
264
|
+
# File types that seasenselib accepts but are deprecated, experimental, or
|
|
265
|
+
# not tied to a primary instrument: value above.
|
|
266
|
+
EXTRA_FILE_TYPES: dict = {
|
|
267
|
+
"nortek-csv-oa": "aquadopp (DEPRECATED internal reader; use nortek-csv)",
|
|
268
|
+
"rbr-dat": "RBR instruments (not in current seasenselib; use rbr-rsk)",
|
|
269
|
+
"rbr-matlab-legacy": "RBR instruments (DEPRECATED legacy format)",
|
|
270
|
+
}
|