From 34036bc4f4a4ba3b80eefd972bf52c2e6d551003 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Mon, 13 Jun 2022 19:40:44 +0100 Subject: [PATCH] add inline example to dimfilter.py --- pygmt/src/dimfilter.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/pygmt/src/dimfilter.py b/pygmt/src/dimfilter.py index b618172a3f2..c9dd844e3ca 100644 --- a/pygmt/src/dimfilter.py +++ b/pygmt/src/dimfilter.py @@ -13,6 +13,8 @@ ) from pygmt.io import load_dataarray +__doctest_skip__ = ["dimfilter"] + @fmt_docstring @use_alias( @@ -124,6 +126,25 @@ def dimfilter(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 + >>> # Load a grid of Earth relief data + >>> grid = pygmt.datasets.load_earth_relief() + >>> # Create a filtered grid from an input grid. + >>> filtered_grid = pygmt.dimfilter( + ... grid=grid, + ... # Set filter type to "median" and the diameter width to 600 km + ... filter="m600", + ... # Set grid in degrees, width in km + ... distance=4, + ... # Create 6 sectors and return the lowest values in the sector + ... sectors="l6", + ... # Set the region longitude range from 55W to 51W, and the + ... # latitude range from 24S to 19S + ... region=[-55, -51, -24, -19], + ... ) """ if not all(arg in kwargs for arg in ["D", "F", "N"]) and "Q" not in kwargs: raise GMTInvalidInput(