Skip to content

Commit c880fcf

Browse files
Change 'data_source' to 'uncertainty'
1 parent f9cbab6 commit c880fcf

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

pygmt/datasets/earth_free_air_anomaly.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def load_earth_free_air_anomaly(
2121
] = "01d",
2222
region: Sequence[float] | str | None = None,
2323
registration: Literal["gridline", "pixel", None] = None,
24-
data_source: Literal["faa", "faaerror"] = "faa",
24+
uncertainty: False | True = False,
2525
) -> xr.DataArray:
2626
r"""
2727
Load the IGPP Earth free-air anomaly dataset in various resolutions.
@@ -71,7 +71,7 @@ def load_earth_free_air_anomaly(
7171
Grid registration type. Either ``"pixel"`` for pixel registration or
7272
``"gridline"`` for gridline registration. Default is ``None``, means
7373
``"gridline"`` for all resolutions except ``"01m"`` which is ``"pixel"`` only.
74-
data_source
74+
Uncertainty
7575
Select the free air anomaly data. Available options are:
7676
7777
- ``"faa"``: Altimetry-based marine free-air anomaly values.
@@ -80,8 +80,8 @@ def load_earth_free_air_anomaly(
8080
Returns
8181
-------
8282
grid
83-
The Earth free-air anomaly grid. Coordinates are latitude and
84-
longitude in degrees. Units are in mGal.
83+
The Earth free-air anomaly grid. Coordinates are latitude and longitude in
84+
degrees Units are in mGal.
8585
8686
Note
8787
----
@@ -99,6 +99,8 @@ def load_earth_free_air_anomaly(
9999
>>> from pygmt.datasets import load_earth_free_air_anomaly
100100
>>> # load the default grid (gridline-registered 1 arc-degree grid)
101101
>>> grid = load_earth_free_air_anomaly()
102+
>>> # load the uncertainties related to the default grid
103+
>>> grid = load_earth_free_air_anomaly(uncertainty=True)
102104
>>> # load the 30 arc-minutes grid with "gridline" registration
103105
>>> grid = load_earth_free_air_anomaly(resolution="30m", registration="gridline")
104106
>>> # load high-resolution (5 arc-minutes) grid for a specific region
@@ -108,13 +110,13 @@ def load_earth_free_air_anomaly(
108110
"""
109111
# Map data source to prefix
110112
prefix = {
111-
"faa": "earth_faa",
112-
"faaerror": "earth_faaerror",
113-
}.get(data_source)
113+
False: "earth_faa",
114+
True: "earth_faaerror",
115+
}.get(uncertainty)
114116
if prefix is None:
115117
msg = (
116-
f"Invalid earth free air anomaly data source '{data_source}'. "
117-
"Valid values are 'faa' and 'faaerror'."
118+
f"Invalid earth free air anomaly data type '{uncertainty}'. "
119+
"Valid inputs are False for the values and True for the uncertainties."
118120
)
119121
raise GMTInvalidInput(msg)
120122
grid = _load_remote_dataset(

pygmt/tests/test_datasets_earth_free_air_anomaly.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def test_earth_faaerror_01d():
5858
"""
5959
Test some properties of the free air anomaly error 01d data.
6060
"""
61-
data = load_earth_free_air_anomaly(resolution="01d", data_source="faaerror")
61+
data = load_earth_free_air_anomaly(resolution="01d", uncertainty=True)
6262
assert data.name == "z"
6363
assert data.attrs["long_name"] == "faaerror (mGal)"
6464
assert data.attrs["description"] == "IGPP Earth free-air anomaly errors"
@@ -77,7 +77,7 @@ def test_earth_faaerror_01d_with_region():
7777
Test loading low-resolution earth free air anomaly error with 'region'.
7878
"""
7979
data = load_earth_free_air_anomaly(
80-
resolution="01d", region=[-10, 10, -5, 5], data_source="faaerror"
80+
resolution="01d", region=[-10, 10, -5, 5], uncertainty=True
8181
)
8282
assert data.shape == (11, 21)
8383
assert data.gmt.registration == 0
@@ -93,7 +93,7 @@ def test_earth_faaerror_01m_default_registration():
9393
registration.
9494
"""
9595
data = load_earth_free_air_anomaly(
96-
resolution="01m", region=[-10, -9, 3, 5], data_source="faaerror"
96+
resolution="01m", region=[-10, -9, 3, 5], uncertainty=True
9797
)
9898
assert data.shape == (120, 60)
9999
assert data.gmt.registration == 1

0 commit comments

Comments
 (0)