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.surface function 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/surface.html
- GMT.jl: https://www.generic-mapping-tools.org/GMTjl_doc/documentation/modules/surface
- PyGMT: https://www.pygmt.org/dev/api/generated/pygmt.surface.html
GMT Option Flags and Modifiers
☑️: Implemented; ⬜: To be implemented/discussed; Strikethrough: Won't implement.
-
-Aaspect_ratio: Set the aspect ratio for anisotropic data so that the influence of a data constraint in the x-direction is reduced relative to the y-direction [Default is 1, i.e., isotropic]. -
-C(convergence): Convergence limit; iteration stops when the maximum absolute change in any grid value falls below this threshold. -
-Dbreakline: Use breakline as a file of xyz data that defines a discontinuity in the surface; the surface will be interpolated differently on either side of the breakline. -
-G(outgrid): Output grid file name. -
-I(spacing): Grid spacing. -
-Ll(lower): Lower bound on the output solution. -
-Lu(upper): Upper bound on the output solution. -
-M(max_radius): Apply a mask so that nodes farther thanmax_radiusfrom a data constraint are set to NaN. -
-Nmax_iterations: Set the maximum number of iterations [Default is 500]. -
-Q: Suggests strongly that you runblockmedianon your data before surface. [Actually in GMT docs this option controls output of a table of mean z-values at each node.] -
-R(region): Output grid region. -
-T(tension): [b|i] Tension factor(s) applied in the interior and/or at the boundary. -
-V(verbose): Verbosity level. -
-a(aspatial): Aspatial column assignment. -
-b(binary): Binary input/output. -
-d(nodata): Replace NaN with a specified nodata value on input/output. -
-e(find): Pattern matching to select input rows. -
-f(coltypes): Column data types. -
-g: Gap detection. -
-h(header): Read/write header records. -
-i(incols): Select input columns. -
-r(registration): Set grid node registration to gridline or pixel. -
-w(wrap): Wrap repeated cycles. -
: Use--PAR=valuepygmt.configinstead.
Notes on Input Formats
data: Accepts a file path, 2-Dnumpy.ndarray, orpandas.DataFramewith at least 3 columns (x, y, z). Alternatively, providex,y, andzas separate 1-D arrays.outgrid: If not set, returns anxarray.DataArray; if set to a file path, writes the grid to disk and returnsNone.- It is strongly recommended to pre-process data with
pygmt.blockmean,pygmt.blockmedian, orpygmt.blockmodeto reduce aliasing and remove redundant points. - The deprecated
maxradiusparameter (replaced bymax_radiusin v0.18.0) will be removed in v0.20.0.
Linked Pull Requests
- Initial feature implementation – Wrap surface #245
- Add
convergence(-C),lower(-Ll),upper(-Lu),max_radius(-M), andtension(-T) parameters – pygmt.surface: Add aliases for "C", "L", "M", and "T" #2321 - Add inline docstring example
- Implement
-A(aspect ratio for anisotropic data) option - Implement
-D(breakline) option for surfaces with discontinuities - Implement
-N(maximum iterations) option - Implement
-g(gap detection) option - Remove deprecated
maxradiusparameter in v0.20.0
Related Issues and Discussions
pygmt.surfaceis the workhorse gridding function in PyGMT; for the best results, always usepygmt.blockmean(for normally distributed data) orpygmt.blockmedian(for data with outliers) beforehand.- The
-D(breakline) option is particularly important for gridding terrain data across sharp ridges, fault lines, or coastlines where the surface is not smooth. - The
max_radiusparameter (-M) is essential when data coverage is sparse; without it, GMT will interpolate far beyond the data, producing unreliable grid values in unconstrained regions.
Metadata
Metadata
Assignees
Labels
feature requestNew feature wanted
Type
Projects
- StatusShow more project fieldsNo status
Activity