Repository navigation
Closed
Labels
feature requestNew feature wanted
Milestone
Description
This issue serves as the central place for discussing and tracking the implementation of the pygmt.grdproject 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/grdproject.html
- GMT.jl: https://www.generic-mapping-tools.org/GMTjl_doc/documentation/modules/grdproject
- PyGMT: https://www.pygmt.org/dev/api/generated/pygmt.grdproject.html
GMT Option Flags and Modifiers
☑️: Implemented; ⬜: To be implemented/discussed; Strikethrough: Won't implement.
-
-C(center): Set projected coordinates relative to the projection center; optionally add false eastings/northings (dx/dy). -
-D(spacing): Set output grid node spacing dx[/dy]. -
-E(dpi): Set output grid resolution in dots per inch. -
-F(scaling): Force 1:1 scaling in actual projected metres, or specify a length unit ("c","i","p","e","f","k","M","n","u"). -
-G(outgrid): Output grid file path; if unset, returns anxarray.DataArray. -
-I(inverse): Perform the inverse transformation (rectangular → geographic) instead of the forward projection. -
-J(projection): Map projection to use (required). -
-M(unit): Set the projected length unit ("c"centimetres,"i"inches,"p"points). -
-R(region): Subsample or extend the input grid to this region before projecting. -
-V(verbose): Verbosity level. : Use-X/-YFigure.shift_origininstead.-
-n(interpolation): Interpolation method and boundary condition flags. -
-r(registration): Set node registration ("gridline"or"pixel"). : Use--PAR=valuepygmt.configinstead.
Notes on Input Formats
grid: Accepts a file path orxarray.DataArray. For the forward projection, the input must be in geographic (lon/lat) coordinates.projection(-J) is required; omitting it raisesGMTParameterError.unitandscalingare mutually exclusive; providing both raisesGMTParameterError.- Returns
xarray.DataArraywhenoutgridis unset; returnsNonewhenoutgridis a file path. - When neither
spacingnordpiis set, GMT selects a suitable output resolution automatically.
Linked Pull Requests
- Initial feature implementation
- Add inline docstring example
- Add a gallery or tutorial example demonstrating forward and inverse projection (e.g., projecting a global relief grid into a Mercator raster and back)
Related Issues and Discussions
- Complementary to
pygmt.grdcut(spatial subsetting) andpygmt.grdsample(resampling on an existing layout). - The forward projection is a key step when comparing satellite imagery (Cartesian) with geographic model output.
- The
inverseoption allows converting a Cartesian-coordinates grid (e.g., from a numerical model) back to geographic lon/lat nodes.
Metadata
Metadata
Assignees
Labels
feature requestNew feature wanted
Type
Projects
- StatusShow more project fieldsNo status
Activity