Skip to content

Conversation

@seisman
Copy link
Member

@seisman seisman commented Dec 20, 2025

This PR migrates the nans parameter to the new alias system and also make it support descrptive arguments ignore, replace and preserve.

Preview:

Currently, GMT recommends ignore/coregnan/anynan, but I feel they're not good. An upstream PR at GenericMappingTools/gmt#8842.

Related to #4252.

@seisman seisman added this to the 0.18.0 milestone Dec 20, 2025
@seisman seisman added enhancement Improving an existing feature needs review This PR has higher priority and needs review. labels Dec 20, 2025
@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 Dec 25, 2025
Comment on lines +96 to +97
Determine how NaN-values in the input grid affect the filtered output. Choose
one of:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Determine how NaN-values in the input grid affect the filtered output. Choose
one of:
Determine how NaN-values in the input grid affect the filtered output grid.
Choose one of:

*width* in km, Spherical distance calculation.
$spacing
nans : str or float
Copy link
Member

Choose a reason for hiding this comment

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

Seems like the input datatype "float" was actually not correct / a typo.

Comment on lines +139 to +140
>>> # Apply a Gaussian smoothing filter of 600 km to the input DataArray and return
>>> # a filtered DataArray with the smoothed field
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
>>> # Apply a Gaussian smoothing filter of 600 km to the input DataArray and return
>>> # a filtered DataArray with the smoothed field
>>> # Apply a Gaussian smoothing filter of 600 km to the input DataArray and return
>>> # a filtered DataArray with the smoothed grid.

Comment on lines +100 to +102
- ``"replace"``: Similar to ``"ignore"`` except if the input node was NaN then
the output node will be set to NaN (only applies if both grids are
co-registered).
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- ``"replace"``: Similar to ``"ignore"`` except if the input node was NaN then
the output node will be set to NaN (only applies if both grids are
co-registered).
- ``"replace"``: Similar to ``"ignore"`` except if the input node was NaN then
the output node will be set to NaN (only applied if both grids are
co-registered).

Comment on lines +128 to +129
>>> # Apply a filter of 600 km (full width) to the @earth_relief_30m_g file and
>>> # return a filtered field (saved as netCDF)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
>>> # Apply a filter of 600 km (full width) to the @earth_relief_30m_g file and
>>> # return a filtered field (saved as netCDF)
>>> # Apply a median filter of 600 km (full width) to the @earth_relief_30m_g grid
>>> # and return a filtered grid (saved as netCDF file).

Not sure what "full width" means. The GMT docs for D of grdfilter say for D=4 (distance=4):

flag = 4: grid (x, y) in degrees, width in km, Spherical distance calculation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improving an existing feature final review call This PR requires final review and approval from a second reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants