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

Filter reduction_to_pole works only with "northing", "easting" coordinate names #439

Closed
zaarcvon opened this issue Sep 26, 2023 · 1 comment · Fixed by #509
Closed

Filter reduction_to_pole works only with "northing", "easting" coordinate names #439

zaarcvon opened this issue Sep 26, 2023 · 1 comment · Fixed by #509
Labels
bug Report a problem that needs to be fixed

Comments

@zaarcvon
Copy link
Contributor

My first issue on GitHub. Sorry if something is wrong:-)

I found that most filters are insensitive to xarray coordinates names; only the order is important.
But filter reduction_to_pole works only if coordinates have names "northing" and "easting". Otherwise error "'freq_northing' is not a valid dimension or coordinate" appears.

So maybe it could be useful to change row 475 in _filters.py
from:
da_filter.loc[dict(freq_northing=0, freq_easting=0)] = 0
to:
da_filter.loc[{freq_northing.name:0, freq_easting.name:0}] = 0

The current version generates dict with string keys: "freq_northing" and "freq_easting" while the suggested one generates keys according to the initial coordinate names.

@zaarcvon zaarcvon changed the title Issue on page /_modules/harmonica/filters/_filters.html Filter reduction_to_pole works only with "northing", "easting" coordinate names. Sep 26, 2023
@leouieda
Copy link
Member

Hi @zaarcvon thank you for reporting this! Good catch! You'll see that in the rest of the function we avoid using the dimension names precisely for this reason but that line must have slipped past our tests.

The fix you suggests would work and so would something like:

da_filter.loc[{dims[0]=0, dims[1]=0}] = 0

Would you be interested in contributing this fix? If so, have a look at our Contributing Guide. A good test for this would be to change the name the coordinates in one of our test datasets and then run the filter to make sure it doesn't produce an error.

@leouieda leouieda changed the title Filter reduction_to_pole works only with "northing", "easting" coordinate names. Filter reduction_to_pole works only with "northing", "easting" coordinate names Oct 30, 2023
@leouieda leouieda added the bug Report a problem that needs to be fixed label Oct 30, 2023
zaarcvon added a commit to zaarcvon/harmonica that referenced this issue Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Report a problem that needs to be fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants