Repository navigation
Closed
Labels
feature requestNew feature wanted
Description
This issue serves as the central place for discussing and tracking the implementation of the pygmt.dimfilter method in PyGMT. The issue will be closed when the initial implementation is complete. Progress is tracked at PyGMT: Wrapping GMT modules.
Documentation
- GMT: https://docs.generic-mapping-tools.org/dev/dimfilter.html
- GMT.jl: https://www.generic-mapping-tools.org/GMTjl_doc/documentation/modules/dimfilter
- PyGMT: https://www.pygmt.org/dev/api/generated/pygmt.dimfilter.html
GMT Option Flags and Modifiers
☑️: Implemented; ⬜: To be implemented/discussed; Strikethrough: Won't implement.
: Not applicable (no map output).-B- ☑️
-D:distance– Distance flag specifying how grid (x,y) relates to filter width (Cartesian or Spherical). - ☑️
-F:filter– Primary filter type (boxcar,cosine arch,gaussian,median,pmode), followed by diameter width and optional+l/+umodifiers. - ☑️
-G:outgrid– Output grid file name. - ☑️
-I:spacing– Output grid increment (x_inc[/y_inc]). : Not applicable (no map projection output).-J- ☑️
-N:sectors– Secondary filter type (lower,upper,average,median,pmode) and number of bow-tie sectors, with optional+l/+umodifiers. - ⬜
-Q: Quick mode – Applies sector averaging without spatial filtering (i.e., skip the primary filter step). Currently passable via**kwargsbut not formally aliased. - ☑️
-R:region– Output region[xmin, xmax, ymin, ymax]. - ⬜
-T: Toggle node registration – If the output should have the opposite registration to the input grid. - ☑️
-V:verbose– Verbosity level. : Use-X/-YFigure.shift_origininstead.: Use--PAR=valuepygmt.configinstead.
Related GMT configurations
No specific GMT defaults are known to affect dimfilter output. Users working with geographic grids and large filter widths may want to verify PROJ_ELLIPSOID is set appropriately when using spherical distance calculations (distance=4).
Notes on Input Formats
grid: Accepts a file path (string orpathlib.Path) or anxarray.DataArrayrepresenting a 2-D raster grid.filter(-F): A string of the form<code><width>[+l|+u], e.g."m600"for a 600 km wide median filter. The width unit is kilometres whendistanceis ≥ 1, or the same units as the grid whendistance=0.sectors(-N): A string of the form<code><sectors>[+l|+u], e.g."l6"for six sectors using the lower (minimum) secondary filter.distance(-D): An integer 0–4 controlling how horizontal distances are computed; higher values use more accurate (but slower) spherical geometry.- At least one of
distance,filter, andsectorsmust be provided unless-Q(quick mode) is used.
Linked Pull Requests
- Initial feature implementation – #1492
- Add inline doctest example – #1956
- Formally alias
-Q(quick mode) and-T(toggle registration) - Add a tutorial or gallery example demonstrating directional filtering and comparison with
pygmt.grdfilter
Related Issues and Discussions
- The
dimfilterfunction is also exposed via thexarrayaccessor (DataArray.gmt.dimfilter). - For follow-up smoothing of DiM-filtered output (which can be rough), see
pygmt.grdfilter(Gaussian or other isotropic filters). - Upstream GMT reference: Wessel, P., and Bercovici, D. (1998), "Interpolation with splines in tension: A Green's function approach", Mathematical Geology, 30, 77–93.
Metadata
Metadata
Assignees
Labels
feature requestNew feature wanted
Type
Projects
- StatusShow more project fieldsNo status
Activity