From 94ec11066d70f6990161778dc1cf1dd4757bb3ab Mon Sep 17 00:00:00 2001 From: Michael C Ryan Date: Fri, 25 Oct 2024 15:33:18 -0400 Subject: [PATCH 01/34] Added sonar model checkers for EK60, EK80 Future releases of echopype may accommodate cases where the user is not required to provide sonar model numbers. We have here a simple checker to do that. -Added model checkers for EK60 and EK80 sonar models. --- echopype/convert/parse_ek60.py | 17 ++++++++++++++++- echopype/convert/parse_ek80.py | 17 ++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/echopype/convert/parse_ek60.py b/echopype/convert/parse_ek60.py index 88d749ea7..1ba8c2d9b 100644 --- a/echopype/convert/parse_ek60.py +++ b/echopype/convert/parse_ek60.py @@ -1,5 +1,6 @@ from .parse_base import ParseEK - +from .utils.ek_raw_io import RawSimradFile +import numpy as np class ParseEK60(ParseEK): """Class for converting data from Simrad EK60 echosounders.""" @@ -14,3 +15,17 @@ def __init__( **kwargs, ): super().__init__(file, bot_file, idx_file, storage_options, sonar_model) + +def _is_EK60(raw_file, storage_options): + """Parse raw data to check if it is from Simrad EK80 echosounder.""" + with RawSimradFile(raw_file, "r", storage_options=storage_options) as fid: + config_datagram = fid.read(1) + config_datagram["timestamp"] = np.datetime64( + config_datagram["timestamp"].replace(tzinfo=None), "[ns]" + ) + + # Only EK80 files have configuration in self.config_datagram + if config_datagram["sounder_name"] == "ER60" or config_datagram["sounder_name"] == "EK60": + return True + else: + return False diff --git a/echopype/convert/parse_ek80.py b/echopype/convert/parse_ek80.py index 9d3932b3a..79368e755 100644 --- a/echopype/convert/parse_ek80.py +++ b/echopype/convert/parse_ek80.py @@ -1,5 +1,6 @@ from .parse_base import ParseEK - +from .utils.ek_raw_io import RawSimradFile +import numpy as np class ParseEK80(ParseEK): """Class for converting data from Simrad EK80 echosounders.""" @@ -15,3 +16,17 @@ def __init__( ): super().__init__(file, bot_file, idx_file, storage_options, sonar_model) self.environment = {} # dictionary to store environment data + +def is_EK80(raw_file, storage_options): + """Parse raw data to check if it is from Simrad EK80 echosounder.""" + with RawSimradFile(raw_file, "r", storage_options=storage_options) as fid: + config_datagram = fid.read(1) + config_datagram["timestamp"] = np.datetime64( + config_datagram["timestamp"].replace(tzinfo=None), "[ns]" + ) + + # Only EK80 files have configuration in self.config_datagram + if "configuration" in config_datagram: + return True + else: + return False \ No newline at end of file From cae865e4383918c63ab44c97ddcedd6fdb199d5d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 25 Oct 2024 19:47:31 +0000 Subject: [PATCH 02/34] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- echopype/convert/parse_ek60.py | 7 +++++-- echopype/convert/parse_ek80.py | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/echopype/convert/parse_ek60.py b/echopype/convert/parse_ek60.py index 1ba8c2d9b..67a0451e5 100644 --- a/echopype/convert/parse_ek60.py +++ b/echopype/convert/parse_ek60.py @@ -1,6 +1,8 @@ +import numpy as np + from .parse_base import ParseEK from .utils.ek_raw_io import RawSimradFile -import numpy as np + class ParseEK60(ParseEK): """Class for converting data from Simrad EK60 echosounders.""" @@ -15,7 +17,8 @@ def __init__( **kwargs, ): super().__init__(file, bot_file, idx_file, storage_options, sonar_model) - + + def _is_EK60(raw_file, storage_options): """Parse raw data to check if it is from Simrad EK80 echosounder.""" with RawSimradFile(raw_file, "r", storage_options=storage_options) as fid: diff --git a/echopype/convert/parse_ek80.py b/echopype/convert/parse_ek80.py index 79368e755..7f3e8c2bf 100644 --- a/echopype/convert/parse_ek80.py +++ b/echopype/convert/parse_ek80.py @@ -1,6 +1,8 @@ +import numpy as np + from .parse_base import ParseEK from .utils.ek_raw_io import RawSimradFile -import numpy as np + class ParseEK80(ParseEK): """Class for converting data from Simrad EK80 echosounders.""" @@ -17,6 +19,7 @@ def __init__( super().__init__(file, bot_file, idx_file, storage_options, sonar_model) self.environment = {} # dictionary to store environment data + def is_EK80(raw_file, storage_options): """Parse raw data to check if it is from Simrad EK80 echosounder.""" with RawSimradFile(raw_file, "r", storage_options=storage_options) as fid: @@ -29,4 +32,4 @@ def is_EK80(raw_file, storage_options): if "configuration" in config_datagram: return True else: - return False \ No newline at end of file + return False From 2cb262542adf1121721311c841b980540e33b5bc Mon Sep 17 00:00:00 2001 From: Michael C Ryan Date: Fri, 25 Oct 2024 15:53:46 -0400 Subject: [PATCH 03/34] Update parse_ek60.py --- echopype/convert/parse_ek60.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/echopype/convert/parse_ek60.py b/echopype/convert/parse_ek60.py index 67a0451e5..d29dea2bc 100644 --- a/echopype/convert/parse_ek60.py +++ b/echopype/convert/parse_ek60.py @@ -19,7 +19,7 @@ def __init__( super().__init__(file, bot_file, idx_file, storage_options, sonar_model) -def _is_EK60(raw_file, storage_options): +def is_EK60(raw_file, storage_options): """Parse raw data to check if it is from Simrad EK80 echosounder.""" with RawSimradFile(raw_file, "r", storage_options=storage_options) as fid: config_datagram = fid.read(1) From 7bf89a1d56135fb23c7b0a61851ad4ba18381324 Mon Sep 17 00:00:00 2001 From: Michael C Ryan Date: Mon, 28 Oct 2024 10:19:05 -0400 Subject: [PATCH 04/34] Added test cases for EK60 and EK80 model validation Added test cases for EK60 and EK80 raw parser functions to validate their identification of echosounder types through raw data alone. --- echopype/convert/parse_ek60.py | 9 +++------ echopype/convert/parse_ek80.py | 9 +++------ echopype/tests/convert/test_convert_ek60.py | 18 +++++++++++++++++- echopype/tests/convert/test_convert_ek80.py | 12 +++++++++++- 4 files changed, 34 insertions(+), 14 deletions(-) diff --git a/echopype/convert/parse_ek60.py b/echopype/convert/parse_ek60.py index d29dea2bc..ee09f876f 100644 --- a/echopype/convert/parse_ek60.py +++ b/echopype/convert/parse_ek60.py @@ -20,15 +20,12 @@ def __init__( def is_EK60(raw_file, storage_options): - """Parse raw data to check if it is from Simrad EK80 echosounder.""" + """Check if a raw data file is from Simrad EK60 echosounder.""" with RawSimradFile(raw_file, "r", storage_options=storage_options) as fid: config_datagram = fid.read(1) config_datagram["timestamp"] = np.datetime64( config_datagram["timestamp"].replace(tzinfo=None), "[ns]" ) - # Only EK80 files have configuration in self.config_datagram - if config_datagram["sounder_name"] == "ER60" or config_datagram["sounder_name"] == "EK60": - return True - else: - return False + # Return True if the sounder name matches "ER60" or "EK60" + return config_datagram["sounder_name"] in {"ER60", "EK60"} diff --git a/echopype/convert/parse_ek80.py b/echopype/convert/parse_ek80.py index 7f3e8c2bf..66a1695df 100644 --- a/echopype/convert/parse_ek80.py +++ b/echopype/convert/parse_ek80.py @@ -21,15 +21,12 @@ def __init__( def is_EK80(raw_file, storage_options): - """Parse raw data to check if it is from Simrad EK80 echosounder.""" + """Check if a raw data file is from Simrad EK80 echosounder.""" with RawSimradFile(raw_file, "r", storage_options=storage_options) as fid: config_datagram = fid.read(1) config_datagram["timestamp"] = np.datetime64( config_datagram["timestamp"].replace(tzinfo=None), "[ns]" ) - # Only EK80 files have configuration in self.config_datagram - if "configuration" in config_datagram: - return True - else: - return False + # Return True if "configuration" exists in config_datagram + return "configuration" in config_datagram diff --git a/echopype/tests/convert/test_convert_ek60.py b/echopype/tests/convert/test_convert_ek60.py index a77481380..5ad780634 100644 --- a/echopype/tests/convert/test_convert_ek60.py +++ b/echopype/tests/convert/test_convert_ek60.py @@ -6,7 +6,7 @@ import pytest from echopype import open_raw -from echopype.convert import ParseEK60 +from echopype.convert import ParseEK60, is_EK60 @pytest.fixture @@ -264,3 +264,19 @@ def test_converting_ek60_raw_with_missing_channel_power(): # Check that all empty power channels do not exist in the EchoData Beam group for _, empty_power_channel_name in empty_power_chs.items(): assert empty_power_channel_name not in ed["Sonar/Beam_group1"]["channel"] + + +def test_is_EK60_ek60_file(): + # Replace with the path to a valid EK60 test file + test_file_path = "path/to/ek60_test_file.raw" + assert is_EK60(test_file_path, storage_options={}) == True + +def test_is_EK60_er60_file(): + # Replace with the path to a valid ER60 test file + test_file_path = "path/to/er60_test_file.raw" + assert is_EK60(test_file_path, storage_options={}) == True + +def test_is_EK60_non_ek60_file(): + # Replace with the path to a non-EK60/ER60 test file + test_file_path = "path/to/non_ek60_test_file.raw" + assert is_EK60(test_file_path, storage_options={}) == False \ No newline at end of file diff --git a/echopype/tests/convert/test_convert_ek80.py b/echopype/tests/convert/test_convert_ek80.py index c84116c68..bf8b8fa3a 100644 --- a/echopype/tests/convert/test_convert_ek80.py +++ b/echopype/tests/convert/test_convert_ek80.py @@ -7,7 +7,7 @@ from echopype import open_raw, open_converted from echopype.testing import TEST_DATA_FOLDER -from echopype.convert.parse_ek80 import ParseEK80 +from echopype.convert.parse_ek80 import ParseEK80, is_EK80 from echopype.convert.set_groups_ek80 import WIDE_BAND_TRANS, PULSE_COMPRESS, FILTER_IMAG, FILTER_REAL, DECIMATION @@ -531,3 +531,13 @@ def test_parse_ek80_with_invalid_env_datagrams(): env_var = ed["Environment"][var] assert env_var.notnull().all() and env_var.dtype == np.float64 + +def test_is_EK80_ek80_file(): + # Replace with the path to a valid EK80 test file that includes "configuration" + test_file_path = "path/to/ek80_test_file.raw" + assert is_EK80(test_file_path, storage_options={}) == True + +def test_is_EK80_non_ek80_file(): + # Replace with the path to a test file without "configuration" key + test_file_path = "path/to/non_ek80_test_file.raw" + assert is_EK80(test_file_path, storage_options={}) == False \ No newline at end of file From 1affd2d5c221a1f552f3d83c2f0fae4c4a82c36b Mon Sep 17 00:00:00 2001 From: Michael C Ryan Date: Mon, 28 Oct 2024 10:48:06 -0400 Subject: [PATCH 05/34] Fixed the tests. The test failed because a proper path wasn't provided to them. This commit should fix that. --- echopype/tests/convert/test_convert_ek60.py | 4 ++-- echopype/tests/convert/test_convert_ek80.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/echopype/tests/convert/test_convert_ek60.py b/echopype/tests/convert/test_convert_ek60.py index 5ad780634..78b3ff30f 100644 --- a/echopype/tests/convert/test_convert_ek60.py +++ b/echopype/tests/convert/test_convert_ek60.py @@ -273,10 +273,10 @@ def test_is_EK60_ek60_file(): def test_is_EK60_er60_file(): # Replace with the path to a valid ER60 test file - test_file_path = "path/to/er60_test_file.raw" + test_file_path = "echopype/test_data/ek60/L0003-D20040909-T161906-EK60.raw" assert is_EK60(test_file_path, storage_options={}) == True def test_is_EK60_non_ek60_file(): # Replace with the path to a non-EK60/ER60 test file - test_file_path = "path/to/non_ek60_test_file.raw" + test_file_path = "echopype/test_data/ek80/D20170912-T234910.raw" assert is_EK60(test_file_path, storage_options={}) == False \ No newline at end of file diff --git a/echopype/tests/convert/test_convert_ek80.py b/echopype/tests/convert/test_convert_ek80.py index bf8b8fa3a..fe9001401 100644 --- a/echopype/tests/convert/test_convert_ek80.py +++ b/echopype/tests/convert/test_convert_ek80.py @@ -534,10 +534,10 @@ def test_parse_ek80_with_invalid_env_datagrams(): def test_is_EK80_ek80_file(): # Replace with the path to a valid EK80 test file that includes "configuration" - test_file_path = "path/to/ek80_test_file.raw" + test_file_path = "echopype/test_data/ek80/D20170912-T234910.raw" assert is_EK80(test_file_path, storage_options={}) == True def test_is_EK80_non_ek80_file(): # Replace with the path to a test file without "configuration" key - test_file_path = "path/to/non_ek80_test_file.raw" + test_file_path = "echopype/test_data/ek60/L0003-D20040909-T161906-EK60.raw" assert is_EK80(test_file_path, storage_options={}) == False \ No newline at end of file From 2abe8be1d4658cc005a801220e7a8f2529443251 Mon Sep 17 00:00:00 2001 From: Michael C Ryan Date: Mon, 28 Oct 2024 10:58:38 -0400 Subject: [PATCH 06/34] Fixed an import error I forgot to import the outside-of-class functions in the __init__. Consider this fixed. --- echopype/convert/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/echopype/convert/__init__.py b/echopype/convert/__init__.py index 78c4e2859..b8f6b6520 100644 --- a/echopype/convert/__init__.py +++ b/echopype/convert/__init__.py @@ -14,8 +14,8 @@ from .parse_azfp import ParseAZFP from .parse_azfp6 import ParseAZFP6 from .parse_base import ParseBase -from .parse_ek60 import ParseEK60 -from .parse_ek80 import ParseEK80 +from .parse_ek60 import ParseEK60, is_EK60 +from .parse_ek80 import ParseEK80, is_EK80 from .set_groups_ad2cp import SetGroupsAd2cp from .set_groups_azfp import SetGroupsAZFP from .set_groups_azfp6 import SetGroupsAZFP6 From fa7dc1c9615429bfd29b965ea32e38abff436dd2 Mon Sep 17 00:00:00 2001 From: Michael C Ryan Date: Mon, 28 Oct 2024 11:34:16 -0400 Subject: [PATCH 07/34] Test fix + Update to documentation for Docker and sudo privileges - Added notes about the potential need to remove sudo privileges for some users. - Improved tests by adding an exception handler for key errors, returning False when encountered. --- docs/source/contributing.md | 18 +++++++++++++++++- echopype/convert/parse_ek60.py | 7 +++++-- echopype/tests/convert/test_convert_ek60.py | 2 +- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/docs/source/contributing.md b/docs/source/contributing.md index 7fca175f4..dd0d72d6e 100644 --- a/docs/source/contributing.md +++ b/docs/source/contributing.md @@ -81,7 +81,23 @@ One can replace `conda` with `mamba` in the above commands when creating the env Currently, test data are stored in a private Google Drive folder and made available via the [`cormorack/http`](https://hub.docker.com/r/cormorack/http) -Docker image on Docker hub. +Docker image on Docker hub. There’s no need to pull directly from Docker Hub, as the scripts below will handle that for you. For Linux Users: If you run into an issue where accessing the Docker daemon requires sudo privileges, which may not suit your environment, you can adjust your settings to allow non-root access to Docker: + +```shell +sudo groupadd docker +``` + +Add the current user to the Docker group +```shell +sudo gpasswd -a $USER docker +``` + +Restart the docker daemon +```shell +sudo service docker restart +``` + +You might also need to restart your computer if the steps above don't resolve the issue. The image is rebuilt daily when new test data are added. If your tests require adding new test data, ping the maintainers (@leewujung, @ctuguinay) to get them added to the the Google Drive. diff --git a/echopype/convert/parse_ek60.py b/echopype/convert/parse_ek60.py index ee09f876f..2fb0089fe 100644 --- a/echopype/convert/parse_ek60.py +++ b/echopype/convert/parse_ek60.py @@ -27,5 +27,8 @@ def is_EK60(raw_file, storage_options): config_datagram["timestamp"].replace(tzinfo=None), "[ns]" ) - # Return True if the sounder name matches "ER60" or "EK60" - return config_datagram["sounder_name"] in {"ER60", "EK60"} + try: + # Return True if the sounder name matches "ER60" or "EK60" + return config_datagram["sounder_name"] in {"ER60", "EK60"} + except KeyError as e: + False diff --git a/echopype/tests/convert/test_convert_ek60.py b/echopype/tests/convert/test_convert_ek60.py index 78b3ff30f..6336134bf 100644 --- a/echopype/tests/convert/test_convert_ek60.py +++ b/echopype/tests/convert/test_convert_ek60.py @@ -268,7 +268,7 @@ def test_converting_ek60_raw_with_missing_channel_power(): def test_is_EK60_ek60_file(): # Replace with the path to a valid EK60 test file - test_file_path = "path/to/ek60_test_file.raw" + test_file_path = "echopype/test_data/ek60/L0003-D20040909-T161906-EK60.raw" assert is_EK60(test_file_path, storage_options={}) == True def test_is_EK60_er60_file(): From adb51112696e22c5fddcdbb3e2b5855332fdf471 Mon Sep 17 00:00:00 2001 From: Michael C Ryan Date: Mon, 28 Oct 2024 11:40:42 -0400 Subject: [PATCH 08/34] Update parse_ek60.py Syntax error fixed. --- echopype/convert/parse_ek60.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/echopype/convert/parse_ek60.py b/echopype/convert/parse_ek60.py index 2fb0089fe..44a06fa08 100644 --- a/echopype/convert/parse_ek60.py +++ b/echopype/convert/parse_ek60.py @@ -31,4 +31,4 @@ def is_EK60(raw_file, storage_options): # Return True if the sounder name matches "ER60" or "EK60" return config_datagram["sounder_name"] in {"ER60", "EK60"} except KeyError as e: - False + return False From 8967c3e45f9f173b2aaa12c92caeb01b937a9a29 Mon Sep 17 00:00:00 2001 From: Michael C Ryan Date: Mon, 28 Oct 2024 11:52:36 -0400 Subject: [PATCH 09/34] Refactor error handling: Removed unnecessary 'e' variable The 'e' variable commonly used in error handling was not utilized, so I removed it. This change caused tests to fail, prompting its removal. --- echopype/convert/parse_ek60.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/echopype/convert/parse_ek60.py b/echopype/convert/parse_ek60.py index 44a06fa08..eb97b79be 100644 --- a/echopype/convert/parse_ek60.py +++ b/echopype/convert/parse_ek60.py @@ -30,5 +30,5 @@ def is_EK60(raw_file, storage_options): try: # Return True if the sounder name matches "ER60" or "EK60" return config_datagram["sounder_name"] in {"ER60", "EK60"} - except KeyError as e: + except KeyError: return False From 907424daba6255afe9fcf6a65c838e989817cd3f Mon Sep 17 00:00:00 2001 From: Michael C Ryan Date: Thu, 31 Oct 2024 09:36:45 -0400 Subject: [PATCH 10/34] Made tests better so that they run through all test files in the test file directory. For EK60 only. --- echopype/tests/convert/test_convert_ek60.py | 35 +++++++++++++-------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/echopype/tests/convert/test_convert_ek60.py b/echopype/tests/convert/test_convert_ek60.py index 6336134bf..7909aa456 100644 --- a/echopype/tests/convert/test_convert_ek60.py +++ b/echopype/tests/convert/test_convert_ek60.py @@ -1,5 +1,5 @@ import warnings - +import glob import numpy as np import pandas as pd from scipy.io import loadmat @@ -266,17 +266,26 @@ def test_converting_ek60_raw_with_missing_channel_power(): assert empty_power_channel_name not in ed["Sonar/Beam_group1"]["channel"] -def test_is_EK60_ek60_file(): - # Replace with the path to a valid EK60 test file - test_file_path = "echopype/test_data/ek60/L0003-D20040909-T161906-EK60.raw" - assert is_EK60(test_file_path, storage_options={}) == True +def test_is_EK60_ek60_files(): + # Collect all .raw files in the ek60 directory + ek60_files = glob.glob("echopype/test_data/ek60/*.raw") + + # Check that each file in ek60 is identified as EK60 + for test_file_path in ek60_files: + assert is_EK60(test_file_path, storage_options={}) == True -def test_is_EK60_er60_file(): - # Replace with the path to a valid ER60 test file - test_file_path = "echopype/test_data/ek60/L0003-D20040909-T161906-EK60.raw" - assert is_EK60(test_file_path, storage_options={}) == True +def test_is_EK60_er60_files(): + # Collect all .raw files in the ek60 directory (assuming ER60 files are also here) + er60_files = glob.glob("echopype/test_data/ek60/*.raw") + + # Check that each file in ek60 is identified as EK60 + for test_file_path in er60_files: + assert is_EK60(test_file_path, storage_options={}) == True -def test_is_EK60_non_ek60_file(): - # Replace with the path to a non-EK60/ER60 test file - test_file_path = "echopype/test_data/ek80/D20170912-T234910.raw" - assert is_EK60(test_file_path, storage_options={}) == False \ No newline at end of file +def test_is_EK60_non_ek60_files(): + # Collect all .raw files in the ek80 directory (non-EK60 files) + ek80_files = glob.glob("echopype/test_data/ek80/*.raw") + + # Check that each file in ek80 is not identified as EK60 + for test_file_path in ek80_files: + assert is_EK60(test_file_path, storage_options={}) == False \ No newline at end of file From 8a2517d52d1190cf58436fb43fcc9e533fa03368 Mon Sep 17 00:00:00 2001 From: Michael C Ryan Date: Thu, 31 Oct 2024 09:51:51 -0400 Subject: [PATCH 11/34] Added better tests for ek80 checker functions. Added better tests for ek80 checker functions. --- echopype/tests/convert/test_convert_ek60.py | 3 +++ echopype/tests/convert/test_convert_ek80.py | 28 +++++++++++++-------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/echopype/tests/convert/test_convert_ek60.py b/echopype/tests/convert/test_convert_ek60.py index 7909aa456..1a4c2f681 100644 --- a/echopype/tests/convert/test_convert_ek60.py +++ b/echopype/tests/convert/test_convert_ek60.py @@ -267,6 +267,7 @@ def test_converting_ek60_raw_with_missing_channel_power(): def test_is_EK60_ek60_files(): + """Check that EK60 files are identified as EK60""" # Collect all .raw files in the ek60 directory ek60_files = glob.glob("echopype/test_data/ek60/*.raw") @@ -275,6 +276,7 @@ def test_is_EK60_ek60_files(): assert is_EK60(test_file_path, storage_options={}) == True def test_is_EK60_er60_files(): + """Check that ER60 files are identified as EK60""" # Collect all .raw files in the ek60 directory (assuming ER60 files are also here) er60_files = glob.glob("echopype/test_data/ek60/*.raw") @@ -283,6 +285,7 @@ def test_is_EK60_er60_files(): assert is_EK60(test_file_path, storage_options={}) == True def test_is_EK60_non_ek60_files(): + """Check that non-EK60 files are not identified as EK60""" # Collect all .raw files in the ek80 directory (non-EK60 files) ek80_files = glob.glob("echopype/test_data/ek80/*.raw") diff --git a/echopype/tests/convert/test_convert_ek80.py b/echopype/tests/convert/test_convert_ek80.py index fe9001401..c76862c52 100644 --- a/echopype/tests/convert/test_convert_ek80.py +++ b/echopype/tests/convert/test_convert_ek80.py @@ -1,5 +1,5 @@ import shutil - +import glob import pytest import numpy as np import pandas as pd @@ -532,12 +532,20 @@ def test_parse_ek80_with_invalid_env_datagrams(): assert env_var.notnull().all() and env_var.dtype == np.float64 -def test_is_EK80_ek80_file(): - # Replace with the path to a valid EK80 test file that includes "configuration" - test_file_path = "echopype/test_data/ek80/D20170912-T234910.raw" - assert is_EK80(test_file_path, storage_options={}) == True - -def test_is_EK80_non_ek80_file(): - # Replace with the path to a test file without "configuration" key - test_file_path = "echopype/test_data/ek60/L0003-D20040909-T161906-EK60.raw" - assert is_EK80(test_file_path, storage_options={}) == False \ No newline at end of file +def test_is_EK80_ek80_files(): + """Test that EK80 files are identified as EK80.""" + # Collect all .raw files in the ek80 directory + ek80_files = glob.glob("echopype/test_data/ek80/*.raw") + + # Check that each file in ek80 is identified as EK80 + for test_file_path in ek80_files: + assert is_EK80(test_file_path, storage_options={}) == True + +def test_is_EK80_non_ek80_files(): + """Test that non-EK80 files are not identified as EK80.""" + # Collect all .raw files in the ek60 directory (non-EK80 files) + ek60_files = glob.glob("echopype/test_data/ek60/*.raw") + + # Check that each file in ek60 is not identified as EK80 + for test_file_path in ek60_files: + assert is_EK80(test_file_path, storage_options={}) == False \ No newline at end of file From 01ceb52b0685077218a5a31cff5adba670f60f62 Mon Sep 17 00:00:00 2001 From: Michael C Ryan Date: Thu, 31 Oct 2024 15:31:59 -0400 Subject: [PATCH 12/34] Added the rest of the sonar checkers. Added the rest of the sonar checkers. --- echopype/convert/parse_ad2cp.py | 22 +++++++++++++++++++++ echopype/convert/parse_azfp.py | 34 +++++++++++++++++++++++++++++++++ echopype/convert/parse_azfp6.py | 22 +++++++++++++++++++++ 3 files changed, 78 insertions(+) diff --git a/echopype/convert/parse_ad2cp.py b/echopype/convert/parse_ad2cp.py index 51ebc9848..27fac68e6 100644 --- a/echopype/convert/parse_ad2cp.py +++ b/echopype/convert/parse_ad2cp.py @@ -1853,3 +1853,25 @@ def data_record_format(cls, data_record_type: DataRecordType) -> HeaderOrDataRec DataRecordType.ECHOSOUNDER_RAW_TRANSMIT: ECHOSOUNDER_RAW_DATA_RECORD_FORMAT, DataRecordType.STRING: STRING_DATA_RECORD_FORMAT, } + + +def is_AD2CP(raw_file): + """ + Check if the provided file has a .ad2cp extension. + + Parameters: + raw_file (str): The name of the file to check. + + Returns: + bool: True if the file has a .ad2cp extension, False otherwise. + """ + + # Check if the input is a string + if not isinstance(raw_file, str): + return False # Return False if the input is not a string + + # Use the str.lower() method to check for the .ad2cp extension + has_ad2cp_extension = raw_file.lower().endswith('.ad2cp') + + # Return the result of the check + return has_ad2cp_extension \ No newline at end of file diff --git a/echopype/convert/parse_azfp.py b/echopype/convert/parse_azfp.py index 1e307ab9e..b5f9254b5 100644 --- a/echopype/convert/parse_azfp.py +++ b/echopype/convert/parse_azfp.py @@ -570,3 +570,37 @@ def _calc_Sv_offset(freq, pulse_len): ) return SV_OFFSET[freq][pulse_len] + +def is_AZFP(raw_file): + """ + Check if the specified XML file contains an with string="AZFP". + + Parameters: + raw_file (str): The base name of the XML file (with or without extension). + + Returns: + bool: True if with string="AZFP" is found, False otherwise. + """ + + + # Check if the filename ends with .xml or .XML, and strip the extension if it does + base_filename = raw_file.rstrip('.xml').rstrip('.XML') + + # Create a list of possible filenames with both extensions + possible_files = [f"{base_filename}.xml", f"{base_filename}.XML"] + + for full_filename in possible_files: + if os.path.isfile(full_filename): + try: + # Parse the XML file + tree = ET.parse(full_filename) + root = tree.getroot() + + # Check for elements + for instrument in root.findall('.//InstrumentType'): + if instrument.get('string') == 'AZFP': + return True + except ET.ParseError: + print(f"Error parsing the XML file: {full_filename}.") + + return False \ No newline at end of file diff --git a/echopype/convert/parse_azfp6.py b/echopype/convert/parse_azfp6.py index aa98eca55..a7313aad7 100644 --- a/echopype/convert/parse_azfp6.py +++ b/echopype/convert/parse_azfp6.py @@ -689,3 +689,25 @@ def _calc_Sv_offset(freq, pulse_len): ) return SV_OFFSET[freq][pulse_len] + + +def is_AZFP6(raw_file): + """ + Check if the provided file has a .azfp extension. + + Parameters: + raw_file (str): The name of the file to check. + + Returns: + bool: True if the file has a .azfp extension, False otherwise. + """ + + # Check if the input is a string + if not isinstance(raw_file, str): + return False # Return False if the input is not a string + + # Use the str.lower() method to check for the .azfp extension + has_azfp_extension = raw_file.lower().endswith('.azfp') + + # Return the result of the check + return has_azfp_extension \ No newline at end of file From 05345893aedc582c39f485bdc3a87f6a97274254 Mon Sep 17 00:00:00 2001 From: Michael C Ryan Date: Fri, 1 Nov 2024 09:44:06 -0400 Subject: [PATCH 13/34] Update test_convert_azfp6.py --- echopype/tests/convert/test_convert_azfp6.py | 24 ++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/echopype/tests/convert/test_convert_azfp6.py b/echopype/tests/convert/test_convert_azfp6.py index 29122a0bb..4ec705ca5 100644 --- a/echopype/tests/convert/test_convert_azfp6.py +++ b/echopype/tests/convert/test_convert_azfp6.py @@ -4,14 +4,14 @@ - verify echopype converted files against those from AZFP Matlab scripts and EchoView - convert AZFP file with different range settings across frequency """ - +import glob import numpy as np import pandas as pd from datetime import datetime, timedelta from scipy.io import loadmat from echopype import open_raw import pytest -from echopype.convert.parse_azfp6 import ParseAZFP6 +from echopype.convert.parse_azfp6 import ParseAZFP6, is_AZFP6 @pytest.fixture @@ -166,3 +166,23 @@ def test_convert_azfp_02a_gps_lat_long(azfp_path): ) check_platform_required_scalar_vars(echodata) + + + +def test_is_AZFP6_valid_files(): + """Test that .azfp files are identified as valid AZFP files.""" + # Collect all .azfp files in the test directory + azfp_files = glob.glob("echopype/test_data/azfp6/*.azfp") + + # Check that each file in azfp is identified as valid AZFP + for test_file_path in azfp_files: + assert is_AZFP6(test_file_path) == True + +def test_is_AZFP6_invalid_files(): + """Test that non-.azfp files are not identified as valid AZFP files.""" + # Collect all non-.azfp files in the test directory + non_azfp_files = glob.glob("echopype/test_data/azfp/*") + + # Check that each file in non_azfp is not identified as valid AZFP + for test_file_path in non_azfp_files: + assert is_AZFP6(test_file_path) == False \ No newline at end of file From 853d01b5caede2db4b22a3b110e1f71ad85e57fe Mon Sep 17 00:00:00 2001 From: Michael C Ryan Date: Fri, 1 Nov 2024 09:48:48 -0400 Subject: [PATCH 14/34] Added more tests Added more tests for azfp and ad2cp. --- echopype/tests/convert/test_convert_ad2cp.py | 21 ++++++++++++++++++++ echopype/tests/convert/test_convert_azfp.py | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/echopype/tests/convert/test_convert_ad2cp.py b/echopype/tests/convert/test_convert_ad2cp.py index bf7656f16..a92b49425 100644 --- a/echopype/tests/convert/test_convert_ad2cp.py +++ b/echopype/tests/convert/test_convert_ad2cp.py @@ -12,10 +12,12 @@ import pytest from tempfile import TemporaryDirectory from pathlib import Path +import glob from echopype import open_raw, open_converted from echopype.testing import TEST_DATA_FOLDER +from echopype.convert.parse_ad2cp import is_AD2CP @pytest.fixture def ocean_contour_export_dir(test_path): @@ -260,3 +262,22 @@ def _check_raw_output( atol=absolute_tolerance, ) base.close() + + +def test_is_AD2CP_valid_files(): + """Test that .ad2cp files are identified as valid AD2CP files.""" + # Collect all .ad2cp files in the test directory + ad2cp_files = glob.glob("test_data/ad2cp/*.ad2cp") + + # Check that each file in ad2cp is identified as valid AD2CP + for test_file_path in ad2cp_files: + assert is_AD2CP(test_file_path) == True + +def test_is_AD2CP_invalid_files(): + """Test that non-.ad2cp files are not identified as valid AD2CP files.""" + # Collect all non-.ad2cp files in the test directory + non_ad2cp_files = glob.glob("echopype/test_data/azfp6/*") + + # Check that each file in non_ad2cp is not identified as valid AD2CP + for test_file_path in non_ad2cp_files: + assert is_AD2CP(test_file_path) == False \ No newline at end of file diff --git a/echopype/tests/convert/test_convert_azfp.py b/echopype/tests/convert/test_convert_azfp.py index f0a0451b9..6961539ac 100644 --- a/echopype/tests/convert/test_convert_azfp.py +++ b/echopype/tests/convert/test_convert_azfp.py @@ -10,7 +10,7 @@ from scipy.io import loadmat from echopype import open_raw import pytest -from echopype.convert.parse_azfp import ParseAZFP +from echopype.convert.parse_azfp import ParseAZFP, is_AZFP @pytest.fixture From d3467f5c57f6b171c1ee215088f8b54476af8fc2 Mon Sep 17 00:00:00 2001 From: Michael C Ryan Date: Fri, 1 Nov 2024 09:55:31 -0400 Subject: [PATCH 15/34] Update test_convert_azfp.py --- echopype/tests/convert/test_convert_azfp.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/echopype/tests/convert/test_convert_azfp.py b/echopype/tests/convert/test_convert_azfp.py index 6961539ac..6767de13e 100644 --- a/echopype/tests/convert/test_convert_azfp.py +++ b/echopype/tests/convert/test_convert_azfp.py @@ -4,6 +4,8 @@ - verify echopype converted files against those from AZFP Matlab scripts and EchoView - convert AZFP file with different range settings across frequency """ +import xml.etree.ElementTree as ET +import glob import numpy as np import pandas as pd @@ -263,3 +265,21 @@ def test_load_parse_azfp_xml(azfp_path): assert parseAZFP.parameters['pulse_len_phase2'] == [0, 0, 0, 0] assert parseAZFP.parameters['range_samples_phase1'] == [8273, 8273, 8273, 8273] assert parseAZFP.parameters['range_samples_phase2'] == [2750, 2750, 2750, 2750] + + + +def test_is_AZFP_valid_files(): + """Test that XML files with are identified as valid AZFP files.""" + # Collect all valid XML files in the test directory + valid_files = glob.glob("echopype/test_data/azfp/*.xml") + glob.glob("test_data/azfp/*.XML") + + for test_file_path in valid_files: + assert is_AZFP(test_file_path) == True + +def test_is_AZFP_invalid_files(): + """Test that XML files without are not identified as valid AZFP files.""" + # Collect all invalid XML files in the test directory + invalid_files = glob.glob("echopype/test_data/azfp6/*") + + for test_file_path in invalid_files: + assert is_AZFP(test_file_path) == False \ No newline at end of file From bf73faacd8c72ff8165bd2bcf01fb37a5c868da9 Mon Sep 17 00:00:00 2001 From: Michael C Ryan Date: Fri, 1 Nov 2024 10:25:22 -0400 Subject: [PATCH 16/34] Corrected some tests. Updated tests. --- echopype/convert/parse_ek60.py | 19 ++++++++++++++++++- echopype/tests/convert/test_convert_ad2cp.py | 2 +- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/echopype/convert/parse_ek60.py b/echopype/convert/parse_ek60.py index 88d749ea7..0758033bd 100644 --- a/echopype/convert/parse_ek60.py +++ b/echopype/convert/parse_ek60.py @@ -1,5 +1,7 @@ -from .parse_base import ParseEK +import numpy as np +from .parse_base import ParseEK +from .utils.ek_raw_io import RawSimradFile class ParseEK60(ParseEK): """Class for converting data from Simrad EK60 echosounders.""" @@ -14,3 +16,18 @@ def __init__( **kwargs, ): super().__init__(file, bot_file, idx_file, storage_options, sonar_model) + + +def is_ER60(raw_file, storage_options): + """Check if a raw data file is from Simrad EK60 echosounder.""" + with RawSimradFile(raw_file, "r", storage_options=storage_options) as fid: + config_datagram = fid.read(1) + config_datagram["timestamp"] = np.datetime64( + config_datagram["timestamp"].replace(tzinfo=None), "[ns]" + ) + + try: + # Return True if the sounder name matches "ER60" or "EK60" + return config_datagram["sounder_name"] in {"ER60"} + except KeyError: + return False \ No newline at end of file diff --git a/echopype/tests/convert/test_convert_ad2cp.py b/echopype/tests/convert/test_convert_ad2cp.py index a92b49425..1a737e9d7 100644 --- a/echopype/tests/convert/test_convert_ad2cp.py +++ b/echopype/tests/convert/test_convert_ad2cp.py @@ -267,7 +267,7 @@ def _check_raw_output( def test_is_AD2CP_valid_files(): """Test that .ad2cp files are identified as valid AD2CP files.""" # Collect all .ad2cp files in the test directory - ad2cp_files = glob.glob("test_data/ad2cp/*.ad2cp") + ad2cp_files = glob.glob("echopype/test_data/ad2cp/normal/*.ad2cp") # Check that each file in ad2cp is identified as valid AD2CP for test_file_path in ad2cp_files: From 4db7dd50254cb0d224f73464b40792dc97d525e9 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 1 Nov 2024 14:31:04 +0000 Subject: [PATCH 17/34] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- echopype/convert/parse_ad2cp.py | 8 ++++---- echopype/convert/parse_azfp.py | 16 ++++++++-------- echopype/convert/parse_azfp6.py | 8 ++++---- echopype/convert/parse_ek60.py | 6 ------ 4 files changed, 16 insertions(+), 22 deletions(-) diff --git a/echopype/convert/parse_ad2cp.py b/echopype/convert/parse_ad2cp.py index 27fac68e6..b7815f8de 100644 --- a/echopype/convert/parse_ad2cp.py +++ b/echopype/convert/parse_ad2cp.py @@ -1865,13 +1865,13 @@ def is_AD2CP(raw_file): Returns: bool: True if the file has a .ad2cp extension, False otherwise. """ - + # Check if the input is a string if not isinstance(raw_file, str): return False # Return False if the input is not a string - + # Use the str.lower() method to check for the .ad2cp extension - has_ad2cp_extension = raw_file.lower().endswith('.ad2cp') + has_ad2cp_extension = raw_file.lower().endswith(".ad2cp") # Return the result of the check - return has_ad2cp_extension \ No newline at end of file + return has_ad2cp_extension diff --git a/echopype/convert/parse_azfp.py b/echopype/convert/parse_azfp.py index b5f9254b5..445866c18 100644 --- a/echopype/convert/parse_azfp.py +++ b/echopype/convert/parse_azfp.py @@ -571,6 +571,7 @@ def _calc_Sv_offset(freq, pulse_len): return SV_OFFSET[freq][pulse_len] + def is_AZFP(raw_file): """ Check if the specified XML file contains an with string="AZFP". @@ -582,25 +583,24 @@ def is_AZFP(raw_file): bool: True if with string="AZFP" is found, False otherwise. """ - # Check if the filename ends with .xml or .XML, and strip the extension if it does - base_filename = raw_file.rstrip('.xml').rstrip('.XML') + base_filename = raw_file.rstrip(".xml").rstrip(".XML") # Create a list of possible filenames with both extensions possible_files = [f"{base_filename}.xml", f"{base_filename}.XML"] - + for full_filename in possible_files: if os.path.isfile(full_filename): try: # Parse the XML file tree = ET.parse(full_filename) root = tree.getroot() - + # Check for elements - for instrument in root.findall('.//InstrumentType'): - if instrument.get('string') == 'AZFP': + for instrument in root.findall(".//InstrumentType"): + if instrument.get("string") == "AZFP": return True except ET.ParseError: print(f"Error parsing the XML file: {full_filename}.") - - return False \ No newline at end of file + + return False diff --git a/echopype/convert/parse_azfp6.py b/echopype/convert/parse_azfp6.py index a7313aad7..9a6af7fdf 100644 --- a/echopype/convert/parse_azfp6.py +++ b/echopype/convert/parse_azfp6.py @@ -701,13 +701,13 @@ def is_AZFP6(raw_file): Returns: bool: True if the file has a .azfp extension, False otherwise. """ - + # Check if the input is a string if not isinstance(raw_file, str): return False # Return False if the input is not a string - + # Use the str.lower() method to check for the .azfp extension - has_azfp_extension = raw_file.lower().endswith('.azfp') + has_azfp_extension = raw_file.lower().endswith(".azfp") # Return the result of the check - return has_azfp_extension \ No newline at end of file + return has_azfp_extension diff --git a/echopype/convert/parse_ek60.py b/echopype/convert/parse_ek60.py index ccb954335..adf06468a 100644 --- a/echopype/convert/parse_ek60.py +++ b/echopype/convert/parse_ek60.py @@ -1,11 +1,9 @@ import numpy as np - from .parse_base import ParseEK from .utils.ek_raw_io import RawSimradFile - class ParseEK60(ParseEK): """Class for converting data from Simrad EK60 echosounders.""" @@ -21,7 +19,6 @@ def __init__( super().__init__(file, bot_file, idx_file, storage_options, sonar_model) - def is_ER60(raw_file, storage_options): """Check if a raw data file is from Simrad EK60 echosounder.""" with RawSimradFile(raw_file, "r", storage_options=storage_options) as fid: @@ -36,9 +33,7 @@ def is_ER60(raw_file, storage_options): return False - def is_EK60(raw_file, storage_options): - """Check if a raw data file is from Simrad EK60 echosounder.""" with RawSimradFile(raw_file, "r", storage_options=storage_options) as fid: config_datagram = fid.read(1) @@ -51,4 +46,3 @@ def is_EK60(raw_file, storage_options): return config_datagram["sounder_name"] in {"EK60"} except KeyError: return False - From 9929523aab0ecfd8369300548ffb7f73d7ac1cbd Mon Sep 17 00:00:00 2001 From: Michael C Ryan Date: Fri, 1 Nov 2024 10:36:15 -0400 Subject: [PATCH 18/34] Needed some fixes for the merge. Sorry about that. --- echopype/convert/parse_ad2cp.py | 1 + echopype/convert/parse_azfp6.py | 22 ++++++++++++++++++++ echopype/tests/convert/test_convert_ad2cp.py | 3 ++- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/echopype/convert/parse_ad2cp.py b/echopype/convert/parse_ad2cp.py index 27fac68e6..062a856f8 100644 --- a/echopype/convert/parse_ad2cp.py +++ b/echopype/convert/parse_ad2cp.py @@ -8,6 +8,7 @@ from .parse_base import ParseBase + @unique class BurstAverageDataRecordVersion(Enum): """ diff --git a/echopype/convert/parse_azfp6.py b/echopype/convert/parse_azfp6.py index a7313aad7..0008bc1af 100644 --- a/echopype/convert/parse_azfp6.py +++ b/echopype/convert/parse_azfp6.py @@ -691,6 +691,28 @@ def _calc_Sv_offset(freq, pulse_len): return SV_OFFSET[freq][pulse_len] +def is_AZFP6(raw_file): + """ + Check if the provided file has a .azfp extension. + + Parameters: + raw_file (str): The name of the file to check. + + Returns: + bool: True if the file has a .azfp extension, False otherwise. + """ + + # Check if the input is a string + if not isinstance(raw_file, str): + return False # Return False if the input is not a string + + # Use the str.lower() method to check for the .azfp extension + has_azfp_extension = raw_file.lower().endswith('.azfp') + + # Return the result of the check + return has_azfp_extension + + def is_AZFP6(raw_file): """ Check if the provided file has a .azfp extension. diff --git a/echopype/tests/convert/test_convert_ad2cp.py b/echopype/tests/convert/test_convert_ad2cp.py index 1a737e9d7..262e95c05 100644 --- a/echopype/tests/convert/test_convert_ad2cp.py +++ b/echopype/tests/convert/test_convert_ad2cp.py @@ -4,7 +4,8 @@ Files under "normal" contain default data variables, whereas files under "raw" additionally contain the IQ samples. """ - +import glob +from echopype.convert import is_AD2CP import xarray as xr import numpy as np From d128ff70e01f99646a7ea72fd70b68e7992cc051 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 1 Nov 2024 14:39:10 +0000 Subject: [PATCH 19/34] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- echopype/convert/parse_ad2cp.py | 1 - 1 file changed, 1 deletion(-) diff --git a/echopype/convert/parse_ad2cp.py b/echopype/convert/parse_ad2cp.py index 715e2eca4..b7815f8de 100644 --- a/echopype/convert/parse_ad2cp.py +++ b/echopype/convert/parse_ad2cp.py @@ -8,7 +8,6 @@ from .parse_base import ParseBase - @unique class BurstAverageDataRecordVersion(Enum): """ From 48d9d6b41b8220035956ad7d661c548ea6f07410 Mon Sep 17 00:00:00 2001 From: Michael C Ryan Date: Fri, 1 Nov 2024 10:47:55 -0400 Subject: [PATCH 20/34] More merge fixes. More merge fixes. --- echopype/convert/parse_ek60.py | 4 +-- echopype/tests/convert/test_convert_azfp.py | 2 +- echopype/tests/convert/test_convert_ek60.py | 29 ++++++++++++++------- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/echopype/convert/parse_ek60.py b/echopype/convert/parse_ek60.py index adf06468a..6a397256d 100644 --- a/echopype/convert/parse_ek60.py +++ b/echopype/convert/parse_ek60.py @@ -28,7 +28,7 @@ def is_ER60(raw_file, storage_options): ) # Return True if the sounder name matches "ER60" try: - return config_datagram["sounder_name"] in {"ER60"} + return config_datagram["sounder_name"] in {"ER60", "EK60"} except KeyError: return False @@ -43,6 +43,6 @@ def is_EK60(raw_file, storage_options): try: # Return True if the sounder name matches "EK60" - return config_datagram["sounder_name"] in {"EK60"} + return config_datagram["sounder_name"] in {"ER60", "EK60"} except KeyError: return False diff --git a/echopype/tests/convert/test_convert_azfp.py b/echopype/tests/convert/test_convert_azfp.py index 6767de13e..b2f4d43d8 100644 --- a/echopype/tests/convert/test_convert_azfp.py +++ b/echopype/tests/convert/test_convert_azfp.py @@ -271,7 +271,7 @@ def test_load_parse_azfp_xml(azfp_path): def test_is_AZFP_valid_files(): """Test that XML files with are identified as valid AZFP files.""" # Collect all valid XML files in the test directory - valid_files = glob.glob("echopype/test_data/azfp/*.xml") + glob.glob("test_data/azfp/*.XML") + valid_files = glob.glob("echopype/test_data/azfp/*.xml") + glob.glob("echopype/test_data/azfp/*.XML") for test_file_path in valid_files: assert is_AZFP(test_file_path) == True diff --git a/echopype/tests/convert/test_convert_ek60.py b/echopype/tests/convert/test_convert_ek60.py index 1a4c2f681..9b318b00a 100644 --- a/echopype/tests/convert/test_convert_ek60.py +++ b/echopype/tests/convert/test_convert_ek60.py @@ -6,7 +6,7 @@ import pytest from echopype import open_raw -from echopype.convert import ParseEK60, is_EK60 +from echopype.convert import ParseEK60, is_EK60, is_ER60 @pytest.fixture @@ -269,26 +269,35 @@ def test_converting_ek60_raw_with_missing_channel_power(): def test_is_EK60_ek60_files(): """Check that EK60 files are identified as EK60""" # Collect all .raw files in the ek60 directory - ek60_files = glob.glob("echopype/test_data/ek60/*.raw") + ek60_files = glob.glob("echopype/test_data/ek60/from_echopy/*.raw") # Check that each file in ek60 is identified as EK60 for test_file_path in ek60_files: assert is_EK60(test_file_path, storage_options={}) == True -def test_is_EK60_er60_files(): - """Check that ER60 files are identified as EK60""" - # Collect all .raw files in the ek60 directory (assuming ER60 files are also here) - er60_files = glob.glob("echopype/test_data/ek60/*.raw") +def test_is_EK60_non_ek60_files(): + """Check that non-EK60 files are not identified as EK60""" + # Collect all .raw files in the ek80 directory (non-EK60 files) + ek80_files = glob.glob("echopype/test_data/ek80/*.raw") + + # Check that each file in ek80 is not identified as EK60 + for test_file_path in ek80_files: + assert is_EK60(test_file_path, storage_options={}) == False + +def test_is_ER60_er60_files(): + """Check that EK60 files are identified as EK60""" + # Collect all .raw files in the ek60 directory + ek60_files = glob.glob("echopype/test_data/ek60/from_echopy/*.raw") # Check that each file in ek60 is identified as EK60 - for test_file_path in er60_files: - assert is_EK60(test_file_path, storage_options={}) == True + for test_file_path in ek60_files: + assert is_ER60(test_file_path, storage_options={}) == True -def test_is_EK60_non_ek60_files(): +def test_is_ER60_non_er60_files(): """Check that non-EK60 files are not identified as EK60""" # Collect all .raw files in the ek80 directory (non-EK60 files) ek80_files = glob.glob("echopype/test_data/ek80/*.raw") # Check that each file in ek80 is not identified as EK60 for test_file_path in ek80_files: - assert is_EK60(test_file_path, storage_options={}) == False \ No newline at end of file + assert is_ER60(test_file_path, storage_options={}) == False \ No newline at end of file From 80b665609a6483a7742af041bf4a438f62fc4f2e Mon Sep 17 00:00:00 2001 From: Michael C Ryan Date: Fri, 1 Nov 2024 11:15:26 -0400 Subject: [PATCH 21/34] Update __init__.py Need to import these functions. --- echopype/convert/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/echopype/convert/__init__.py b/echopype/convert/__init__.py index b8f6b6520..d4fe935a9 100644 --- a/echopype/convert/__init__.py +++ b/echopype/convert/__init__.py @@ -10,11 +10,11 @@ """ # flake8: noqa -from .parse_ad2cp import ParseAd2cp -from .parse_azfp import ParseAZFP -from .parse_azfp6 import ParseAZFP6 +from .parse_ad2cp import ParseAd2cp, is_AD2CP +from .parse_azfp import ParseAZFP, is_AZFP +from .parse_azfp6 import ParseAZFP6, is_AZFP6 from .parse_base import ParseBase -from .parse_ek60 import ParseEK60, is_EK60 +from .parse_ek60 import ParseEK60, is_EK60, is_ER60 from .parse_ek80 import ParseEK80, is_EK80 from .set_groups_ad2cp import SetGroupsAd2cp from .set_groups_azfp import SetGroupsAZFP From 29ce5823996fa3a02c9a3eba123137a755a0159f Mon Sep 17 00:00:00 2001 From: Michael C Ryan Date: Wed, 18 Dec 2024 12:11:17 -0500 Subject: [PATCH 22/34] Finishing 1399 requests from Dr. Wu-Jung Finishing 1399 requests from Dr. Wu-Jung --- echopype/convert/parse_ad2cp.py | 24 +---- echopype/convert/parse_azfp.py | 36 +------ echopype/convert/parse_azfp6.py | 24 +---- echopype/convert/parse_ek60.py | 31 +----- echopype/convert/parse_ek80.py | 16 ---- echopype/convert/sonar_model_checker.py | 120 ++++++++++++++++++++++++ 6 files changed, 124 insertions(+), 127 deletions(-) create mode 100644 echopype/convert/sonar_model_checker.py diff --git a/echopype/convert/parse_ad2cp.py b/echopype/convert/parse_ad2cp.py index b7815f8de..206b56a35 100644 --- a/echopype/convert/parse_ad2cp.py +++ b/echopype/convert/parse_ad2cp.py @@ -1852,26 +1852,4 @@ def data_record_format(cls, data_record_type: DataRecordType) -> HeaderOrDataRec DataRecordType.ECHOSOUNDER_RAW: ECHOSOUNDER_RAW_DATA_RECORD_FORMAT, DataRecordType.ECHOSOUNDER_RAW_TRANSMIT: ECHOSOUNDER_RAW_DATA_RECORD_FORMAT, DataRecordType.STRING: STRING_DATA_RECORD_FORMAT, - } - - -def is_AD2CP(raw_file): - """ - Check if the provided file has a .ad2cp extension. - - Parameters: - raw_file (str): The name of the file to check. - - Returns: - bool: True if the file has a .ad2cp extension, False otherwise. - """ - - # Check if the input is a string - if not isinstance(raw_file, str): - return False # Return False if the input is not a string - - # Use the str.lower() method to check for the .ad2cp extension - has_ad2cp_extension = raw_file.lower().endswith(".ad2cp") - - # Return the result of the check - return has_ad2cp_extension + } \ No newline at end of file diff --git a/echopype/convert/parse_azfp.py b/echopype/convert/parse_azfp.py index 445866c18..12823ed98 100644 --- a/echopype/convert/parse_azfp.py +++ b/echopype/convert/parse_azfp.py @@ -569,38 +569,4 @@ def _calc_Sv_offset(freq, pulse_len): "and raise an issue in the echopype repository." ) - return SV_OFFSET[freq][pulse_len] - - -def is_AZFP(raw_file): - """ - Check if the specified XML file contains an with string="AZFP". - - Parameters: - raw_file (str): The base name of the XML file (with or without extension). - - Returns: - bool: True if with string="AZFP" is found, False otherwise. - """ - - # Check if the filename ends with .xml or .XML, and strip the extension if it does - base_filename = raw_file.rstrip(".xml").rstrip(".XML") - - # Create a list of possible filenames with both extensions - possible_files = [f"{base_filename}.xml", f"{base_filename}.XML"] - - for full_filename in possible_files: - if os.path.isfile(full_filename): - try: - # Parse the XML file - tree = ET.parse(full_filename) - root = tree.getroot() - - # Check for elements - for instrument in root.findall(".//InstrumentType"): - if instrument.get("string") == "AZFP": - return True - except ET.ParseError: - print(f"Error parsing the XML file: {full_filename}.") - - return False + return SV_OFFSET[freq][pulse_len] \ No newline at end of file diff --git a/echopype/convert/parse_azfp6.py b/echopype/convert/parse_azfp6.py index 9a6af7fdf..9f62af63f 100644 --- a/echopype/convert/parse_azfp6.py +++ b/echopype/convert/parse_azfp6.py @@ -688,26 +688,4 @@ def _calc_Sv_offset(freq, pulse_len): "and raise an issue in the echopype repository." ) - return SV_OFFSET[freq][pulse_len] - - -def is_AZFP6(raw_file): - """ - Check if the provided file has a .azfp extension. - - Parameters: - raw_file (str): The name of the file to check. - - Returns: - bool: True if the file has a .azfp extension, False otherwise. - """ - - # Check if the input is a string - if not isinstance(raw_file, str): - return False # Return False if the input is not a string - - # Use the str.lower() method to check for the .azfp extension - has_azfp_extension = raw_file.lower().endswith(".azfp") - - # Return the result of the check - return has_azfp_extension + return SV_OFFSET[freq][pulse_len] \ No newline at end of file diff --git a/echopype/convert/parse_ek60.py b/echopype/convert/parse_ek60.py index 6a397256d..f0d8dd884 100644 --- a/echopype/convert/parse_ek60.py +++ b/echopype/convert/parse_ek60.py @@ -16,33 +16,4 @@ def __init__( sonar_model="EK60", **kwargs, ): - super().__init__(file, bot_file, idx_file, storage_options, sonar_model) - - -def is_ER60(raw_file, storage_options): - """Check if a raw data file is from Simrad EK60 echosounder.""" - with RawSimradFile(raw_file, "r", storage_options=storage_options) as fid: - config_datagram = fid.read(1) - config_datagram["timestamp"] = np.datetime64( - config_datagram["timestamp"].replace(tzinfo=None), "[ns]" - ) - # Return True if the sounder name matches "ER60" - try: - return config_datagram["sounder_name"] in {"ER60", "EK60"} - except KeyError: - return False - - -def is_EK60(raw_file, storage_options): - """Check if a raw data file is from Simrad EK60 echosounder.""" - with RawSimradFile(raw_file, "r", storage_options=storage_options) as fid: - config_datagram = fid.read(1) - config_datagram["timestamp"] = np.datetime64( - config_datagram["timestamp"].replace(tzinfo=None), "[ns]" - ) - - try: - # Return True if the sounder name matches "EK60" - return config_datagram["sounder_name"] in {"ER60", "EK60"} - except KeyError: - return False + super().__init__(file, bot_file, idx_file, storage_options, sonar_model) \ No newline at end of file diff --git a/echopype/convert/parse_ek80.py b/echopype/convert/parse_ek80.py index 66a1695df..7d0c47cd8 100644 --- a/echopype/convert/parse_ek80.py +++ b/echopype/convert/parse_ek80.py @@ -1,8 +1,4 @@ -import numpy as np - from .parse_base import ParseEK -from .utils.ek_raw_io import RawSimradFile - class ParseEK80(ParseEK): """Class for converting data from Simrad EK80 echosounders.""" @@ -18,15 +14,3 @@ def __init__( ): super().__init__(file, bot_file, idx_file, storage_options, sonar_model) self.environment = {} # dictionary to store environment data - - -def is_EK80(raw_file, storage_options): - """Check if a raw data file is from Simrad EK80 echosounder.""" - with RawSimradFile(raw_file, "r", storage_options=storage_options) as fid: - config_datagram = fid.read(1) - config_datagram["timestamp"] = np.datetime64( - config_datagram["timestamp"].replace(tzinfo=None), "[ns]" - ) - - # Return True if "configuration" exists in config_datagram - return "configuration" in config_datagram diff --git a/echopype/convert/sonar_model_checker.py b/echopype/convert/sonar_model_checker.py new file mode 100644 index 000000000..dff003fa5 --- /dev/null +++ b/echopype/convert/sonar_model_checker.py @@ -0,0 +1,120 @@ +from .utils.ek_raw_io import RawSimradFile +import numpy as np + +def is_EK80(raw_file, storage_options): + """Check if a raw data file is from Simrad EK80 echosounder.""" + with RawSimradFile(raw_file, "r", storage_options=storage_options) as fid: + config_datagram = fid.read(1) + config_datagram["timestamp"] = np.datetime64( + config_datagram["timestamp"].replace(tzinfo=None), "[ns]" + ) + + # Return True if "configuration" exists in config_datagram + return "configuration" in config_datagram + + + +def is_EK60(raw_file, storage_options): + """Check if a raw data file is from Simrad EK60 echosounder.""" + with RawSimradFile(raw_file, "r", storage_options=storage_options) as fid: + config_datagram = fid.read(1) + config_datagram["timestamp"] = np.datetime64( + config_datagram["timestamp"].replace(tzinfo=None), "[ns]" + ) + + try: + # Return True if the sounder name matches "EK60" + return config_datagram["sounder_name"] in {"ER60", "EK60"} + except KeyError: + return False + + + +def is_AZFP6(raw_file): + """ + Check if the provided file has a .azfp extension. + + Parameters: + raw_file (str): The name of the file to check. + + Returns: + bool: True if the file has a .azfp extension, False otherwise. + """ + + # Check if the input is a string + if not isinstance(raw_file, str): + return False # Return False if the input is not a string + + # Use the str.lower() method to check for the .azfp extension + has_azfp_extension = raw_file.lower().endswith(".azfp") + + # Return the result of the check + return has_azfp_extension + + +def is_AZFP(raw_file): + """ + Check if the specified XML file contains an with string="AZFP". + + Parameters: + raw_file (str): The base name of the XML file (with or without extension). + + Returns: + bool: True if with string="AZFP" is found, False otherwise. + """ + + # Check if the filename ends with .xml or .XML, and strip the extension if it does + base_filename = raw_file.rstrip(".xml").rstrip(".XML") + + # Create a list of possible filenames with both extensions + possible_files = [f"{base_filename}.xml", f"{base_filename}.XML"] + + for full_filename in possible_files: + if os.path.isfile(full_filename): + try: + # Parse the XML file + tree = ET.parse(full_filename) + root = tree.getroot() + + # Check for elements + for instrument in root.findall(".//InstrumentType"): + if instrument.get("string") == "AZFP": + return True + except ET.ParseError: + print(f"Error parsing the XML file: {full_filename}.") + + return False + +def is_AD2CP(raw_file): + """ + Check if the provided file has a .ad2cp extension. + + Parameters: + raw_file (str): The name of the file to check. + + Returns: + bool: True if the file has a .ad2cp extension, False otherwise. + """ + + # Check if the input is a string + if not isinstance(raw_file, str): + return False # Return False if the input is not a string + + # Use the str.lower() method to check for the .ad2cp extension + has_ad2cp_extension = raw_file.lower().endswith(".ad2cp") + + # Return the result of the check + return has_ad2cp_extension + +def is_ER60(raw_file, storage_options): + """Check if a raw data file is from Simrad EK60 echosounder.""" + with RawSimradFile(raw_file, "r", storage_options=storage_options) as fid: + config_datagram = fid.read(1) + config_datagram["timestamp"] = np.datetime64( + config_datagram["timestamp"].replace(tzinfo=None), "[ns]" + ) + # Return True if the sounder name matches "ER60" + try: + return config_datagram["sounder_name"] in {"ER60", "EK60"} + except KeyError: + return False From 20d09323fe9bf5ffa4ffe546b08a92c370232a25 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 18 Dec 2024 17:11:54 +0000 Subject: [PATCH 23/34] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- echopype/convert/parse_ad2cp.py | 2 +- echopype/convert/parse_azfp.py | 2 +- echopype/convert/parse_azfp6.py | 2 +- echopype/convert/parse_ek60.py | 2 +- echopype/convert/parse_ek80.py | 1 + echopype/convert/sonar_model_checker.py | 10 ++++++---- 6 files changed, 11 insertions(+), 8 deletions(-) diff --git a/echopype/convert/parse_ad2cp.py b/echopype/convert/parse_ad2cp.py index 206b56a35..51ebc9848 100644 --- a/echopype/convert/parse_ad2cp.py +++ b/echopype/convert/parse_ad2cp.py @@ -1852,4 +1852,4 @@ def data_record_format(cls, data_record_type: DataRecordType) -> HeaderOrDataRec DataRecordType.ECHOSOUNDER_RAW: ECHOSOUNDER_RAW_DATA_RECORD_FORMAT, DataRecordType.ECHOSOUNDER_RAW_TRANSMIT: ECHOSOUNDER_RAW_DATA_RECORD_FORMAT, DataRecordType.STRING: STRING_DATA_RECORD_FORMAT, - } \ No newline at end of file + } diff --git a/echopype/convert/parse_azfp.py b/echopype/convert/parse_azfp.py index 12823ed98..1e307ab9e 100644 --- a/echopype/convert/parse_azfp.py +++ b/echopype/convert/parse_azfp.py @@ -569,4 +569,4 @@ def _calc_Sv_offset(freq, pulse_len): "and raise an issue in the echopype repository." ) - return SV_OFFSET[freq][pulse_len] \ No newline at end of file + return SV_OFFSET[freq][pulse_len] diff --git a/echopype/convert/parse_azfp6.py b/echopype/convert/parse_azfp6.py index 9f62af63f..c06d9ae4b 100644 --- a/echopype/convert/parse_azfp6.py +++ b/echopype/convert/parse_azfp6.py @@ -688,4 +688,4 @@ def _calc_Sv_offset(freq, pulse_len): "and raise an issue in the echopype repository." ) - return SV_OFFSET[freq][pulse_len] \ No newline at end of file + return SV_OFFSET[freq][pulse_len] diff --git a/echopype/convert/parse_ek60.py b/echopype/convert/parse_ek60.py index f0d8dd884..b698c8634 100644 --- a/echopype/convert/parse_ek60.py +++ b/echopype/convert/parse_ek60.py @@ -16,4 +16,4 @@ def __init__( sonar_model="EK60", **kwargs, ): - super().__init__(file, bot_file, idx_file, storage_options, sonar_model) \ No newline at end of file + super().__init__(file, bot_file, idx_file, storage_options, sonar_model) diff --git a/echopype/convert/parse_ek80.py b/echopype/convert/parse_ek80.py index 7d0c47cd8..9d3932b3a 100644 --- a/echopype/convert/parse_ek80.py +++ b/echopype/convert/parse_ek80.py @@ -1,5 +1,6 @@ from .parse_base import ParseEK + class ParseEK80(ParseEK): """Class for converting data from Simrad EK80 echosounders.""" diff --git a/echopype/convert/sonar_model_checker.py b/echopype/convert/sonar_model_checker.py index dff003fa5..c5ceb417a 100644 --- a/echopype/convert/sonar_model_checker.py +++ b/echopype/convert/sonar_model_checker.py @@ -1,6 +1,8 @@ -from .utils.ek_raw_io import RawSimradFile import numpy as np +from .utils.ek_raw_io import RawSimradFile + + def is_EK80(raw_file, storage_options): """Check if a raw data file is from Simrad EK80 echosounder.""" with RawSimradFile(raw_file, "r", storage_options=storage_options) as fid: @@ -11,8 +13,7 @@ def is_EK80(raw_file, storage_options): # Return True if "configuration" exists in config_datagram return "configuration" in config_datagram - - + def is_EK60(raw_file, storage_options): """Check if a raw data file is from Simrad EK60 echosounder.""" @@ -29,7 +30,6 @@ def is_EK60(raw_file, storage_options): return False - def is_AZFP6(raw_file): """ Check if the provided file has a .azfp extension. @@ -85,6 +85,7 @@ def is_AZFP(raw_file): return False + def is_AD2CP(raw_file): """ Check if the provided file has a .ad2cp extension. @@ -106,6 +107,7 @@ def is_AD2CP(raw_file): # Return the result of the check return has_ad2cp_extension + def is_ER60(raw_file, storage_options): """Check if a raw data file is from Simrad EK60 echosounder.""" with RawSimradFile(raw_file, "r", storage_options=storage_options) as fid: From dea1f3cbaa9f2df3d85ce6738f59a09ac2816f1e Mon Sep 17 00:00:00 2001 From: Michael C Ryan Date: Wed, 18 Dec 2024 12:26:40 -0500 Subject: [PATCH 24/34] Adding more PR requests. Adding more PR requests. --- echopype/tests/convert/test_convert_ad2cp.py | 21 +--- echopype/tests/convert/test_convert_azfp6.py | 22 +--- .../tests/convert/test_sonar_model_checker.py | 110 ++++++++++++++++++ 3 files changed, 112 insertions(+), 41 deletions(-) create mode 100644 echopype/tests/convert/test_sonar_model_checker.py diff --git a/echopype/tests/convert/test_convert_ad2cp.py b/echopype/tests/convert/test_convert_ad2cp.py index 262e95c05..76a954344 100644 --- a/echopype/tests/convert/test_convert_ad2cp.py +++ b/echopype/tests/convert/test_convert_ad2cp.py @@ -262,23 +262,4 @@ def _check_raw_output( base["Data_Q"].data.T.flatten(), atol=absolute_tolerance, ) - base.close() - - -def test_is_AD2CP_valid_files(): - """Test that .ad2cp files are identified as valid AD2CP files.""" - # Collect all .ad2cp files in the test directory - ad2cp_files = glob.glob("echopype/test_data/ad2cp/normal/*.ad2cp") - - # Check that each file in ad2cp is identified as valid AD2CP - for test_file_path in ad2cp_files: - assert is_AD2CP(test_file_path) == True - -def test_is_AD2CP_invalid_files(): - """Test that non-.ad2cp files are not identified as valid AD2CP files.""" - # Collect all non-.ad2cp files in the test directory - non_ad2cp_files = glob.glob("echopype/test_data/azfp6/*") - - # Check that each file in non_ad2cp is not identified as valid AD2CP - for test_file_path in non_ad2cp_files: - assert is_AD2CP(test_file_path) == False \ No newline at end of file + base.close() \ No newline at end of file diff --git a/echopype/tests/convert/test_convert_azfp6.py b/echopype/tests/convert/test_convert_azfp6.py index 4ec705ca5..8aded31f9 100644 --- a/echopype/tests/convert/test_convert_azfp6.py +++ b/echopype/tests/convert/test_convert_azfp6.py @@ -165,24 +165,4 @@ def test_convert_azfp_02a_gps_lat_long(azfp_path): np.stack([echodata["Platform"].latitude, echodata["Platform"].longitude]) ) - check_platform_required_scalar_vars(echodata) - - - -def test_is_AZFP6_valid_files(): - """Test that .azfp files are identified as valid AZFP files.""" - # Collect all .azfp files in the test directory - azfp_files = glob.glob("echopype/test_data/azfp6/*.azfp") - - # Check that each file in azfp is identified as valid AZFP - for test_file_path in azfp_files: - assert is_AZFP6(test_file_path) == True - -def test_is_AZFP6_invalid_files(): - """Test that non-.azfp files are not identified as valid AZFP files.""" - # Collect all non-.azfp files in the test directory - non_azfp_files = glob.glob("echopype/test_data/azfp/*") - - # Check that each file in non_azfp is not identified as valid AZFP - for test_file_path in non_azfp_files: - assert is_AZFP6(test_file_path) == False \ No newline at end of file + check_platform_required_scalar_vars(echodata) \ No newline at end of file diff --git a/echopype/tests/convert/test_sonar_model_checker.py b/echopype/tests/convert/test_sonar_model_checker.py new file mode 100644 index 000000000..a1fabf3c9 --- /dev/null +++ b/echopype/tests/convert/test_sonar_model_checker.py @@ -0,0 +1,110 @@ +import glob +from echopype.convert import is_AD2CP, is_AZFP, is_AZFP6, is_EK60, is_EK80, is_ER60 +import pytest + +@pytest.fixture(scope="session") +def test_is_EK80_ek80_files(): + """Test that EK80 files are identified as EK80.""" + # Collect all .raw files in the ek80 directory + ek80_files = glob.glob("echopype/test_data/ek80/*.raw") + + # Check that each file in ek80 is identified as EK80 + for test_file_path in ek80_files: + assert is_EK80(test_file_path, storage_options={}) == True +@pytest.fixture(scope="session") +def test_is_EK80_non_ek80_files(): + """Test that non-EK80 files are not identified as EK80.""" + # Collect all .raw files in the ek60 directory (non-EK80 files) + ek60_files = glob.glob("echopype/test_data/ek60/*.raw") + + # Check that each file in ek60 is not identified as EK80 + for test_file_path in ek60_files: + assert is_EK80(test_file_path, storage_options={}) == False +@pytest.fixture(scope="session") +def test_is_EK60_ek60_files(): + """Check that EK60 files are identified as EK60""" + # Collect all .raw files in the ek60 directory + ek60_files = glob.glob("echopype/test_data/ek60/from_echopy/*.raw") + + # Check that each file in ek60 is identified as EK60 + for test_file_path in ek60_files: + assert is_EK60(test_file_path, storage_options={}) == True +@pytest.fixture(scope="session") +def test_is_EK60_non_ek60_files(): + """Check that non-EK60 files are not identified as EK60""" + # Collect all .raw files in the ek80 directory (non-EK60 files) + ek80_files = glob.glob("echopype/test_data/ek80/*.raw") + + # Check that each file in ek80 is not identified as EK60 + for test_file_path in ek80_files: + assert is_EK60(test_file_path, storage_options={}) == False +@pytest.fixture(scope="session") +def test_is_ER60_er60_files(): + """Check that EK60 files are identified as EK60""" + # Collect all .raw files in the ek60 directory + ek60_files = glob.glob("echopype/test_data/ek60/from_echopy/*.raw") + + # Check that each file in ek60 is identified as EK60 + for test_file_path in ek60_files: + assert is_ER60(test_file_path, storage_options={}) == True +@pytest.fixture(scope="session") +def test_is_ER60_non_er60_files(): + """Check that non-EK60 files are not identified as EK60""" + # Collect all .raw files in the ek80 directory (non-EK60 files) + ek80_files = glob.glob("echopype/test_data/ek80/*.raw") + + # Check that each file in ek80 is not identified as EK60 + for test_file_path in ek80_files: + assert is_ER60(test_file_path, storage_options={}) == False +@pytest.fixture(scope="session") +def test_is_AZFP6_valid_files(): + """Test that .azfp files are identified as valid AZFP files.""" + # Collect all .azfp files in the test directory + azfp_files = glob.glob("echopype/test_data/azfp6/*.azfp") + + # Check that each file in azfp is identified as valid AZFP + for test_file_path in azfp_files: + assert is_AZFP6(test_file_path) == True +@pytest.fixture(scope="session") +def test_is_AZFP6_invalid_files(): + """Test that non-.azfp files are not identified as valid AZFP files.""" + # Collect all non-.azfp files in the test directory + non_azfp_files = glob.glob("echopype/test_data/azfp/*") + + # Check that each file in non_azfp is not identified as valid AZFP + for test_file_path in non_azfp_files: + assert is_AZFP6(test_file_path) == False +@pytest.fixture(scope="session") +def test_is_AZFP_valid_files(): + """Test that XML files with are identified as valid AZFP files.""" + # Collect all valid XML files in the test directory + valid_files = glob.glob("echopype/test_data/azfp/*.xml") + glob.glob("echopype/test_data/azfp/*.XML") + + for test_file_path in valid_files: + assert is_AZFP(test_file_path) == True +@pytest.fixture(scope="session") +def test_is_AZFP_invalid_files(): + """Test that XML files without are not identified as valid AZFP files.""" + # Collect all invalid XML files in the test directory + invalid_files = glob.glob("echopype/test_data/azfp6/*") + + for test_file_path in invalid_files: + assert is_AZFP(test_file_path) == False +@pytest.fixture(scope="session") +def test_is_AD2CP_valid_files(): + """Test that .ad2cp files are identified as valid AD2CP files.""" + # Collect all .ad2cp files in the test directory + ad2cp_files = glob.glob("echopype/test_data/ad2cp/normal/*.ad2cp") + + # Check that each file in ad2cp is identified as valid AD2CP + for test_file_path in ad2cp_files: + assert is_AD2CP(test_file_path) == True +@pytest.fixture(scope="session") +def test_is_AD2CP_invalid_files(): + """Test that non-.ad2cp files are not identified as valid AD2CP files.""" + # Collect all non-.ad2cp files in the test directory + non_ad2cp_files = glob.glob("echopype/test_data/azfp6/*") + + # Check that each file in non_ad2cp is not identified as valid AD2CP + for test_file_path in non_ad2cp_files: + assert is_AD2CP(test_file_path) == False \ No newline at end of file From 35f6e0fbd8d5361c2792e253d628d309952ebc5f Mon Sep 17 00:00:00 2001 From: Michael C Ryan Date: Wed, 18 Dec 2024 12:32:24 -0500 Subject: [PATCH 25/34] Adding in more requests. Adding in more requests. --- echopype/convert/parse_ek60.py | 4 ---- echopype/tests/convert/test_sonar_model_checker.py | 11 +++++++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/echopype/convert/parse_ek60.py b/echopype/convert/parse_ek60.py index b698c8634..e0b174025 100644 --- a/echopype/convert/parse_ek60.py +++ b/echopype/convert/parse_ek60.py @@ -1,8 +1,4 @@ -import numpy as np - from .parse_base import ParseEK -from .utils.ek_raw_io import RawSimradFile - class ParseEK60(ParseEK): """Class for converting data from Simrad EK60 echosounders.""" diff --git a/echopype/tests/convert/test_sonar_model_checker.py b/echopype/tests/convert/test_sonar_model_checker.py index a1fabf3c9..c734f6ce8 100644 --- a/echopype/tests/convert/test_sonar_model_checker.py +++ b/echopype/tests/convert/test_sonar_model_checker.py @@ -11,6 +11,7 @@ def test_is_EK80_ek80_files(): # Check that each file in ek80 is identified as EK80 for test_file_path in ek80_files: assert is_EK80(test_file_path, storage_options={}) == True + @pytest.fixture(scope="session") def test_is_EK80_non_ek80_files(): """Test that non-EK80 files are not identified as EK80.""" @@ -20,6 +21,7 @@ def test_is_EK80_non_ek80_files(): # Check that each file in ek60 is not identified as EK80 for test_file_path in ek60_files: assert is_EK80(test_file_path, storage_options={}) == False + @pytest.fixture(scope="session") def test_is_EK60_ek60_files(): """Check that EK60 files are identified as EK60""" @@ -29,6 +31,7 @@ def test_is_EK60_ek60_files(): # Check that each file in ek60 is identified as EK60 for test_file_path in ek60_files: assert is_EK60(test_file_path, storage_options={}) == True + @pytest.fixture(scope="session") def test_is_EK60_non_ek60_files(): """Check that non-EK60 files are not identified as EK60""" @@ -38,6 +41,7 @@ def test_is_EK60_non_ek60_files(): # Check that each file in ek80 is not identified as EK60 for test_file_path in ek80_files: assert is_EK60(test_file_path, storage_options={}) == False + @pytest.fixture(scope="session") def test_is_ER60_er60_files(): """Check that EK60 files are identified as EK60""" @@ -47,6 +51,7 @@ def test_is_ER60_er60_files(): # Check that each file in ek60 is identified as EK60 for test_file_path in ek60_files: assert is_ER60(test_file_path, storage_options={}) == True + @pytest.fixture(scope="session") def test_is_ER60_non_er60_files(): """Check that non-EK60 files are not identified as EK60""" @@ -56,6 +61,7 @@ def test_is_ER60_non_er60_files(): # Check that each file in ek80 is not identified as EK60 for test_file_path in ek80_files: assert is_ER60(test_file_path, storage_options={}) == False + @pytest.fixture(scope="session") def test_is_AZFP6_valid_files(): """Test that .azfp files are identified as valid AZFP files.""" @@ -65,6 +71,7 @@ def test_is_AZFP6_valid_files(): # Check that each file in azfp is identified as valid AZFP for test_file_path in azfp_files: assert is_AZFP6(test_file_path) == True + @pytest.fixture(scope="session") def test_is_AZFP6_invalid_files(): """Test that non-.azfp files are not identified as valid AZFP files.""" @@ -74,6 +81,7 @@ def test_is_AZFP6_invalid_files(): # Check that each file in non_azfp is not identified as valid AZFP for test_file_path in non_azfp_files: assert is_AZFP6(test_file_path) == False + @pytest.fixture(scope="session") def test_is_AZFP_valid_files(): """Test that XML files with are identified as valid AZFP files.""" @@ -82,6 +90,7 @@ def test_is_AZFP_valid_files(): for test_file_path in valid_files: assert is_AZFP(test_file_path) == True + @pytest.fixture(scope="session") def test_is_AZFP_invalid_files(): """Test that XML files without are not identified as valid AZFP files.""" @@ -90,6 +99,7 @@ def test_is_AZFP_invalid_files(): for test_file_path in invalid_files: assert is_AZFP(test_file_path) == False + @pytest.fixture(scope="session") def test_is_AD2CP_valid_files(): """Test that .ad2cp files are identified as valid AD2CP files.""" @@ -99,6 +109,7 @@ def test_is_AD2CP_valid_files(): # Check that each file in ad2cp is identified as valid AD2CP for test_file_path in ad2cp_files: assert is_AD2CP(test_file_path) == True + @pytest.fixture(scope="session") def test_is_AD2CP_invalid_files(): """Test that non-.ad2cp files are not identified as valid AD2CP files.""" From afd3bd2689ae8d3af48e14616749d1422de2bd14 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 18 Dec 2024 17:33:26 +0000 Subject: [PATCH 26/34] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- echopype/convert/parse_ek60.py | 1 + 1 file changed, 1 insertion(+) diff --git a/echopype/convert/parse_ek60.py b/echopype/convert/parse_ek60.py index e0b174025..88d749ea7 100644 --- a/echopype/convert/parse_ek60.py +++ b/echopype/convert/parse_ek60.py @@ -1,5 +1,6 @@ from .parse_base import ParseEK + class ParseEK60(ParseEK): """Class for converting data from Simrad EK60 echosounders.""" From 4574f81a503065d89a517f4a1dd42a0d1cde0b9c Mon Sep 17 00:00:00 2001 From: Michael C Ryan Date: Wed, 18 Dec 2024 12:38:34 -0500 Subject: [PATCH 27/34] More fixes for PR1399 PR1399 --- echopype/tests/convert/test_convert_ad2cp.py | 2 - echopype/tests/convert/test_convert_azfp.py | 20 +--------- echopype/tests/convert/test_convert_ek60.py | 39 +------------------- echopype/tests/convert/test_convert_ek80.py | 22 +---------- 4 files changed, 3 insertions(+), 80 deletions(-) diff --git a/echopype/tests/convert/test_convert_ad2cp.py b/echopype/tests/convert/test_convert_ad2cp.py index 76a954344..d4eb03493 100644 --- a/echopype/tests/convert/test_convert_ad2cp.py +++ b/echopype/tests/convert/test_convert_ad2cp.py @@ -4,8 +4,6 @@ Files under "normal" contain default data variables, whereas files under "raw" additionally contain the IQ samples. """ -import glob -from echopype.convert import is_AD2CP import xarray as xr import numpy as np diff --git a/echopype/tests/convert/test_convert_azfp.py b/echopype/tests/convert/test_convert_azfp.py index b2f4d43d8..0e14d11cf 100644 --- a/echopype/tests/convert/test_convert_azfp.py +++ b/echopype/tests/convert/test_convert_azfp.py @@ -264,22 +264,4 @@ def test_load_parse_azfp_xml(azfp_path): assert parseAZFP.parameters['pulse_len_phase1'] == [1000, 1000, 1000, 1000] assert parseAZFP.parameters['pulse_len_phase2'] == [0, 0, 0, 0] assert parseAZFP.parameters['range_samples_phase1'] == [8273, 8273, 8273, 8273] - assert parseAZFP.parameters['range_samples_phase2'] == [2750, 2750, 2750, 2750] - - - -def test_is_AZFP_valid_files(): - """Test that XML files with are identified as valid AZFP files.""" - # Collect all valid XML files in the test directory - valid_files = glob.glob("echopype/test_data/azfp/*.xml") + glob.glob("echopype/test_data/azfp/*.XML") - - for test_file_path in valid_files: - assert is_AZFP(test_file_path) == True - -def test_is_AZFP_invalid_files(): - """Test that XML files without are not identified as valid AZFP files.""" - # Collect all invalid XML files in the test directory - invalid_files = glob.glob("echopype/test_data/azfp6/*") - - for test_file_path in invalid_files: - assert is_AZFP(test_file_path) == False \ No newline at end of file + assert parseAZFP.parameters['range_samples_phase2'] == [2750, 2750, 2750, 2750] \ No newline at end of file diff --git a/echopype/tests/convert/test_convert_ek60.py b/echopype/tests/convert/test_convert_ek60.py index 9b318b00a..3c32689b0 100644 --- a/echopype/tests/convert/test_convert_ek60.py +++ b/echopype/tests/convert/test_convert_ek60.py @@ -263,41 +263,4 @@ def test_converting_ek60_raw_with_missing_channel_power(): # Check that all empty power channels do not exist in the EchoData Beam group for _, empty_power_channel_name in empty_power_chs.items(): - assert empty_power_channel_name not in ed["Sonar/Beam_group1"]["channel"] - - -def test_is_EK60_ek60_files(): - """Check that EK60 files are identified as EK60""" - # Collect all .raw files in the ek60 directory - ek60_files = glob.glob("echopype/test_data/ek60/from_echopy/*.raw") - - # Check that each file in ek60 is identified as EK60 - for test_file_path in ek60_files: - assert is_EK60(test_file_path, storage_options={}) == True - -def test_is_EK60_non_ek60_files(): - """Check that non-EK60 files are not identified as EK60""" - # Collect all .raw files in the ek80 directory (non-EK60 files) - ek80_files = glob.glob("echopype/test_data/ek80/*.raw") - - # Check that each file in ek80 is not identified as EK60 - for test_file_path in ek80_files: - assert is_EK60(test_file_path, storage_options={}) == False - -def test_is_ER60_er60_files(): - """Check that EK60 files are identified as EK60""" - # Collect all .raw files in the ek60 directory - ek60_files = glob.glob("echopype/test_data/ek60/from_echopy/*.raw") - - # Check that each file in ek60 is identified as EK60 - for test_file_path in ek60_files: - assert is_ER60(test_file_path, storage_options={}) == True - -def test_is_ER60_non_er60_files(): - """Check that non-EK60 files are not identified as EK60""" - # Collect all .raw files in the ek80 directory (non-EK60 files) - ek80_files = glob.glob("echopype/test_data/ek80/*.raw") - - # Check that each file in ek80 is not identified as EK60 - for test_file_path in ek80_files: - assert is_ER60(test_file_path, storage_options={}) == False \ No newline at end of file + assert empty_power_channel_name not in ed["Sonar/Beam_group1"]["channel"] \ No newline at end of file diff --git a/echopype/tests/convert/test_convert_ek80.py b/echopype/tests/convert/test_convert_ek80.py index c76862c52..c01211ae9 100644 --- a/echopype/tests/convert/test_convert_ek80.py +++ b/echopype/tests/convert/test_convert_ek80.py @@ -1,5 +1,4 @@ import shutil -import glob import pytest import numpy as np import pandas as pd @@ -529,23 +528,4 @@ def test_parse_ek80_with_invalid_env_datagrams(): # Check that each calibration specific variable exists, is not NaN, and is of type float64 for var in ["acidity", "depth", "salinity", "temperature", "sound_speed_indicative"]: env_var = ed["Environment"][var] - assert env_var.notnull().all() and env_var.dtype == np.float64 - - -def test_is_EK80_ek80_files(): - """Test that EK80 files are identified as EK80.""" - # Collect all .raw files in the ek80 directory - ek80_files = glob.glob("echopype/test_data/ek80/*.raw") - - # Check that each file in ek80 is identified as EK80 - for test_file_path in ek80_files: - assert is_EK80(test_file_path, storage_options={}) == True - -def test_is_EK80_non_ek80_files(): - """Test that non-EK80 files are not identified as EK80.""" - # Collect all .raw files in the ek60 directory (non-EK80 files) - ek60_files = glob.glob("echopype/test_data/ek60/*.raw") - - # Check that each file in ek60 is not identified as EK80 - for test_file_path in ek60_files: - assert is_EK80(test_file_path, storage_options={}) == False \ No newline at end of file + assert env_var.notnull().all() and env_var.dtype == np.float64 \ No newline at end of file From 895b764632be1e1514233d000618938926c723d5 Mon Sep 17 00:00:00 2001 From: Michael C Ryan Date: Mon, 13 Jan 2025 11:56:56 -0500 Subject: [PATCH 28/34] Update sonar_model_checker.py --- echopype/convert/sonar_model_checker.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/echopype/convert/sonar_model_checker.py b/echopype/convert/sonar_model_checker.py index c5ceb417a..f5a28ac7d 100644 --- a/echopype/convert/sonar_model_checker.py +++ b/echopype/convert/sonar_model_checker.py @@ -1,4 +1,6 @@ import numpy as np +import os +import xml.etree.ElementTree as ET from .utils.ek_raw_io import RawSimradFile From 1049942653d2cd3c9e0a02a1cdec2bfe7844cba3 Mon Sep 17 00:00:00 2001 From: Michael C Ryan Date: Mon, 13 Jan 2025 12:07:16 -0500 Subject: [PATCH 29/34] Update __init__.py --- echopype/convert/__init__.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/echopype/convert/__init__.py b/echopype/convert/__init__.py index d4fe935a9..78c4e2859 100644 --- a/echopype/convert/__init__.py +++ b/echopype/convert/__init__.py @@ -10,12 +10,12 @@ """ # flake8: noqa -from .parse_ad2cp import ParseAd2cp, is_AD2CP -from .parse_azfp import ParseAZFP, is_AZFP -from .parse_azfp6 import ParseAZFP6, is_AZFP6 +from .parse_ad2cp import ParseAd2cp +from .parse_azfp import ParseAZFP +from .parse_azfp6 import ParseAZFP6 from .parse_base import ParseBase -from .parse_ek60 import ParseEK60, is_EK60, is_ER60 -from .parse_ek80 import ParseEK80, is_EK80 +from .parse_ek60 import ParseEK60 +from .parse_ek80 import ParseEK80 from .set_groups_ad2cp import SetGroupsAd2cp from .set_groups_azfp import SetGroupsAZFP from .set_groups_azfp6 import SetGroupsAZFP6 From e39263bdf5f2c702a0af7157ff458edb41a36804 Mon Sep 17 00:00:00 2001 From: Michael C Ryan Date: Tue, 14 Jan 2025 14:25:56 -0500 Subject: [PATCH 30/34] Fixed test_convert_ek80.py Fixed test_convert_ek80.py --- echopype/test_data/README.md | 3 --- echopype/tests/convert/test_convert_ek80.py | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/echopype/test_data/README.md b/echopype/test_data/README.md index d3295604e..c79ad71f3 100644 --- a/echopype/test_data/README.md +++ b/echopype/test_data/README.md @@ -11,8 +11,6 @@ Most of these files are stored on Git LFS but the ones that aren't (due to file - 2019118 group2survey-D20191214-T081342.raw: Contains 6 channels but only 2 of those channels collect ping data - D20200528-T125932.raw: Data collected from WBT mini (instead of WBT), from @emlynjdavies - Green2.Survey2.FM.short.slow.-D20191004-T211557.raw: Contains 2-in-1 transducer, from @FletcherFT (reduced from 104.9 MB to 765 KB in test data updates) -- raw4-D20220514-T172704.raw: Contains RAW4 datagram, 1 channel only, from @cornejotux -- D20210330-T123857.raw: do not contain filter coefficients ### EA640 @@ -24,7 +22,6 @@ Most of these files are stored on Git LFS but the ones that aren't (due to file - Winter2017-D20170115-T150122.raw: Contains a change of recording length in the middle of the file - 2015843-D20151023-T190636.raw: Not used in tests but contains ranges are not constant across ping times - SH1701_consecutive_files_w_range_change: Not used in tests. [Folder](https://drive.google.com/drive/u/1/folders/1PaDtL-xnG5EK3N3P1kGlXa5ub16Yic0f) on shared drive that contains sequential files with ranges that are not constant across ping times. -- NBP_B050N-D20180118-T090228.raw: split-beam setup without angle data ### AZFP diff --git a/echopype/tests/convert/test_convert_ek80.py b/echopype/tests/convert/test_convert_ek80.py index c01211ae9..bfb71a257 100644 --- a/echopype/tests/convert/test_convert_ek80.py +++ b/echopype/tests/convert/test_convert_ek80.py @@ -6,7 +6,7 @@ from echopype import open_raw, open_converted from echopype.testing import TEST_DATA_FOLDER -from echopype.convert.parse_ek80 import ParseEK80, is_EK80 +from echopype.convert.parse_ek80 import ParseEK80 from echopype.convert.set_groups_ek80 import WIDE_BAND_TRANS, PULSE_COMPRESS, FILTER_IMAG, FILTER_REAL, DECIMATION From cdcb936981f9e9316ee138754343b83dcc5f2050 Mon Sep 17 00:00:00 2001 From: Michael C Ryan Date: Tue, 14 Jan 2025 14:28:22 -0500 Subject: [PATCH 31/34] Made more updates to tests. Made more updates to tests. --- echopype/tests/convert/test_convert_ad2cp.py | 1 - echopype/tests/convert/test_convert_azfp.py | 4 +--- echopype/tests/convert/test_convert_azfp6.py | 4 +--- echopype/tests/convert/test_convert_ek60.py | 2 +- 4 files changed, 3 insertions(+), 8 deletions(-) diff --git a/echopype/tests/convert/test_convert_ad2cp.py b/echopype/tests/convert/test_convert_ad2cp.py index d4eb03493..1b1dba4bc 100644 --- a/echopype/tests/convert/test_convert_ad2cp.py +++ b/echopype/tests/convert/test_convert_ad2cp.py @@ -11,7 +11,6 @@ import pytest from tempfile import TemporaryDirectory from pathlib import Path -import glob from echopype import open_raw, open_converted from echopype.testing import TEST_DATA_FOLDER diff --git a/echopype/tests/convert/test_convert_azfp.py b/echopype/tests/convert/test_convert_azfp.py index 0e14d11cf..382662200 100644 --- a/echopype/tests/convert/test_convert_azfp.py +++ b/echopype/tests/convert/test_convert_azfp.py @@ -4,15 +4,13 @@ - verify echopype converted files against those from AZFP Matlab scripts and EchoView - convert AZFP file with different range settings across frequency """ -import xml.etree.ElementTree as ET -import glob import numpy as np import pandas as pd from scipy.io import loadmat from echopype import open_raw import pytest -from echopype.convert.parse_azfp import ParseAZFP, is_AZFP +from echopype.convert.parse_azfp import ParseAZFP @pytest.fixture diff --git a/echopype/tests/convert/test_convert_azfp6.py b/echopype/tests/convert/test_convert_azfp6.py index 8aded31f9..0f0e9a522 100644 --- a/echopype/tests/convert/test_convert_azfp6.py +++ b/echopype/tests/convert/test_convert_azfp6.py @@ -4,14 +4,12 @@ - verify echopype converted files against those from AZFP Matlab scripts and EchoView - convert AZFP file with different range settings across frequency """ -import glob import numpy as np -import pandas as pd from datetime import datetime, timedelta from scipy.io import loadmat from echopype import open_raw import pytest -from echopype.convert.parse_azfp6 import ParseAZFP6, is_AZFP6 + @pytest.fixture diff --git a/echopype/tests/convert/test_convert_ek60.py b/echopype/tests/convert/test_convert_ek60.py index 3c32689b0..43bc9df51 100644 --- a/echopype/tests/convert/test_convert_ek60.py +++ b/echopype/tests/convert/test_convert_ek60.py @@ -6,7 +6,7 @@ import pytest from echopype import open_raw -from echopype.convert import ParseEK60, is_EK60, is_ER60 +from echopype.convert import ParseEK60 @pytest.fixture From 3a89a9ce2b7ef5d5de3487433767d8235b3da178 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 17 Jan 2025 16:29:21 +0000 Subject: [PATCH 32/34] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- echopype/convert/sonar_model_checker.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/echopype/convert/sonar_model_checker.py b/echopype/convert/sonar_model_checker.py index f5a28ac7d..2ebe7b9aa 100644 --- a/echopype/convert/sonar_model_checker.py +++ b/echopype/convert/sonar_model_checker.py @@ -1,7 +1,8 @@ -import numpy as np import os import xml.etree.ElementTree as ET +import numpy as np + from .utils.ek_raw_io import RawSimradFile From 5dfd4d4c9e8ba694db1df6f6ab9fdd92a8c0c534 Mon Sep 17 00:00:00 2001 From: Michael C Ryan Date: Fri, 17 Jan 2025 12:37:18 -0500 Subject: [PATCH 33/34] Update test_convert_ad2cp.py --- echopype/tests/convert/test_convert_ad2cp.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/echopype/tests/convert/test_convert_ad2cp.py b/echopype/tests/convert/test_convert_ad2cp.py index 1b1dba4bc..f479c3569 100644 --- a/echopype/tests/convert/test_convert_ad2cp.py +++ b/echopype/tests/convert/test_convert_ad2cp.py @@ -15,8 +15,6 @@ from echopype import open_raw, open_converted from echopype.testing import TEST_DATA_FOLDER -from echopype.convert.parse_ad2cp import is_AD2CP - @pytest.fixture def ocean_contour_export_dir(test_path): return test_path["AD2CP"] / "ocean-contour" From 0d63fd315c6b4ae01f0e7342fe33718e9350d92b Mon Sep 17 00:00:00 2001 From: Michael C Ryan Date: Fri, 17 Jan 2025 12:48:11 -0500 Subject: [PATCH 34/34] Update test_sonar_model_checker.py --- echopype/tests/convert/test_sonar_model_checker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/echopype/tests/convert/test_sonar_model_checker.py b/echopype/tests/convert/test_sonar_model_checker.py index c734f6ce8..64822156f 100644 --- a/echopype/tests/convert/test_sonar_model_checker.py +++ b/echopype/tests/convert/test_sonar_model_checker.py @@ -1,5 +1,5 @@ import glob -from echopype.convert import is_AD2CP, is_AZFP, is_AZFP6, is_EK60, is_EK80, is_ER60 +from echopype.convert.sonar_model_checker import is_AD2CP, is_AZFP, is_AZFP6, is_EK60, is_EK80, is_ER60 import pytest @pytest.fixture(scope="session")