From 9dc96c92ebe718eb26b7335c69c549ea8c899b88 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Tue, 20 Dec 2022 12:54:43 -0500 Subject: [PATCH 1/2] add inline example to load_earth_magnetic_anomaly --- pygmt/datasets/earth_magnetic_anomaly.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/pygmt/datasets/earth_magnetic_anomaly.py b/pygmt/datasets/earth_magnetic_anomaly.py index 80a66358161..541291031e3 100644 --- a/pygmt/datasets/earth_magnetic_anomaly.py +++ b/pygmt/datasets/earth_magnetic_anomaly.py @@ -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( @@ -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="30m", registration="gridline", mag4km=True + ... ) """ dataset_prefix = "earth_mag4km_" if mag4km is True else "earth_mag_" grid = _load_remote_dataset( From ccfd1e6e39a44690471c8ef1e8ca4e503425290a Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Tue, 20 Dec 2022 22:10:12 -0500 Subject: [PATCH 2/2] Update pygmt/datasets/earth_magnetic_anomaly.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com> --- pygmt/datasets/earth_magnetic_anomaly.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/datasets/earth_magnetic_anomaly.py b/pygmt/datasets/earth_magnetic_anomaly.py index 541291031e3..1ad9bfae223 100644 --- a/pygmt/datasets/earth_magnetic_anomaly.py +++ b/pygmt/datasets/earth_magnetic_anomaly.py @@ -90,7 +90,7 @@ def load_earth_magnetic_anomaly( ... ) >>> # load the 20 arc-minutes grid of the mag4km dataset >>> grid = load_earth_magnetic_anomaly( - ... resolution="30m", registration="gridline", mag4km=True + ... resolution="20m", registration="gridline", mag4km=True ... ) """ dataset_prefix = "earth_mag4km_" if mag4km is True else "earth_mag_"