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.grdtrack 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/grdtrack.html
- GMT.jl: https://www.generic-mapping-tools.org/GMTjl_doc/documentation/modules/grdtrack
- PyGMT: https://www.pygmt.org/dev/api/generated/pygmt.grdtrack.html
GMT Option Flags and Modifiers
☑️: Implemented; ⬜: To be implemented/discussed; Strikethrough: Won't implement.
- ☑️
-A(resample): Track resampling method for cross-profiles:"f"(keep original + add intermediate),"m"(meridian-first),"p"(parallel-first),"r"(equidistant),"R"(equidistant, fit length exactly); append+lfor loxodrome distances. - ☑️
-C(crossprofile): Create equidistant cross-profiles along input line segments, controlled by length, sampling interval, and optional spacing. - ☑️
-D(dfile): Save the (possibly resampled) original input lines to a separate file when usingcrossprofile. - ☑️
-E(profile): Define one or more sampling profiles by coordinates or map-justification keys, without reading an input track file. - ☑️
-F(critical): Find critical points (peak, flanks, width, balance point) along each cross-profile. - ☑️
-G(grid): Path to orxarray.DataArrayof the grid to sample (positional argument in PyGMT, not a flag). - ☑️
-N(no_skip): Do not skip points outside the grid domain. - ☑️
-R(region): Restrict output to this subregion. - ☑️
-S(stack): Stack cross-profiles using a chosen method ("a","m","p","l","L","u","U"); control output with+a,+d,+r,+s,+c. - ☑️
-T(radius): Search outward from NaN nodes to find the nearest non-NaN value; optionally limit radius and report node location (+e) or snap input to node (+p). - ☑️
-V(verbose): Verbosity level. - ☑️
-Z(z_only): Output only sampled z-values instead of all input columns plus z. : Use-X/-YFigure.shift_origininstead.- ☑️
-a(aspatial): Aspatial column assignment. - ☑️
-b(binary): Binary input/output. - ☑️
-d(nodata): Replace NaN with a specified value on output. - ☑️
-e(find): Pattern matching to select input rows. - ☑️
-f(coltypes): Column data types. - ☑️
-g(gap): Gap detection. - ☑️
-h(header): Read/write header records. - ☑️
-i(incols): Select input columns. - ☑️
-j(distcalc): Distance calculation mode (great circle, rhumb, Cartesian). - ☑️
-n(interpolation): Interpolation method and boundary conditions. - ☑️
-o(outcols): Select output columns. - ☑️
-s(skiprows): Skip rows containing NaN values. - ☑️
-w(wrap): Wrap repeated cycles. : Use--PAR=valuepygmt.configinstead.
Notes on Input Formats
grid: Accepts a file path orxarray.DataArray; multiple grids can be passed as a list.points: Accepts a file path,numpy.ndarray, orpandas.DataFramewith (x, y) in the first two columns. Mutually exclusive withprofile(-E).newcolname: Required whenpointsis apandas.DataFrame; names the appended z-column in the outputDataFrame.output_type:"pandas"(default),"numpy", or"file". Use"file"together withoutfile.profileandpointsare mutually exclusive; providing both raisesGMTParameterError.
Linked Pull Requests
- Initial feature implementation – Fix typo in tutorials #953
- Accept
xarray.DataArrayas grid input – Let Figure.savefig support filenames with spaces #1116 - Improve output type handling – Remove the setup.cfg file #2290
- Add inline docstring example – Fix typos in syntax for highlighting #2082
- Add a gallery or tutorial example (e.g., sampling topography along a ship track or a great-circle profile across a mountain range)
Related Issues and Discussions
- For extracting all grid nodes as an xyz table, use
pygmt.grd2xyzinstead. - The
crossprofile+stackworkflow is widely used in marine geology to analyse mid-ocean ridge bathymetry perpendicular to ridge strike. - When
profileis used instead ofpoints, no track file is read; profiles are constructed on-the-fly from coordinate pairs or map-key anchors.
Metadata
Metadata
Assignees
Labels
feature requestNew feature wanted
Type
Projects
- StatusShow more project fieldsNo status
Activity