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 load_earth_magnetic_anomaly #2259

Merged
merged 3 commits into from
Dec 21, 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
23 changes: 23 additions & 0 deletions pygmt/datasets/earth_magnetic_anomaly.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
from pygmt.datasets.load_remote_dataset import _load_remote_dataset
from pygmt.helpers import kwargs_to_strings

__doctest_skip__ = ["load_earth_magnetic_anomaly"]


@kwargs_to_strings(region="sequence")
def load_earth_magnetic_anomaly(
Expand Down Expand Up @@ -69,6 +71,27 @@ def load_earth_magnetic_anomaly(
The :class:`xarray.DataArray` grid doesn't support slice operation, for
Earth magnetic anomaly with resolutions of 5 arc-minutes or higher,
which are stored as smaller tiles.

Examples
--------

>>> from pygmt.datasets import load_earth_magnetic_anomaly
>>> # load the default grid (gridline-registered 1 arc-degree grid)
>>> grid = load_earth_magnetic_anomaly()
>>> # load the 30 arc-minutes grid with "gridline" registration
>>> grid = load_earth_magnetic_anomaly(
... resolution="30m", registration="gridline"
... )
>>> # load high-resolution (5 arc-minutes) grid for a specific region
>>> grid = load_earth_magnetic_anomaly(
... resolution="05m",
... region=[120, 160, 30, 60],
... registration="gridline",
... )
>>> # load the 20 arc-minutes grid of the mag4km dataset
>>> grid = load_earth_magnetic_anomaly(
... resolution="20m", registration="gridline", mag4km=True
... )
"""
dataset_prefix = "earth_mag4km_" if mag4km is True else "earth_mag_"
grid = _load_remote_dataset(
Expand Down