Skip to content

Commit

Permalink
Add inline example for grdsample (#1724)
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Grund <[email protected]>
  • Loading branch information
willschlitzer and michaelgrund authored Feb 20, 2022
1 parent 227ecc3 commit 31b9edf
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions pygmt/src/grdsample.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,20 @@ def grdsample(grid, **kwargs):
- :class:`xarray.DataArray` if ``outgrid`` is not set
- None if ``outgrid`` is set (grid output will be stored in file set by
``outgrid``)
Example
-------
>>> import pygmt # doctest: +SKIP
>>> # Load a grid of @earth_relief_30m data, with an x-range of 10 to 30,
>>> # and a y-range of 15 to 25
>>> grid = pygmt.datasets.load_earth_relief(
... resolution="30m", region=[10, 30, 15, 25]
... ) # doctest: +SKIP
>>> # Create a new grid from an input grid, change the registration,
>>> # and set both x- and y-spacing to 0.5 degrees
>>> new_grid = pygmt.grdsample(
... grid=grid, translate=True, spacing=[0.5, 0.5]
... ) # doctest: +SKIP
"""
with GMTTempFile(suffix=".nc") as tmpfile:
with Session() as lib:
Expand Down

0 comments on commit 31b9edf

Please sign in to comment.