Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Added sonar model checkers for EK60, EK80, ER60, AZFP6, AZFP, AD2CP and tests #1399

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
94ec110
Added sonar model checkers for EK60, EK80
spacetimeengineer Oct 25, 2024
cae865e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 25, 2024
2cb2625
Update parse_ek60.py
spacetimeengineer Oct 25, 2024
7bf89a1
Added test cases for EK60 and EK80 model validation
spacetimeengineer Oct 28, 2024
1affd2d
Fixed the tests.
spacetimeengineer Oct 28, 2024
2abe8be
Fixed an import error
spacetimeengineer Oct 28, 2024
fa7dc1c
Test fix + Update to documentation for Docker and sudo privileges
spacetimeengineer Oct 28, 2024
adb5111
Update parse_ek60.py
spacetimeengineer Oct 28, 2024
8967c3e
Refactor error handling: Removed unnecessary 'e' variable
spacetimeengineer Oct 28, 2024
53367cd
chore(deps): bump actions/cache from 4.1.1 to 4.1.2 (#1400)
dependabot[bot] Oct 30, 2024
ca2adf9
chore(deps): bump actions/setup-python from 5.2.0 to 5.3.0 (#1401)
dependabot[bot] Oct 30, 2024
907424d
Made tests better so that they run through all test files in the test…
spacetimeengineer Oct 31, 2024
8a2517d
Added better tests for ek80 checker functions.
spacetimeengineer Oct 31, 2024
01ceb52
Added the rest of the sonar checkers.
spacetimeengineer Oct 31, 2024
0534589
Update test_convert_azfp6.py
spacetimeengineer Nov 1, 2024
853d01b
Added more tests
spacetimeengineer Nov 1, 2024
d3467f5
Update test_convert_azfp.py
spacetimeengineer Nov 1, 2024
bf73faa
Corrected some tests.
spacetimeengineer Nov 1, 2024
a8cd12b
Merge branch 'Parse-sonar-model-from-.raw-for-EK60,-EK80' into parse-…
spacetimeengineer Nov 1, 2024
4db7dd5
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 1, 2024
9929523
Needed some fixes for the merge.
spacetimeengineer Nov 1, 2024
1f8f44d
Merge branch 'Parse-sonar-model-from-.raw-for-EK60,-EK80' of https://…
spacetimeengineer Nov 1, 2024
d128ff7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 1, 2024
48d9d6b
More merge fixes.
spacetimeengineer Nov 1, 2024
80b6656
Update __init__.py
spacetimeengineer Nov 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions echopype/convert/parse_ek60.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import numpy as np

from .parse_base import ParseEK
from .utils.ek_raw_io import RawSimradFile


class ParseEK60(ParseEK):
Expand All @@ -14,3 +17,18 @@ 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]"
)
Comment on lines +38 to +42
Copy link
Member

Choose a reason for hiding this comment

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

I am not sure why you are accessing the timestamp here.

See Gavin's #494 (comment) that I think would be useful here to check the format without using the full blown parser. Implementing that into the checker would address #494 too in this PR.


# 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
18 changes: 18 additions & 0 deletions echopype/convert/parse_ek80.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import numpy as np

from .parse_base import ParseEK
from .utils.ek_raw_io import RawSimradFile


class ParseEK80(ParseEK):
Expand All @@ -15,3 +18,18 @@ 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