Skip to content

Commit 31b9edf

Browse files
Add inline example for grdsample (#1724)
Co-authored-by: Michael Grund <[email protected]>
1 parent 227ecc3 commit 31b9edf

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

pygmt/src/grdsample.py

+14
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,20 @@ def grdsample(grid, **kwargs):
7373
- :class:`xarray.DataArray` if ``outgrid`` is not set
7474
- None if ``outgrid`` is set (grid output will be stored in file set by
7575
``outgrid``)
76+
77+
Example
78+
-------
79+
>>> import pygmt # doctest: +SKIP
80+
>>> # Load a grid of @earth_relief_30m data, with an x-range of 10 to 30,
81+
>>> # and a y-range of 15 to 25
82+
>>> grid = pygmt.datasets.load_earth_relief(
83+
... resolution="30m", region=[10, 30, 15, 25]
84+
... ) # doctest: +SKIP
85+
>>> # Create a new grid from an input grid, change the registration,
86+
>>> # and set both x- and y-spacing to 0.5 degrees
87+
>>> new_grid = pygmt.grdsample(
88+
... grid=grid, translate=True, spacing=[0.5, 0.5]
89+
... ) # doctest: +SKIP
7690
"""
7791
with GMTTempFile(suffix=".nc") as tmpfile:
7892
with Session() as lib:

0 commit comments

Comments
 (0)