Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add inline example to dimfilter #1956

Merged
merged 1 commit into from
Jun 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions pygmt/src/dimfilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
)
from pygmt.io import load_dataarray

__doctest_skip__ = ["dimfilter"]


@fmt_docstring
@use_alias(
Expand Down Expand Up @@ -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(
Expand Down