Skip to content

pygmt.grdfill: Deprecate parameter 'mode' and add parameters 'constantfill/gridfill/neighborfill/splinefill' (deprecated since v0.15.0 and will be removed in v0.19.0) #3855

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

Merged
merged 16 commits into from
Mar 25, 2025

Conversation

seisman
Copy link
Member

@seisman seisman commented Mar 17, 2025

Address #3768 (comment).

Preview: https://pygmt-dev--3855.org.readthedocs.build/en/3855/api/generated/pygmt.grdfill.html#pygmt.grdfill

Changes in this PR:

  1. Deprecate the mode parameter (will be removed in v0.19.0)
  2. Add new parameters constantfill/gridfill/neighborfill/splinefill, which are more Pythonic aliases for the grdfill -N option. With the new parameters, now it's possible to fill holes by sampling an xr.DataArray grid (via virtualfile)
  3. Add some tests.

@seisman seisman added deprecation Deprecating a feature needs review This PR has higher priority and needs review. labels Mar 17, 2025
@seisman seisman added this to the 0.15.0 milestone Mar 17, 2025
Co-authored-by: Michael Grund <[email protected]>
@seisman seisman added the enhancement Improving an existing feature label Mar 17, 2025
Co-authored-by: Yvonne Fröhlich <[email protected]>
@seisman seisman requested a review from Copilot March 18, 2025 04:23
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR deprecates the legacy "mode" parameter in favor of more explicit fill parameters and adds tests to cover the updated behavior.

  • Deprecate the "mode" parameter and warn/error when used with new parameters.
  • Add new parameters (constantfill, gridfill, neighborfill, splinefill) to fill grid holes.
  • Introduce additional tests for gridfill and the deprecated mode behavior.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
pygmt/tests/test_grdfill.py Updated tests to use new parameters and added tests for gridfill and deprecated mode.
pygmt/src/grdfill.py Refactored grdfill to use explicit fill parameters and introduced a helper to parse fill options.
Comments suppressed due to low confidence (1)

pygmt/src/grdfill.py:142

  • Consider increasing the stacklevel (e.g., to 2) in warnings.warn so that the deprecation warning correctly points to the user’s call site rather than the internal function call.
warnings.warn(

@seisman seisman added final review call This PR requires final review and approval from a second reviewer and removed needs review This PR has higher priority and needs review. labels Mar 23, 2025
@seisman seisman mentioned this pull request Mar 23, 2025
29 tasks
@seisman seisman removed the final review call This PR requires final review and approval from a second reviewer label Mar 25, 2025
@seisman seisman merged commit 02a1daf into main Mar 25, 2025
22 of 23 checks passed
@seisman seisman deleted the grdfill/A branch March 25, 2025 07:11
@github-project-automation github-project-automation bot moved this from In Progress to Done in Pythonic GMT arguments Mar 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deprecation Deprecating a feature enhancement Improving an existing feature
Projects
Development

Successfully merging this pull request may close these issues.

3 participants