Skip to content

Commit 312f6b0

Browse files
Add inline example to load_earth_magnetic_anomaly (#2259)
Co-authored-by: Yvonne Fröhlich <[email protected]>
1 parent d460d7b commit 312f6b0

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

pygmt/datasets/earth_magnetic_anomaly.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
from pygmt.datasets.load_remote_dataset import _load_remote_dataset
88
from pygmt.helpers import kwargs_to_strings
99

10+
__doctest_skip__ = ["load_earth_magnetic_anomaly"]
11+
1012

1113
@kwargs_to_strings(region="sequence")
1214
def load_earth_magnetic_anomaly(
@@ -69,6 +71,27 @@ def load_earth_magnetic_anomaly(
6971
The :class:`xarray.DataArray` grid doesn't support slice operation, for
7072
Earth magnetic anomaly with resolutions of 5 arc-minutes or higher,
7173
which are stored as smaller tiles.
74+
75+
Examples
76+
--------
77+
78+
>>> from pygmt.datasets import load_earth_magnetic_anomaly
79+
>>> # load the default grid (gridline-registered 1 arc-degree grid)
80+
>>> grid = load_earth_magnetic_anomaly()
81+
>>> # load the 30 arc-minutes grid with "gridline" registration
82+
>>> grid = load_earth_magnetic_anomaly(
83+
... resolution="30m", registration="gridline"
84+
... )
85+
>>> # load high-resolution (5 arc-minutes) grid for a specific region
86+
>>> grid = load_earth_magnetic_anomaly(
87+
... resolution="05m",
88+
... region=[120, 160, 30, 60],
89+
... registration="gridline",
90+
... )
91+
>>> # load the 20 arc-minutes grid of the mag4km dataset
92+
>>> grid = load_earth_magnetic_anomaly(
93+
... resolution="20m", registration="gridline", mag4km=True
94+
... )
7295
"""
7396
dataset_prefix = "earth_mag4km_" if mag4km is True else "earth_mag_"
7497
grid = _load_remote_dataset(

0 commit comments

Comments
 (0)