Skip to content

sonar_model handling, grouping #995

@emiliom

Description

@emiliom

Simrad echosounders have a hierachical relationship between individual sonar model strings and the broader processing "class" (used loosely!). Specifically:

"Class" Sonar models
EK60 EK60, ES70
EK80 EK80, ES80, EA640

Converting from the sonar model strings to the "class" is a recurring need across the code base that is implemented independently in many different places. Here are two examples:

if self.sonar_model in ["EK60", "ES70"]:

if echodata.sonar_model in ("EK60", "ES70"):
ek_str = "EK60"
elif echodata.sonar_model in ("EK80", "ES80", "EA640"):
ek_str = "EK80"

This need to reimplement carries the potential of forgetting to do it; I've run into those oversights a couple of times.

The relationship is already expressed implicitly in core.SONAR_MODELS, eg:

"ES80": {
"validate_ext": validate_ext(".raw"),
"xml": False,
"parser": ParseEK80,
"parsed2zarr": Parsed2ZarrEK80,
"set_groups": SetGroupsEK80,
"dgram_zarr_vars": {
"power": ["timestamp", "channel_id"],
"complex": ["timestamp", "channel_id"],
"angle": ["timestamp", "channel_id"],
},
},

We should think about options for handling this more systematically. For example, one option could involve encoding the sonar model "class" (I'm sure there's a better label for this!) in core.SONAR_MODELS, then using that consistently. And/or encoding it as a property of the echodata object, so it's always available. Doing something like that would eliminate a lot of hard-wired listings of individual sonar models in if-then statements.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementThis makes echopype better

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions