Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ever-changing RDI RiverPro depth bin ranges #378

Merged
merged 5 commits into from
Feb 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified examples/data/dolfyn/test_data/RDI_7f79.nc
Binary file not shown.
Binary file modified examples/data/dolfyn/test_data/RDI_7f79_2.nc
Binary file not shown.
Binary file modified examples/data/dolfyn/test_data/RDI_test01.nc
Binary file not shown.
Binary file modified examples/data/dolfyn/test_data/RDI_test01_clean.nc
Binary file not shown.
Binary file modified examples/data/dolfyn/test_data/RDI_test01_ofilt.nc
Binary file not shown.
Binary file modified examples/data/dolfyn/test_data/RDI_test01_rotate_beam2inst.nc
Binary file not shown.
Binary file modified examples/data/dolfyn/test_data/RDI_test01_rotate_earth2principal.nc
Binary file not shown.
Binary file modified examples/data/dolfyn/test_data/RDI_test01_rotate_inst2earth.nc
Binary file not shown.
12 changes: 6 additions & 6 deletions examples/data/dolfyn/test_data/RDI_withBT.dolfyn.log
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ root - INFO - cfgid0: [7f, 7f]
root - INFO - {'nbyte': 579, 'dat_offsets': array([ 20, 79, 144, 282, 352, 422, 492])}
root - INFO - pos 20
root - INFO - id 0 offset 20
root - INFO - Number of cells set to 17
root - INFO - Cell size set to 1.0
root - DEBUG - Number of cells set to 17
root - DEBUG - Cell size set to 1.0
root - DEBUG - Bin 1 distance set to 2.09
root - INFO - Read Config
root - INFO - Read Fixed
root - INFO - id 128 offset 79
Expand All @@ -13,9 +14,9 @@ root - INFO - id 512 offset 282
root - INFO - id 768 offset 352
root - INFO - id 1024 offset 422
root - INFO - id 1536 offset 492
root - INFO - Done: {'prog_ver': 51.41, 'inst_model': 'Workhorse', 'beam_angle': 20, 'freq': 600, 'beam_pattern': 'convex', 'orientation': 'down', 'n_beams': 4, 'n_cells': 17, 'pings_per_ensemble': 1, 'cell_size': 1.0, 'blank_dist': 0.88, 'profiling_mode': 1, 'min_corr_threshold': 64, 'n_code_reps': 5, 'min_prcnt_gd': 0, 'max_error_vel': 2.0, 'sec_between_ping_groups': 0.5, 'coord_sys': 'earth', 'use_pitchroll': 'yes', 'use_3beam': 'yes', 'bin_mapping': 'yes', 'heading_misalign_deg': 0.0, 'magnetic_var_deg': 0.0, 'sensors_src': '01111101', 'sensors_avail': '00111101', 'bin1_dist_m': 2.09, 'transmit_pulse_m': 1.18, 'water_ref_cells': [1, 5], 'false_target_threshold': 50, 'transmit_lag_m': 0.24, 'bandwidth': 0, 'power_level': 255, 'serialnum': 18655}
root - INFO - self._bb False
root - INFO - self.cfgbb: {}
root - INFO - Done: {'prog_ver': 51.41, 'inst_make': 'TRDI', 'inst_type': 'ADCP', 'rotate_vars': ['vel'], 'has_imu': 0, 'inst_model': 'Workhorse', 'beam_angle': 20, 'freq': 600, 'beam_pattern': 'convex', 'orientation': 'down', 'n_beams': 4, 'n_cells': 17, 'pings_per_ensemble': 1, 'cell_size': 1.0, 'blank_dist': 0.88, 'profiling_mode': 1, 'min_corr_threshold': 64, 'n_code_reps': 5, 'min_prcnt_gd': 0, 'max_error_vel': 2.0, 'sec_between_ping_groups': 0.5, 'coord_sys': 'earth', 'use_pitchroll': 'yes', 'use_3beam': 'yes', 'bin_mapping': 'yes', 'heading_misalign_deg': 0.0, 'magnetic_var_deg': 0.0, 'sensors_src': '01111101', 'sensors_avail': '00111101', 'bin1_dist_m': 2.09, 'transmit_pulse_m': 1.18, 'water_ref_cells': [1, 5], 'false_target_threshold': 50, 'transmit_lag_m': 0.24, 'bandwidth': 0, 'power_level': 255, 'serialnum': 18655}
root - INFO - self._BB False
root - INFO - self.cfgBB: {}
root - INFO - taking data from pings 0 - 1721
root - INFO - 1721 ensembles will be produced.

Expand Down Expand Up @@ -98,4 +99,3 @@ root - DEBUG - pos: 865, pos_: 0, nbyte: 138, k: 0, byte_offset: -1
root - DEBUG - Trying to Read 512
root - INFO - Reading code 0x200...
root - INFO - Read Corr
root - INFO - success!
Binary file modified examples/data/dolfyn/test_data/RDI_withBT.nc
Binary file not shown.
Binary file modified examples/data/dolfyn/test_data/RiverPro_test01.nc
Binary file not shown.
Binary file modified examples/data/dolfyn/test_data/dat_rdi_bt.mat
Binary file not shown.
Binary file modified examples/data/dolfyn/test_data/dat_vm.mat
Binary file not shown.
Binary file modified examples/data/dolfyn/test_data/vmdas01_wh.nc
Binary file not shown.
Binary file modified examples/data/dolfyn/test_data/vmdas02_os.nc
Binary file not shown.
Binary file modified examples/data/dolfyn/test_data/winriver01.nc
Binary file not shown.
Binary file modified examples/data/dolfyn/test_data/winriver02.nc
Binary file not shown.
Binary file modified examples/data/dolfyn/test_data/winriver02_rotate_ship2earth.nc
Binary file not shown.
Binary file modified examples/data/dolfyn/test_data/winriver02_transect.nc
Binary file not shown.
12 changes: 6 additions & 6 deletions mhkit/acoustics/__init__.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
"""
The passive acoustics module provides a set of functions
for analyzing and visualizing passive acoustic monitoring
for analyzing and visualizing passive acoustic monitoring
data deployed in water bodies. This package reads in raw
*.wav* files and conducts basic acoustics analysis and
*.wav* files and conducts basic acoustics analysis and
visualization.

To start using the module, import it directly from MHKiT:
``from mhkit import acoustics``. The analysis functions
are available directly from the main import, while the
I/O and graphics submodules are available from
are available directly from the main import, while the
I/O and graphics submodules are available from
``acoustics.io`` and ``acoustics.graphics``, respectively.
The base functions are intended to be used on top of the I/O submodule, and
include functionality to calibrate data, create spectral densities, sound
The base functions are intended to be used on top of the I/O submodule, and
include functionality to calibrate data, create spectral densities, sound
pressure levels, and time or band aggregate spectral data.
"""

Expand Down
2 changes: 1 addition & 1 deletion mhkit/acoustics/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ def sound_pressure_spectral_density_level(spsd: xr.DataArray) -> xr.DataArray:


def _validate_method(
method: Union[str, Dict[str, Union[float, int]]]
method: Union[str, Dict[str, Union[float, int]]],
) -> Tuple[str, Optional[Union[float, int]]]:
"""
Validates the 'method' parameter and returns the method name and its argument (if any)
Expand Down
8 changes: 4 additions & 4 deletions mhkit/acoustics/graphics.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
This submodule provides essential plotting functions for visualizing passive acoustics
data. The functions allow for customizable plotting of sound pressure spectral density
This submodule provides essential plotting functions for visualizing passive acoustics
data. The functions allow for customizable plotting of sound pressure spectral density
levels across time and frequency dimensions.

Each plotting function leverages the flexibility of Matplotlib, allowing for passthrough
Expand All @@ -11,12 +11,12 @@
-------------
1. **plot_spectrogram**:

- Generates a spectrogram plot from sound pressure spectral density level data,
- Generates a spectrogram plot from sound pressure spectral density level data,
with a logarithmic frequency scale by default for improved readability of acoustic data.

2. **plot_spectra**:

- Produces a spectral density plot with a log-transformed x-axis, allowing for clear
- Produces a spectral density plot with a log-transformed x-axis, allowing for clear
visualization of spectral density across frequency bands.
"""

Expand Down
18 changes: 9 additions & 9 deletions mhkit/acoustics/io.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
This submodule provides input/output functions for passive acoustics data,
focusing on hydrophone recordings stored in WAV files. The main functionality
includes reading and processing hydrophone data from various manufacturers
includes reading and processing hydrophone data from various manufacturers
and exporting audio files for easy playback and analysis.

Supported Hydrophone Models
Expand All @@ -14,28 +14,28 @@

1. **Data Reading**:

- `read_hydrophone`: Main function to read a WAV file from a hydrophone and
convert it to either a voltage or pressure time series, depending on the
- `read_hydrophone`: Main function to read a WAV file from a hydrophone and
convert it to either a voltage or pressure time series, depending on the
availability of sensitivity data.

- `read_soundtrap`: Wrapper for reading Ocean Instruments SoundTrap hydrophone
- `read_soundtrap`: Wrapper for reading Ocean Instruments SoundTrap hydrophone
files, automatically using appropriate metadata.

- `read_iclisten`: Wrapper for reading Ocean Sonics icListen hydrophone files,
including metadata processing to apply hydrophone sensitivity for direct
- `read_iclisten`: Wrapper for reading Ocean Sonics icListen hydrophone files,
including metadata processing to apply hydrophone sensitivity for direct
sound pressure calculation.

2. **Audio Export**:

- `export_audio`: Converts processed sound pressure data back into a WAV file
- `export_audio`: Converts processed sound pressure data back into a WAV file
format, with optional gain adjustment to improve playback quality.

3. **Data Extraction**:

- `_read_wav_metadata`: Extracts metadata from a WAV file, including bit depth
- `_read_wav_metadata`: Extracts metadata from a WAV file, including bit depth
and other header information.

- `_calculate_voltage_and_time`: Converts raw WAV data into voltage values and
- `_calculate_voltage_and_time`: Converts raw WAV data into voltage values and
generates a time index based on the sampling frequency.
"""

Expand Down
3 changes: 1 addition & 2 deletions mhkit/dolfyn/adv/clean.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Module containing functions to clean data
"""
"""Module containing functions to clean data"""

import warnings
import numpy as np
Expand Down
Loading
Loading