Skip to content

Commit 2acfe4d

Browse files
Add inline example for grdproject (#1722)
1 parent b16d10d commit 2acfe4d

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

pygmt/src/grdproject.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,21 @@ def grdproject(grid, **kwargs):
9595
- :class:`xarray.DataArray` if ``outgrid`` is not set
9696
- None if ``outgrid`` is set (grid output will be stored in file set by
9797
``outgrid``)
98+
99+
Example
100+
-------
101+
>>> import pygmt # doctest: +SKIP
102+
>>> # Load a grid of @earth_relief_30m data, with an x-range of 10 to 30,
103+
>>> # and a y-range of 15 to 25
104+
>>> grid = pygmt.datasets.load_earth_relief(
105+
... resolution="30m", region=[10, 30, 15, 25]
106+
... ) # doctest: +SKIP
107+
>>> # Create a new grid from the input grid, set the projection to
108+
>>> # Mercator, and set inverse to "True" to change from "geographic"
109+
>>> # to "rectangular"
110+
>>> new_grid = pygmt.grdproject(
111+
... grid=grid, projection="M10c", inverse=True
112+
... ) # doctest: +SKIP
98113
"""
99114
if "J" not in kwargs:
100115
raise GMTInvalidInput("The projection must be specified.")

0 commit comments

Comments
 (0)