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

Merged
seisman merged 16 commits into
mainfrom
grdfill/A
Mar 25, 2025
Merged

seisman merged 16 commits into
mainfrom
grdfill/A

Conversation

@seisman

@seisman seisman commented Mar 17, 2025 •

Copy link
Copy Markdown
Member

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
Comment thread pygmt/src/grdfill.py Resolved
Co-authored-by: Michael Grund <[email protected]>
@seisman seisman added the enhancement Improving an existing feature label Mar 17, 2025
Comment thread pygmt/src/grdfill.py Resolved
Comment thread pygmt/src/grdfill.py Resolved
Co-authored-by: Yvonne Fröhlich <[email protected]>
@seisman
seisman requested a review from Copilot March 18, 2025 04:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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
27 of 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
@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

None yet

Development

Successfully merging this pull request may close these issues.

4 participants