Skip to content

Commit 940bbc6

Browse files
authored
Merge pull request #130 from ocean-uhh/126-fix-nortek-raw-reader-works-for-aqd-files-from-gen1-instruments-but-not-for-files-from-gen2
fix: Nortek raw reader works for .aqd files from Gen1 instruments but…
2 parents eb502fc + e8d7f7b commit 940bbc6

6 files changed

Lines changed: 1500 additions & 166 deletions

File tree

docs/source/developers_guide.rst

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,17 @@ The ``SbeCnvReader`` handles SeaBird CNV files, commonly used for CTD profile da
174174
dataset = ssl.read("rbr_export.mat", file_format='rbr-matlab')
175175
dataset = ssl.read("rsktools_export.mat", file_format='rbr-matlab-rsktools')
176176
177+
# RBR HEX exports require an explicit format key because .hex is also used
178+
# by SeaBird HEX files
179+
dataset = ssl.read("rbr_logger.hex", file_format='rbr-hex')
180+
177181
*Legacy API:*
178182

179183
The ``RbrRskReader`` family handles RBR RSK files from moored instruments:
180184

181185
.. code-block:: python
182186
183-
from seasenselib.readers import RbrRskAutoReader, RbrMatlabReader
187+
from seasenselib.readers import RbrRskAutoReader, RbrMatlabReader, RbrHexReader
184188
185189
# Auto-detect RSK format version
186190
reader = RbrRskAutoReader("solo_temp.rsk")
@@ -190,6 +194,10 @@ The ``RbrRskReader`` family handles RBR RSK files from moored instruments:
190194
reader = RbrMatlabReader("rbr_export.mat")
191195
dataset = reader.data
192196
197+
# HEX format reader
198+
reader = RbrHexReader("rbr_logger.hex")
199+
dataset = reader.data
200+
193201
**Nortek Aquadopp Instruments**
194202

195203
*Modern API:*
@@ -685,4 +693,4 @@ The SeaSenseLib repository includes example data files in the ``examples/`` dire
685693
* ``DSE18_013889_20180827_1349.mat``: RBR TR1050 MATLAB export
686694
* ``DSE18_SBE05608482_2018_08_27.cnv``: SeaBird SBE56 thermistor
687695

688-
These files let you test the data processing with different file formats.
696+
These files let you test the data processing with different file formats.

docs/source/reader_notes.rst

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,17 @@ anchors and channel metadata are preserved in ``raw_metadata``.
3333
Nortek raw
3434
----------
3535

36-
The ``nortek-raw`` reader decodes classic Nortek raw binary files, currently
37-
advertised for Aquadopp ``.aqd``, Vector ``.VEC`` and AWAC ``.wpr`` files,
38-
with MHKiT DOLfYN. Nortek Signature ``.ad2cp`` files use a separate DOLfYN
39-
decoder and are not part of this reader. This reader is marked experimental
40-
because support is still being validated across Nortek raw variants.
36+
The ``nortek-raw`` reader decodes Nortek raw binary files with MHKiT DOLfYN.
37+
It dispatches classic Aquadopp ``.aqd``, Vector ``.VEC`` and AWAC ``.wpr``
38+
files to DOLfYN's classic Nortek decoder, and dispatches AD2CP/Gen2-style
39+
``.aqd`` files to DOLfYN's Nortek2 decoder based on the binary file header.
40+
Nortek2 averaged ``*_avgd.aqd`` products with ID 38 packets are decoded by a
41+
small SeaSenseLib fallback because the DOLfYN Nortek2 indexer does not include
42+
that packet family.
43+
44+
Nortek Signature ``.ad2cp`` files use the same DOLfYN decoder family but are
45+
not advertised by this reader yet. This reader is marked experimental because
46+
support is still being validated across Nortek raw variants.
4147

4248
Velocity is preserved as vector variable ``vel``. If ``coord_sys`` is
4349
``earth``, the decoded ``dir`` coordinate usually identifies east, north and

docs/source/supported_formats.rst

Lines changed: 59 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,16 @@ Format keys can be used with ``ssl.read(filename, file_format='key')`` when auto
3737
- ``.dat`` + ``.hdr``
3838
- ``nortek-ascii``
3939
- Nortek ASCII format (requires header file)
40-
* - Nortek
41-
- Aquadopp
42-
- ``.csv``
43-
- ``nortek-csv``
44-
- Nortek AquaPro CSV export format
45-
* - Nortek
46-
- Aquadopp, Vector, AWAC
47-
- ``.aqd``, ``.VEC``, ``.wpr``
48-
- ``nortek-raw``
49-
- Nortek raw binary files via MHKiT DOLfYN (experimental)
40+
* - Nortek
41+
- Aquadopp
42+
- ``.csv``
43+
- ``nortek-csv``
44+
- Nortek AquaPro CSV export format
45+
* - Nortek
46+
- Aquadopp, Aquadopp Gen2, Vector, AWAC
47+
- ``.aqd``, ``.VEC``, ``.wpr``
48+
- ``nortek-raw``
49+
- Nortek raw binary files; Gen2 ``.aqd`` and averaged ``*_avgd.aqd`` products are detected from the binary header (experimental)
5050
* - RBR
5151
- Solo T
5252
- ``.rsk``
@@ -77,19 +77,19 @@ Format keys can be used with ``ssl.read(filename, file_format='key')`` when auto
7777
- ``.mat``
7878
- ``rbr-matlab-rsktools``
7979
- RBR MATLAB RSKtools export
80-
* - RBR
81-
- Various
82-
- ``.txt``, ``.dat``
83-
- ``rbr-ascii``
84-
- RBR ASCII format
85-
* - RBR
86-
- TR1050
87-
- ``.hex``
88-
- ``rbr-hex``
89-
- RBR binary HEX format (explicit format key required)
90-
* - SeaBird
91-
- SBE37 MicroCAT
92-
- ``.cnv``
80+
* - RBR
81+
- Various
82+
- ``.txt``, ``.dat``
83+
- ``rbr-ascii``
84+
- RBR ASCII format
85+
* - RBR
86+
- TR1050
87+
- ``.hex``
88+
- ``rbr-hex``
89+
- RBR binary HEX format (explicit format key required)
90+
* - SeaBird
91+
- SBE37 MicroCAT
92+
- ``.cnv``
9393
- ``sbe-cnv``
9494
- SeaBird CNV format (time series)
9595
* - SeaBird
@@ -153,10 +153,10 @@ SeaSenseLib can automatically detect format for files with unique extensions:
153153
dataset = ssl.read('your_file.cnv') # SeaBird CNV files
154154
dataset = ssl.read('your_file.hex') # SeaBird SBE37 HEX files
155155
dataset = ssl.read('logger_data.rsk') # RBR RSK files (auto-selects modern/legacy)
156-
dataset = ssl.read('grid_data.nc') # NetCDF files
157-
dataset = ssl.read('sensor_data.csv') # CSV files
158-
dataset = ssl.read('tob_data.tob') # Seasun TOB files
159-
dataset = ssl.read('aquadopp.aqd') # Nortek raw files
156+
dataset = ssl.read('grid_data.nc') # NetCDF files
157+
dataset = ssl.read('sensor_data.csv') # CSV files
158+
dataset = ssl.read('tob_data.tob') # Seasun TOB files
159+
dataset = ssl.read('aquadopp.aqd') # Nortek raw files
160160
161161
**Explicit Format Specification:**
162162

@@ -165,13 +165,13 @@ SeaSenseLib can automatically detect format for files with unique extensions:
165165
# When automatic detection fails
166166
dataset = ssl.read('data.txt', file_format='sbe-ascii')
167167
168-
# For ambiguous extensions like .mat
169-
rbr_data = ssl.read('logger_export.mat', file_format='rbr-matlab')
170-
adcp_data = ssl.read('current_data.mat', file_format='adcp-matlab-uhhds')
171-
172-
# RBR HEX files also require an explicit key because .hex auto-detects
173-
# as SeaBird SBE37 HEX
174-
rbr_hex_data = ssl.read('logger.hex', file_format='rbr-hex')
168+
# For ambiguous extensions like .mat
169+
rbr_data = ssl.read('logger_export.mat', file_format='rbr-matlab')
170+
adcp_data = ssl.read('current_data.mat', file_format='adcp-matlab-uhhds')
171+
172+
# RBR HEX files also require an explicit key because .hex auto-detects
173+
# as SeaBird SBE37 HEX
174+
rbr_hex_data = ssl.read('logger.hex', file_format='rbr-hex')
175175
176176
**Multi-file Formats:**
177177

@@ -182,20 +182,20 @@ SeaSenseLib can automatically detect format for files with unique extensions:
182182
file_format='nortek-ascii',
183183
header_file='current_meter.hdr')
184184
185-
# Nortek AquaPro CSV exports use an explicit format key because .csv is
186-
# also used by the generic CSV reader
187-
nortek_csv_data = ssl.read('Average Velocity DF3.csv',
188-
file_format='nortek-csv')
189-
190-
# Nortek raw Aquadopp, Vector and AWAC data is decoded by MHKiT DOLfYN
191-
# (experimental)
192-
nortek_raw_data = ssl.read('DS-FDA01.aqd',
193-
file_format='nortek-raw')
194-
195-
# RDI raw ADCP data is decoded by MHKiT DOLfYN
196-
rdi_data = ssl.read('DS2_2025_recovery.000',
197-
file_format='rdi-raw',
198-
nens=100)
185+
# Nortek AquaPro CSV exports use an explicit format key because .csv is
186+
# also used by the generic CSV reader
187+
nortek_csv_data = ssl.read('Average Velocity DF3.csv',
188+
file_format='nortek-csv')
189+
190+
# Nortek raw Aquadopp, Vector and AWAC data is decoded by MHKiT DOLfYN
191+
# (experimental)
192+
nortek_raw_data = ssl.read('DS-FDA01.aqd',
193+
file_format='nortek-raw')
194+
195+
# RDI raw ADCP data is decoded by MHKiT DOLfYN
196+
rdi_data = ssl.read('DS2_2025_recovery.000',
197+
file_format='rdi-raw',
198+
nens=100)
199199
200200
# Automatic detection also works for supported RDI raw suffixes:
201201
rdi_data = ssl.read('DS2_2025_recovery.000', nens=100)
@@ -212,17 +212,17 @@ Format Detection Summary
212212
- ``.hex`` → ``sbe-hex`` (SeaBird SBE37 HEX files)
213213
- ``.rsk`` → ``rbr-rsk`` (RBR RSK files - automatically selects modern/legacy reader)
214214
- ``.nc`` → ``netcdf`` (NetCDF files)
215-
- ``.csv`` → ``csv`` (CSV files)
216-
- ``.tob`` → ``seasun-tob`` (Sea & Sun TOB files)
217-
- ``.aqd/.VEC/.wpr`` → ``nortek-raw`` (Nortek raw binary files via MHKiT DOLfYN, experimental)
218-
- ``.000/.PD0/.ENR/.ENS/.ENX`` → ``rdi-raw`` (RDI raw ADCP files via MHKiT DOLfYN)
219-
220-
**Requires explicit format keys** (ambiguous extensions):
221-
222-
- RBR ``.hex`` files: ``rbr-hex`` (``.hex`` otherwise auto-detects as ``sbe-hex``)
223-
- ``.mat`` files: ``rbr-matlab``, ``rcm-matlab``, ``adcp-matlab-uhhds``, ``adcp-matlab-rdadcp``
224-
- ``.txt/.dat`` files: ``rbr-ascii``, ``sbe-ascii``, ``nortek-ascii``
225-
- Nortek AquaPro ``.csv`` exports: ``nortek-csv`` (``.csv`` otherwise auto-detects as generic ``csv``)
215+
- ``.csv`` → ``csv`` (CSV files)
216+
- ``.tob`` → ``seasun-tob`` (Sea & Sun TOB files)
217+
- ``.aqd/.VEC/.wpr`` → ``nortek-raw`` (Nortek raw binary files via MHKiT DOLfYN, experimental)
218+
- ``.000/.PD0/.ENR/.ENS/.ENX`` → ``rdi-raw`` (RDI raw ADCP files via MHKiT DOLfYN)
219+
220+
**Requires explicit format keys** (ambiguous extensions):
221+
222+
- RBR ``.hex`` files: ``rbr-hex`` (``.hex`` otherwise auto-detects as ``sbe-hex``)
223+
- ``.mat`` files: ``rbr-matlab``, ``rcm-matlab``, ``adcp-matlab-uhhds``, ``adcp-matlab-rdadcp``
224+
- ``.txt/.dat`` files: ``rbr-ascii``, ``sbe-ascii``, ``nortek-ascii``
225+
- Nortek AquaPro ``.csv`` exports: ``nortek-csv`` (``.csv`` otherwise auto-detects as generic ``csv``)
226226
- Multi-file formats: ``nortek-ascii`` (requires both ``.dat`` and ``.hdr`` files)
227227

228228
When to Use Format Keys

0 commit comments

Comments
 (0)