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

Make reduce_to_pole work for arbitrary dimension names #509

Merged
Merged
2 changes: 1 addition & 1 deletion harmonica/filters/_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ def reduction_to_pole_kernel(
magnetization_declination,
)
# Set 0 wavenumber to 0
da_filter.loc[dict(freq_northing=0, freq_easting=0)] = 0
da_filter.loc[{dims[0]: 0, dims[1]: 0}] = 0
return da_filter


Expand Down
10 changes: 10 additions & 0 deletions harmonica/tests/test_transformations.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,16 @@ def test_upward_continuation(sample_g_z, sample_g_z_upward):
xrt.assert_allclose(continuation, g_z_upward, atol=1e-8)


def test_reduction_to_pole(sample_potential):
"""
Test reduction_to_pole function with non-typical dim names
"""
renamed_dims_grid = sample_potential.rename(
{"easting": "name_one", "northing": "name_two"}
)
reduction_to_pole(renamed_dims_grid, 60, 45)


class TestTotalGradientAmplitude:
"""
Test total_gradient_amplitude function
Expand Down