Skip to content

Commit 4fa8af8

Browse files
authored
Merge branch 'main' into doc/alias-list
2 parents 710dde2 + e890738 commit 4fa8af8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+243
-157
lines changed

.github/workflows/ci_tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ jobs:
183183

184184
# Upload coverage to Codecov
185185
- name: Upload coverage to Codecov
186-
uses: codecov/codecov-action@v5.4.2
186+
uses: codecov/codecov-action@v5.4.3
187187
if: success() || failure()
188188
with:
189189
use_oidc: true

pygmt/datasets/load_remote_dataset.py

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@
77
from typing import Any, Literal, NamedTuple
88

99
import xarray as xr
10-
from pygmt.clib import Session
1110
from pygmt.exceptions import GMTInvalidInput
12-
from pygmt.helpers import build_arg_list, kwargs_to_strings
13-
from pygmt.src import which
1411

1512
with contextlib.suppress(ImportError):
1613
# rioxarray is needed to register the rio accessor
@@ -502,7 +499,6 @@ class GMTRemoteDataset(NamedTuple):
502499
}
503500

504501

505-
@kwargs_to_strings(region="sequence")
506502
def _load_remote_dataset(
507503
name: str,
508504
prefix: str,
@@ -581,23 +577,9 @@ def _load_remote_dataset(
581577
raise GMTInvalidInput(msg)
582578

583579
fname = f"@{prefix}_{resolution}_{reg}"
584-
kwdict = {"R": region, "T": {"grid": "g", "image": "i"}[dataset.kind]}
585-
with Session() as lib:
586-
with lib.virtualfile_out(kind=dataset.kind) as voutgrd:
587-
lib.call_module(
588-
module="read",
589-
args=[fname, voutgrd, *build_arg_list(kwdict)],
590-
)
591-
grid = lib.virtualfile_to_raster(
592-
kind=dataset.kind, outgrid=None, vfname=voutgrd
593-
)
594-
595-
# Full path to the grid
596-
source: str | list = which(fname, verbose="q")
597-
if resinfo.tiled:
598-
source = sorted(source)[0] # get first grid for tiled grids
599-
# Manually add source to xarray.DataArray encoding to make the GMT accessors work.
600-
grid.encoding["source"] = source
580+
grid = xr.load_dataarray(
581+
fname, engine="gmt", raster_kind=dataset.kind, region=region
582+
)
601583

602584
# Add some metadata to the grid
603585
grid.attrs["description"] = dataset.description

pygmt/figure.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import base64
66
import os
7+
import warnings
78
from pathlib import Path
89
from tempfile import TemporaryDirectory
910
from typing import Literal, overload
@@ -119,12 +120,19 @@ def _activate_figure(self) -> None:
119120
with Session() as lib:
120121
lib.call_module(module="figure", args=[self._name, fmt])
121122

123+
# TODO(PyGMT>=v0.18.0): Remove the _preprocess method.
122124
def _preprocess(self, **kwargs):
123125
"""
124126
Call the ``figure`` module before each plotting command to ensure we're plotting
125127
to this particular figure.
126128
"""
127129
self._activate_figure()
130+
warnings.warn(
131+
"The Figure._preprocess() method is deprecated since v0.16.0 and will be "
132+
"removed in v0.18.0. Use Figure._activate_figure() instead.",
133+
FutureWarning,
134+
stacklevel=2,
135+
)
128136
return kwargs
129137

130138
@property

pygmt/helpers/caching.py

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,53 +13,76 @@ def cache_data() -> None:
1313
datasets = [
1414
# List of GMT remote datasets.
1515
"@earth_age_01d_g",
16-
"@earth_day_01d",
17-
"@earth_dist_01d",
18-
"@earth_edefl_01d",
16+
"@earth_age_30m_g",
17+
"@earth_day_01d_p",
18+
"@earth_dist_01d_g",
19+
"@earth_dist_30m_g",
20+
"@earth_edefl_01d_g",
21+
"@earth_edefl_30m_g",
1922
"@earth_faa_01d_g",
23+
"@earth_faa_30m_g",
2024
"@earth_faaerror_01d_g",
2125
"@earth_gebco_01d_g",
2226
"@earth_gebcosi_01d_g",
2327
"@earth_gebcosi_15m_p",
2428
"@earth_geoid_01d_g",
29+
"@earth_geoid_30m_g",
2530
"@earth_mag_01d_g",
31+
"@earth_mag_30m_g",
2632
"@earth_mag4km_01d_g",
33+
"@earth_mag4km_20m_g",
2734
"@earth_mask_01d_g",
2835
"@earth_mdt_01d_g",
36+
"@earth_mdt_30m_g",
2937
"@earth_mdt_07m_g",
3038
"@earth_mss_01d_g",
31-
"@earth_ndefl_01d",
32-
"@earth_night_01d",
39+
"@earth_mss_30m_g",
40+
"@earth_ndefl_01d_g",
41+
"@earth_night_01d_p",
3342
"@earth_relief_01d_g",
3443
"@earth_relief_01d_p",
44+
"@earth_relief_05m_g",
45+
"@earth_relief_05m_p",
3546
"@earth_relief_10m_g",
3647
"@earth_relief_10m_p",
3748
"@earth_relief_30m_g",
3849
"@earth_relief_30m_p",
39-
"@earth_relief_05m_g",
40-
"@earth_relief_05m_p",
4150
"@earth_synbath_01d_g",
4251
"@earth_vgg_01d_g",
52+
"@earth_vgg_30m_g",
4353
"@earth_wdmam_01d_g",
54+
"@earth_wdmam_20m_g",
4455
"@mars_relief_01d_g",
56+
"@mars_relief_30m_g",
4557
"@mercury_relief_01d_g",
58+
"@mercury_relief_30m_g",
4659
"@moon_relief_01d_g",
60+
"@moon_relief_30m_g",
4761
"@pluto_relief_01d_g",
62+
"@pluto_relief_30m_g",
4863
"@venus_relief_01d_g",
64+
"@venus_relief_30m_g",
4965
# List of tiled remote datasets.
5066
# Names like @N35E135.earth_relief_03s_g.nc are for internal use only.
5167
# The naming scheme may change. DO NOT USE IT IN YOUR SCRIPTS.
5268
"@N00W030.earth_age_01m_g.nc",
5369
"@N30E060.earth_age_01m_g.nc",
5470
"@N30E090.earth_age_01m_g.nc",
71+
"@S90E000.earth_age_05m_g.nc",
5572
"@N00W030.earth_dist_01m_g.nc",
73+
"@S90E000.earth_dist_05m_g.nc",
5674
"@N00W030.earth_edefl_01m_p.nc",
75+
"@S90E000.earth_edefl_05m_g.nc",
5776
"@N00W030.earth_faa_01m_p.nc",
77+
"@S90E000.earth_faa_05m_g.nc",
5878
"@N00W030.earth_faaerror_01m_p.nc",
5979
"@N00W030.earth_geoid_01m_g.nc",
80+
"@S90E000.earth_geoid_05m_g.nc",
6081
"@S30W060.earth_mag_02m_p.nc",
82+
"@S90E000.earth_mag_05m_g.nc",
6183
"@S30W120.earth_mag4km_02m_p.nc",
6284
"@N30E090.earth_mss_01m_g.nc",
85+
"@S90E000.earth_mss_05m_g.nc",
6386
"@N30E090.earth_ndefl_01m_p.nc",
6487
"@N00W090.earth_relief_03m_p.nc",
6588
"@N00E135.earth_relief_30s_g.nc",
@@ -70,12 +93,18 @@ def cache_data() -> None:
7093
"@N37W120.earth_relief_03s_g.nc",
7194
"@S15W105.earth_synbath_30s_p.nc",
7295
"@N00W030.earth_vgg_01m_p.nc",
96+
"@S90E000.earth_vgg_05m_g.nc",
7397
"@S90E000.earth_wdmam_03m_g.nc",
7498
"@N00W030.mars_relief_01m_g.nc",
99+
"@S90E000.mars_relief_05m_g.nc",
75100
"@N00W030.mercury_relief_01m_g.nc",
101+
"@S90E000.mercury_relief_05m_g.nc",
76102
"@N00W030.moon_relief_01m_g.nc",
103+
"@S90E000.moon_relief_05m_g.nc",
77104
"@N00W030.pluto_relief_01m_g.nc",
105+
"@S90E000.pluto_relief_05m_g.nc",
78106
"@N00W030.venus_relief_01m_g.nc",
107+
"@S90E000.venus_relief_05m_g.nc",
79108
# List of cache files.
80109
"@EGM96_to_36.txt",
81110
"@MaunaLoa_CO2.txt",

pygmt/src/basemap.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def basemap(self, **kwargs):
3636
At least one of the parameters ``frame``, ``map_scale``, ``rose``, or
3737
``compass`` must be specified if not in subplot mode.
3838
39-
Full option list at :gmt-docs:`basemap.html`
39+
Full GMT docs at :gmt-docs:`basemap.html`.
4040
4141
{aliases}
4242
@@ -82,6 +82,6 @@ def basemap(self, **kwargs):
8282
{perspective}
8383
{transparency}
8484
"""
85-
kwargs = self._preprocess(**kwargs)
85+
self._activate_figure()
8686
with Session() as lib:
8787
lib.call_module(module="basemap", args=build_arg_list(kwargs))

pygmt/src/binstats.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def binstats(
3939
presented as is or may be normalized by the circle area to
4040
perhaps give density estimates.
4141
42-
Full option list at :gmt-docs:`gmtbinstats.html`
42+
Full GMT docs at :gmt-docs:`gmtbinstats.html`.
4343
4444
{aliases}
4545

pygmt/src/blockm.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def blockmean(
108108
109109
Must provide either ``data`` or ``x``, ``y``, and ``z``.
110110
111-
Full option list at :gmt-docs:`blockmean.html`
111+
Full GMT docs at :gmt-docs:`blockmean.html`.
112112
113113
{aliases}
114114
@@ -212,7 +212,7 @@ def blockmedian(
212212
213213
Must provide either ``data`` or ``x``, ``y``, and ``z``.
214214
215-
Full option list at :gmt-docs:`blockmedian.html`
215+
Full GMT docs at :gmt-docs:`blockmedian.html`.
216216
217217
{aliases}
218218
@@ -310,7 +310,7 @@ def blockmode(
310310
311311
Must provide either ``data`` or ``x``, ``y``, and ``z``.
312312
313-
Full option list at :gmt-docs:`blockmode.html`
313+
Full GMT docs at :gmt-docs:`blockmode.html`.
314314
315315
{aliases}
316316

pygmt/src/coast.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def coast(self, **kwargs):
5555
5656
A map projection must be supplied.
5757
58-
Full option list at :gmt-docs:`coast.html`
58+
Full GMT docs at :gmt-docs:`coast.html`.
5959
6060
{aliases}
6161
@@ -193,7 +193,7 @@ def coast(self, **kwargs):
193193
>>> # Show the plot
194194
>>> fig.show()
195195
"""
196-
kwargs = self._preprocess(**kwargs)
196+
self._activate_figure()
197197
if not args_in_kwargs(args=["C", "G", "S", "I", "N", "E", "Q", "W"], kwargs=kwargs):
198198
msg = (
199199
"At least one of the following parameters must be specified: "

pygmt/src/colorbar.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def colorbar(self, **kwargs):
4242
linear scale, all be equal size, or by providing a file with individual
4343
tile widths.
4444
45-
Full option list at :gmt-docs:`colorbar.html`
45+
Full GMT docs at :gmt-docs:`colorbar.html`.
4646
4747
{aliases}
4848
@@ -144,6 +144,6 @@ def colorbar(self, **kwargs):
144144
>>> # Show the plot
145145
>>> fig.show()
146146
"""
147-
kwargs = self._preprocess(**kwargs)
147+
self._activate_figure()
148148
with Session() as lib:
149149
lib.call_module(module="colorbar", args=build_arg_list(kwargs))

pygmt/src/contour.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def contour(
4949
5050
Must provide either ``data`` or ``x``, ``y``, and ``z``.
5151
52-
Full option list at :gmt-docs:`contour.html`
52+
Full GMT docs at :gmt-docs:`contour.html`.
5353
5454
{aliases}
5555
@@ -133,7 +133,7 @@ def contour(
133133
{perspective}
134134
{transparency}
135135
"""
136-
kwargs = self._preprocess(**kwargs)
136+
self._activate_figure()
137137

138138
# Specify levels for contours or annotations.
139139
# One level is converted to a string with a trailing comma to separate it from

pygmt/src/dimfilter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def dimfilter(
4343
Thus, an additional filtering (e.g., Gaussian via :func:`pygmt.grdfilter`)
4444
of the DiM-filtered data is generally recommended.
4545
46-
Full option list at :gmt-docs:`dimfilter.html`
46+
Full GMT docs at :gmt-docs:`dimfilter.html`.
4747
4848
{aliases}
4949

pygmt/src/filter1d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def filter1d(
4040
Read a table and output as a :class:`numpy.ndarray`,
4141
:class:`pandas.DataFrame`, or ASCII file.
4242
43-
Full option list at :gmt-docs:`filter1d.html`
43+
Full GMT docs at :gmt-docs:`filter1d.html`.
4444
4545
{aliases}
4646

pygmt/src/grd2cpt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def grd2cpt(grid: PathLike | xr.DataArray, **kwargs):
7575
:gmt-docs:`gmt.conf <gmt.conf>` file or the ``color_model`` parameter
7676
will be used.
7777
78-
Full option list at :gmt-docs:`grd2cpt.html`
78+
Full GMT docs at :gmt-docs:`grd2cpt.html`.
7979
8080
{aliases}
8181

pygmt/src/grd2xyz.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def grd2xyz(
4848
Read a grid and output xyz-triplets as a :class:`numpy.ndarray`,
4949
:class:`pandas.DataFrame`, or ASCII file.
5050
51-
Full option list at :gmt-docs:`grd2xyz.html`
51+
Full GMT docs at :gmt-docs:`grd2xyz.html`.
5252
5353
{aliases}
5454

pygmt/src/grdclip.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def grdclip(
135135
values is required, or for reclassification of data values. The values can be any
136136
number or NaN (Not a Number).
137137
138-
Full option list at :gmt-docs:`grdclip.html`
138+
Full GMT docs at :gmt-docs:`grdclip.html`.
139139
140140
{aliases}
141141
- G = outgrid

pygmt/src/grdcontour.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def grdcontour(self, grid: PathLike | xr.DataArray, **kwargs):
4444
4545
Takes a grid file name or an :class:`xarray.DataArray` object as input.
4646
47-
Full option list at :gmt-docs:`grdcontour.html`
47+
Full GMT docs at :gmt-docs:`grdcontour.html`.
4848
4949
{aliases}
5050
@@ -138,7 +138,7 @@ def grdcontour(self, grid: PathLike | xr.DataArray, **kwargs):
138138
>>> # Show the plot
139139
>>> fig.show()
140140
"""
141-
kwargs = self._preprocess(**kwargs)
141+
self._activate_figure()
142142

143143
# Specify levels for the annotation and levels parameters.
144144
# One level is converted to a string with a trailing comma to separate it from

pygmt/src/grdcut.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def grdcut(
4848
to determine the corresponding rectangular ``region`` that will give a grid
4949
that fully covers the oblique domain.
5050
51-
Full option list at :gmt-docs:`grdcut.html`
51+
Full GMT docs at :gmt-docs:`grdcut.html`.
5252
5353
{aliases}
5454

pygmt/src/grdfill.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def grdfill(
131131
replace the hole values. If no holes are found the original unchanged grid is
132132
returned.
133133
134-
Full option list at :gmt-docs:`grdfill.html`.
134+
Full GMT docs at :gmt-docs:`grdfill.html`.
135135
136136
.. rubric:: Aliases:
137137
.. hlist::

pygmt/src/grdfilter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def grdfilter(
3838
half-width of the input edges. If the filter is low-pass, then the output
3939
may be less frequently sampled than the input.
4040
41-
Full option list at :gmt-docs:`grdfilter.html`
41+
Full GMT docs at :gmt-docs:`grdfilter.html`.
4242
4343
{aliases}
4444

pygmt/src/grdgradient.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def grdgradient(
4040
Can accept ``azimuth``, ``direction``, and ``radiance`` input to create
4141
the resulting gradient.
4242
43-
Full option list at :gmt-docs:`grdgradient.html`
43+
Full GMT docs at :gmt-docs:`grdgradient.html`.
4444
4545
{aliases}
4646

0 commit comments

Comments
 (0)