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.grdfill: Interpolate across holes in a grid #3768

Open
5 of 9 tasks
seisman opened this issue Jan 12, 2025 · 1 comment
Open
5 of 9 tasks

pygmt.grdfill: Interpolate across holes in a grid #3768

seisman opened this issue Jan 12, 2025 · 1 comment
Labels
feature request New feature wanted

Comments

@seisman
Copy link
Member

seisman commented Jan 12, 2025

This is the central issue to track the implementation of the pygmt.grdfill method.

GMT options

Checked: Implemented; Unchecked: To be implemented/discussed; Strikethrough: Won't implement.

@seisman seisman converted this from a draft issue Jan 12, 2025
@seisman seisman added the feature request New feature wanted label Feb 21, 2025
@seisman
Copy link
Member Author

seisman commented Mar 11, 2025

Here are my thoughts on finalizing the wrapper.

-N

This option has different long names across the GMT ecosystem.

  • PyGMT: aliased to no_data. [Need to note that common option -d is aliased to nodata]
  • GMT.jl: aliased to nodata or hole
  • GMT: aliased to hole or hole_value

This option "sets the node value used to identify a point as a member of a hole [Default is NaN].". Personally, I feel hole is a better name than no_data.

-A

This option specifie the hole-filling algorithm to use. Currently it's aliased to mode and can be used like (please refer to the docs for the actual meanings of these arguments):

  • mode="c100"
  • mode="ganother_grid.nc"
  • mode="n0.5"
  • mode="s0.3"

The syntax is not Pythonic, since we have to specify numbers in a string, and for the mode="ganother_grid.nc" case, the "another grid" must be a string, and can't accept a xarray.DataArray object.

In my mind, there are two possible ways to make it more Pythonic:

  1. Two parameters mode and value.

    • mode specifies the filling method. Valid values are "constant", "grid", "neighbor", "spline"
    • value has different meanings for different filling methods, e.g., value=100, value="another_grid.nc", value=0.5, value=0.3
  2. Four exclusive parameters

    • constantfill=100
    • gridfill="anonter_grid.nc" or gridfill=xrgrid
    • neighborfill=True or neighborfill=0.5: 0.5 is the search radius, and True means the default radius
    • splinefill=True/splinefill=0.3: 0.3 is the spline tension, True means no tension.

I prefer the 2nd option.

What do others think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature wanted
Projects
Status: 3) Complete aliases
Development

No branches or pull requests

1 participant