Skip to content

Commit 586f2d9

Browse files
Add inline example for grdcut (#1689)
Example to create a new grid from an input grid using pygmt.grdcut. Co-authored-by: Meghan Jones <[email protected]>Create a new grid from an input grid
1 parent 24a166a commit 586f2d9

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

pygmt/src/grdcut.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,20 @@ def grdcut(grid, **kwargs):
8787
- :class:`xarray.DataArray` if ``outgrid`` is not set
8888
- None if ``outgrid`` is set (grid output will be stored in file set by
8989
``outgrid``)
90+
91+
Examples
92+
--------
93+
>>> import pygmt # doctest: +SKIP
94+
>>> # Load a grid of @earth_relief_30m data, with an x-range of 10 to 30,
95+
>>> # and a y-range of 15 to 25
96+
>>> grid = pygmt.datasets.load_earth_relief(
97+
... resolution="30m", region=[10, 30, 15, 25]
98+
... ) # doctest: +SKIP
99+
>>> # Create a new grid from an input grid, with an x-range of 12 to 15,
100+
>>> # and a y-range of 21 to 24
101+
>>> new_grid = pygmt.grdcut(
102+
... grid=grid, region=[12, 15, 21, 24]
103+
... ) # doctest: +SKIP
90104
"""
91105
with GMTTempFile(suffix=".nc") as tmpfile:
92106
with Session() as lib:

0 commit comments

Comments
 (0)