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

pygmt.grdclip: Deprecate parameter 'new' to 'replace' (remove in v0.19.0) #3884

Merged
merged 4 commits into from
Mar 31, 2025

Conversation

seisman
Copy link
Member

@seisman seisman commented Mar 29, 2025

Addressing #3882 (comment).

Hopefully it can be approved and merged into v0.15.0

@seisman seisman added deprecation Deprecating a feature skip-changelog Skip adding Pull Request to changelog needs review This PR has higher priority and needs review. labels Mar 29, 2025
@seisman seisman added this to the 0.15.0 milestone Mar 29, 2025
Copy link
Member

@yvonnefroehlich yvonnefroehlich left a comment

Choose a reason for hiding this comment

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

Should we add tests for this parameter and the usage of the old parmeter name?

Similar to the mode parameter of grdfill:

# TODO(PyGMT>=0.19.0): Remove this test.
def test_grdfill_deprecated_mode(grid, expected_grid):
"""
Test that grdfill fails with deprecated `mode` argument.
"""
with pytest.warns(FutureWarning):
result = grdfill(grid=grid, mode="c20")
xr.testing.assert_allclose(a=result, b=expected_grid)

Currently, it looks like only above, below and between are included in the tests (https://github.com/GenericMappingTools/pygmt/blob/main/pygmt/tests/test_grdclip.py).

@seisman
Copy link
Member Author

seisman commented Mar 30, 2025

Should we add tests for this parameter and the usage of the old parmeter name?

Similar to the mode parameter of grdfill:

# TODO(PyGMT>=0.19.0): Remove this test.
def test_grdfill_deprecated_mode(grid, expected_grid):
"""
Test that grdfill fails with deprecated `mode` argument.
"""
with pytest.warns(FutureWarning):
result = grdfill(grid=grid, mode="c20")
xr.testing.assert_allclose(a=result, b=expected_grid)

Currently, it looks like only above, below and between are included in the tests (https://github.com/GenericMappingTools/pygmt/blob/main/pygmt/tests/test_grdclip.py).

Thanks. Added.

@seisman seisman mentioned this pull request Mar 30, 2025
16 tasks
@seisman seisman changed the title pygmt.grdclip: Deprecate parameter 'new' to 'replace' (will be removed in v0.19.0) pygmt.grdclip: Deprecate parameter 'new' to 'replace' (remove in v0.19.0) Mar 30, 2025
npt.assert_array_equal(np.unique(grid), [1, 2])

# Test for the deprecated 'new' parameter
# TODO(PyGMT>=0.19.0): Remove this test for the 'new' parameter
Copy link
Member

Choose a reason for hiding this comment

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

Clarify that only the test below is to be removed, not the entire unit test.

Suggested change
# TODO(PyGMT>=0.19.0): Remove this test for the 'new' parameter
# TODO(PyGMT>=0.19.0): Remove this test below for the 'new' parameter

Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
@seisman seisman merged commit 8e4cc96 into main Mar 31, 2025
19 of 20 checks passed
@seisman seisman deleted the grdclip/new branch March 31, 2025 00:04
@seisman seisman removed needs review This PR has higher priority and needs review. skip-changelog Skip adding Pull Request to changelog labels Mar 31, 2025
seisman added a commit that referenced this pull request Mar 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deprecation Deprecating a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants