Skip to content

Support frequency nominal in consolidate functions#1734

Open
ctuguinay wants to merge 13 commits into
echostack-org:mainfrom
ctuguinay:freq_nominal_dim
Open

Support frequency nominal in consolidate functions#1734
ctuguinay wants to merge 13 commits into
echostack-org:mainfrom
ctuguinay:freq_nominal_dim

Conversation

@ctuguinay

Copy link
Copy Markdown
Collaborator

Additionally enforces that channel or frequency nominal exists in all datasets passed into the consolidate functions.

This is a slight modification of #1520 by @dbashford-NOAA without code conflicts with the more recent changes.

When merged, it closes #1488.

@ctuguinay

Copy link
Copy Markdown
Collaborator Author

@LOCEANlloydizard @leewujung I think this is ready to review. I think I addressed all the comments from the previous PR, but let me know if I didn't catch something.

Comment thread echopype/consolidate/api.py Outdated
Comment on lines 215 to 220
dim_0 = get_dim_0(ds)
# Identify beam group name by checking `dim_0` values of `ds`
if echodata["Sonar/Beam_group1"][dim_0].equals(ds[dim_0]):
beam_group_name = "Beam_group1"
else:
beam_group_name = "Beam_group2"

@leewujung leewujung Jul 23, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this logic would no longer work with the ping sequencing capability on WBAT, since the same channel can be configured to transmit both FM and CW signals and record in either complex or power-angle format. On WBT this would be fine since each ping library entry will produce a _1, _2, etc postfix as the channel_id.

Is there another way we can find the right channel beam directions from the echodata object?

How about using the channel_all and beam_group_index variables in the Sonar group that we added to help index the beam group to calibrate?

Comment thread echopype/consolidate/api.py Outdated
Comment on lines +507 to +508
# Select beam group based on dim_0
ds_beam = echodata[ed_beam_group].sel({dim_0: source_Sv[dim_0].values})

@leewujung leewujung Jul 23, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same as my comment above, this logic would not work and needs to be updated.

@leewujung leewujung left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hey @ctuguinay : Thanks for sorting through the previous PR and consolidating the changes to this new one! I know you didn't write the previous code but please help with the following requested changes.

I see a few .sel({dim_0: dim_0_id} usages which try to use whatever dim_0 is (either frequency_nominal or channel) to slice datasets or dataarrays. I think a better way is to use get_dim_0 to find out what dim_0 is, and if it is frequency_nominal, map it back to channel using what's in Sonar/channel_all, so that all the indexing is done using channel. This is because we align pretty everything in our code to be the channel_if, and in view of #1721, it's better to just keep all indexing using channel to future proof the code.

I also suggest the following to keep things a bit tidier:

  • rename loc_utils.py to utils_loc.py
  • move get_dim_0 to utils_loc.py
  • rename ek_depth_utils.py to utils._ek_depth.py

One of my comments requires a bit of consideration to figure out a good solution. Let me know if you want to bounce ideas.

@ctuguinay ctuguinay closed this Jul 24, 2026
@ctuguinay ctuguinay reopened this Jul 24, 2026
@ctuguinay

Copy link
Copy Markdown
Collaborator Author

@leewujung This should be ready for another look 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support dimension alignment with frequency_nominal for all ep.consolidate functions

2 participants