Skip to content

Commit 593d0e0

Browse files
Add inline example to dimfilter (#1956)
1 parent 473db56 commit 593d0e0

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

pygmt/src/dimfilter.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
)
1414
from pygmt.io import load_dataarray
1515

16+
__doctest_skip__ = ["dimfilter"]
17+
1618

1719
@fmt_docstring
1820
@use_alias(
@@ -124,6 +126,25 @@ def dimfilter(grid, **kwargs):
124126
- :class:`xarray.DataArray` if ``outgrid`` is not set
125127
- None if ``outgrid`` is set (grid output will be stored in file set by
126128
``outgrid``)
129+
130+
Example
131+
-------
132+
>>> import pygmt
133+
>>> # Load a grid of Earth relief data
134+
>>> grid = pygmt.datasets.load_earth_relief()
135+
>>> # Create a filtered grid from an input grid.
136+
>>> filtered_grid = pygmt.dimfilter(
137+
... grid=grid,
138+
... # Set filter type to "median" and the diameter width to 600 km
139+
... filter="m600",
140+
... # Set grid in degrees, width in km
141+
... distance=4,
142+
... # Create 6 sectors and return the lowest values in the sector
143+
... sectors="l6",
144+
... # Set the region longitude range from 55W to 51W, and the
145+
... # latitude range from 24S to 19S
146+
... region=[-55, -51, -24, -19],
147+
... )
127148
"""
128149
if not all(arg in kwargs for arg in ["D", "F", "N"]) and "Q" not in kwargs:
129150
raise GMTInvalidInput(

0 commit comments

Comments
 (0)