-
Notifications
You must be signed in to change notification settings - Fork 77
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
Move Beam group to Sonar/Beam_group1 and Beam_power to Sonar/Beam_power #574
Conversation
…from Google Drive
for more information, see https://pre-commit.ci
Codecov Report
@@ Coverage Diff @@
## dev #574 +/- ##
==========================================
- Coverage 78.59% 71.39% -7.20%
==========================================
Files 40 22 -18
Lines 3499 2678 -821
==========================================
- Hits 2750 1912 -838
- Misses 749 766 +17
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
I've expanded the scope of this PR a bit by pushing a commit that adds the new variables @leewujung and @lsetiawan, it'd be great if you could review this PR 🥺 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @emiliom for this heavy lifting!! My comments are mostly about the subgroup name (/Sonar/Beam_group2 vs /Sonar/Beam_power) and the descriptions.
How about we remove echopype/convert/add_ancillary.py so that it does not cause confusion? It is not used by anything else.
From a quick skim through of the actual update_platform(), I don't immediately see change needed to make it work with the new under-the-hood change connection with the files.
echopype/convert/api.py
Outdated
@@ -171,7 +173,7 @@ def _save_groups_to_file(echodata, output_path, engine, compress=True): | |||
path=output_path, | |||
mode="a", | |||
engine=engine, | |||
group="Beam_power", | |||
group="Sonar/Beam_power", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about just making this "Sonar/Beam_group2"
to be consistent with the convention?
Currently ed.beam_power
only exists if there is also complex data in the .raw file (which are stored in ed.beam
as the "default"). Otherwise there is only ed.beam
.
So I am proposing is effectively making this mapping
- (in EchoData object)
ed.beam
-- (in file)"/Sonar/Beam_group1"
- (in EchoData object)
ed.beam_power
-- (in file)"/Sonar/Beam_group2"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops sorry for womansplaining you -- I see from below that you are VERY aware of what data exists and when. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about just making this "Sonar/Beam_group2" to be consistent with the convention?
I can do that. I was just trying to include in this PR the core of my proposed changes. So, I had decided to not bother initially with the busy work of changing Beam_power
to Beam_group2
. I also wanted you and others to have a chance to think about whether having the mapping "(in EchoData object) ed.beam_power
-- (in file) '/Sonar/Beam_group2'
could be confusing.
echopype/convert/add_ancillary.py
Outdated
def update_platform( | ||
self, | ||
files=None, | ||
beam_group_name="Beam_group1", | ||
extra_platform_data=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a deprecated function and the current update_platform is part of the EchoData class in
echopype/echopype/echodata/echodata.py
Line 387 in 5cf1153
def update_platform( |
We should clean all of these up in v0.6.0! I was confused myself for a min...
echopype/convert/set_groups_azfp.py
Outdated
self._beamgroups = [ | ||
{ | ||
"name": "Beam_group1", | ||
"descr": "contains complex backscatter data and other beam or channel-specific data.", | ||
} | ||
] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AZFP only store power data and the numbers need to be converted before it is "power" with physical meaning, so maybe the description could be changed to something like
"descr": "contains backscatter power (uncalibrated) and other beam or channel-specific data." ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. The core point of this PR is the implementation of the general mechanism to specify these descriptions as instrument-specific strings. The beauty is that once this is in place, we can tweak the "descr" easily, any time! But yeah, I'm happy to modify the PR later to replace the descr string with your suggestion.
), | ||
} | ||
|
||
return beam_groups_vars |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this! :D
"descr": "contains complex backscatter data and other beam or channel-specific data.", | ||
} | ||
] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to AZFP, EK60 does not record complex data. Depending on the transducer, it could be power data only (single beam) or power-angle data (split beam).
How about something like the following for the description?
"descr": ("contains backscatter power (uncalibrated) and other beam or channel-specific data,
including split-beam angle data when they exist.")
(is data singular or plural in a convention??)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my comment above about AZFP. And heh, that string was copied directly from 1.0.yml
and it's what we've been using all along in the EchoData html repr 😆
(is data singular or plural in a convention??)
Heh. I like what this article says: "Data typically takes singular verbs and pronouns when writing for general audiences and in data journalism contexts: The data is sound. In scientific and academic writing, plural verbs and pronouns are preferred.". I have no idea if SONAR-netCDF4 is consistent about singular vs plural. I know I am not consistent on any given day, in general!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in one of the future docathon... search for "data" and make all self-consistent 😆
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤓
echopype/convert/set_groups_ek80.py
Outdated
"name": "Beam_power", | ||
"descr": "contains backscatter data (power-only) and other beam or channel-specific data.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to EK60:
"descr": ("contains backscatter power (uncalibrated) and other beam or channel-specific data,
including split-beam angle data when they exist.")
ds_beam_power = merge_save(ds_power, "power", group_name="Beam_power") | ||
ds_beam_power = merge_save( | ||
ds_power, "power", group_name="/Sonar/Beam_power" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to the above, making this "/Sonar/Beam_group2" ?
echopype/echodata/convention/1.0.yml
Outdated
name: Sonar/Beam_group1 | ||
description: contains backscatter data and other beam or channel-specific data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested edits (feel free to modify!)
"description": ("contains backscatter data (either complex samples or uncalibrated power samples)
and other beam or channel-specific data,
including split-beam angle data when they exist.")
echopype/echodata/convention/1.0.yml
Outdated
name: Sonar/Beam Power | ||
description: contains backscatter data (power-only) and other beam or channel-specific data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something like below?
name: Sonar/Beam_group2
"description": ("contains backscatter power (uncalibrated) and other beam or channel-specific data,
including split-beam angle data when they exist.
Only exist if complex backscatter data is already in Sonar/Beam_group1")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for multiline yaml you could do:
description: |
contains backscatter power (uncalibrated) and other beam or channel-specific data,
including split-beam angle data when they exist.
Only exist if complex backscatter data is already in Sonar/Beam_group1
) | ||
|
||
|
||
@pytest.fixture( | ||
params=[ | ||
single_ek60_zarr, | ||
(str, "ncei-wcsd", "Summer2017-D20170615-T190214.zarr"), | ||
(None, "ncei-wcsd", "Summer2017-D20170615-T190214.nc"), | ||
(None, "ncei-wcsd", "Summer2017-D20170615-T190214__NEW.nc"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is in this __NEW file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summer2017-D20170615-T190214.raw
converted using the code in this PR, and therefore with the beam group in Sonar/Beam_group1
rather than Beam
. See a Slack thread with @lsetiawan from 3/4 on the echopype
channel.
Ah! I didn't try to see whether that module was still used. I was just replacing the occurrences of |
I've implemented and pushed all the changes @leewujung suggested. I'll merge the PR once the tests pass successfully. |
This is exciting! 🎊 |
See #519. Also some relevant discussions in PR #545, which was closed w/o merging; this PR is based on that older PR.
This is only a first, incremental step to fully supporting a flexible
Sonar/Beam_groupX
multi-beam-group approach. Some pre-existing hard wiring of beam group names should ultimately be generalized.For EK80 I only moved
Beam_power
toSonar/Beam_power
. I didn't want to take the time to change it toSonar/Beam_group2
, for now.#567 is not addressed at all in this PR.