Skip to content

Commit d85bfdf

Browse files
willschlitzermichaelgrundseismanMeghan Jones
authored
Add inline example for grdtrack (#1725)
Co-authored-by: Michael Grund <[email protected]> Co-authored-by: Dongdong Tian <[email protected]> Co-authored-by: Meghan Jones <[email protected]>
1 parent fc352ca commit d85bfdf

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

pygmt/src/grdtrack.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
use_alias,
1313
)
1414

15+
__doctest_skip__ = ["grdtrack"]
16+
1517

1618
@fmt_docstring
1719
@use_alias(
@@ -264,6 +266,22 @@ def grdtrack(points, grid, newcolname=None, outfile=None, **kwargs):
264266
``outfile`` is not set
265267
- None if ``outfile`` is set (track output will be stored in file set
266268
by ``outfile``)
269+
270+
Example
271+
-------
272+
>>> import pygmt
273+
>>> # Load a grid of @earth_relief_30m data, with an x-range of -118 to
274+
>>> # -107, and a y-range of -49 to -42
275+
>>> grid = pygmt.datasets.load_earth_relief(
276+
... resolution="30m", region=[-118, -107, -49, -42]
277+
... )
278+
>>> # Load a pandas dataframe with ocean ridge points
279+
>>> points = pygmt.datasets.load_sample_data(name="ocean_ridge_points")
280+
>>> # Create a pandas dataframe from an input grid and set of points
281+
>>> # The output dataframe adds a column named "bathymetry"
282+
>>> output_dataframe = pygmt.grdtrack(
283+
... points=points, grid=grid, newcolname="bathymetry"
284+
... )
267285
"""
268286
if hasattr(points, "columns") and newcolname is None:
269287
raise GMTInvalidInput("Please pass in a str to 'newcolname'")

0 commit comments

Comments
 (0)