OSOceanAcoustics / echopype

Enabling interoperability and scalability in ocean sonar data analysis
https://echopype.readthedocs.io/
Apache License 2.0
96 stars 72 forks source link

MVBS calculation for AZFP, missing ping_time dimension in Sv Dataset #453

Closed lsetiawan closed 2 years ago

lsetiawan commented 2 years ago

What happened:

ep.calibrate.compute_Sv(echodata) completed with the expected Sv xarray dataset. However, trying to calculate MVBS with ep.preprocess.compute_MVBS, I get a ValueError: Dimensions {'ping_time'} do not exist. Expected one or more of ('range_bin',).

This issue has also been encountered by another person in https://github.com/OSOceanAcoustics/echopype/discussions/440.

What you expected to happen:

I expect this to be able to get me the proper Sv and MVBS dataset.

Minimal Complete Verifiable Example:

from echopype.testing import TEST_DATA_FOLDER

azfp_path = TEST_DATA_FOLDER / "azfp"

filepath, sonar_model, azfp_xml_path = (
    azfp_path / "17082117.01A",
    "AZFP",
    azfp_path / "17041823.XML"
)

echodata = ep.open_raw(
        sonar_model=sonar_model,
        raw_file=filepath,
        xml_path=azfp_xml_path
)

avg_temperature = echodata.environment['temperature'].mean('ping_time').values
env_params = {'temperature': avg_temperature, 'salinity': 27.9, 'pressure': 59}

Sv = ep.calibrate.compute_Sv(echodata, env_params=env_params)

# BELOW WILL ERROR!
MVBS = ep.preprocess.compute_MVBS(Sv)
imranmaj commented 2 years ago

Fixed in #465