Skip to content

Refactor for Nortek classic reader - #473

Merged
jmcvey3 merged 7 commits into
MHKiT-Software:developfrom
jmcvey3:nortek-classic
Nov 13, 2026
Merged

jmcvey3 merged 7 commits into
MHKiT-Software:developfrom
jmcvey3:nortek-classic

Conversation

@jmcvey3

@jmcvey3 jmcvey3 commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

A co-worker found a bug in the reader after setting up the ADV to save 100 Mb files. But, in doing so, it looks like the instrument chops up a data-packet between sequential files, erroring the reader out. (So in the future, I'd advise not setting a max file size).

This refactor does a better job scanning the file for the total number of pings, and then cleans up a lot of the poorly written code. I'd still like to rewrite the "read" functions in nortek.py because they're still difficult to read, but that is a larger job.

@akeeste

akeeste commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

ready for review

@akeeste akeeste left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jmcvey3! This looks good to me. The examples are still running and results are the same as before.

There are some cdip tests failing, but they seem entirely unrelated to this PR.

Comment thread mhkit/dolfyn/io/nortek.py Outdated
"pct_of_mean_pressure",
"pct_of_min_re",
][int(wave_meas_mode[2])]
cfg_u

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

Comment thread mhkit/dolfyn/io/nortek.py
"0x81": "read_aqd_mag", # Aquadopp with magnetometer
}

size_map = {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add comment

Comment thread mhkit/dolfyn/io/nortek.py Outdated

# Run the appropriate initialization routine (e.g. init_ADV).
getattr(self, "init_" + self._inst)()
# No apparent way to determine how many samples are in a file

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update this comment

Comment thread mhkit/dolfyn/io/nortek.py Outdated
self._init_data(defs.vec_data)
self._dtypes += ["vec_data"]

# The size byte in read_vec is

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finish comment

Comment thread mhkit/dolfyn/io/nortek.py
for idx in range(nbeams):
dv["amp"][idx, :, c] = tmp[idx * nbins : (idx + 1) * nbins]
self.checksum(byts)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add comment for fill byte being included if n_bins is odd

@jmcvey3

jmcvey3 commented Nov 11, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @jmcvey3! This looks good to me. The examples are still running and results are the same as before.

There are some cdip tests failing, but they seem entirely unrelated to this PR.

Thanks @akeeste! I added some comments that I need to clean up when I get back to this (probably Friday), and then I'll merge

@jmcvey3
jmcvey3 merged commit 3f92819 into MHKiT-Software:develop Nov 13, 2026
72 of 73 checks passed
@jmcvey3
jmcvey3 deleted the nortek-classic branch November 13, 2026 22:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants