Skip to content

Commit ab587d5

Browse files
committed
TYP: Add type hints for 'data_source' in load_earth_relief and load_earth_magnetic_anomaly functions
1 parent 78dfcf1 commit ab587d5

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

pygmt/datasets/earth_magnetic_anomaly.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
55
The grids are available in various resolutions.
66
"""
7+
from typing import Literal
8+
79
from pygmt.datasets.load_remote_dataset import _load_remote_dataset
810
from pygmt.exceptions import GMTInvalidInput
911
from pygmt.helpers import kwargs_to_strings
@@ -13,7 +15,10 @@
1315

1416
@kwargs_to_strings(region="sequence")
1517
def load_earth_magnetic_anomaly(
16-
resolution="01d", region=None, registration=None, data_source="emag2"
18+
resolution="01d",
19+
region=None,
20+
registration=None,
21+
data_source: Literal["emag2", "emag2_4km", "wdmam"] = "emag2",
1722
):
1823
r"""
1924
Load the Earth magnetic anomaly datasets in various resolutions.
@@ -77,17 +82,15 @@ def load_earth_magnetic_anomaly(
7782
for all resolutions except ``"02m"`` for ``data_source="emag2"`` or
7883
``data_source="emag2_4km"``, which are ``"pixel"`` only.
7984
80-
data_source : str
85+
data_source
8186
Select the source of the magnetic anomaly data. Available options are:
8287
8388
- ``"emag2"``: EMAG2 Earth Magnetic Anomaly Model [Default
8489
option]. It only includes data observed at sea level over
8590
oceanic regions. See :gmt-datasets:`earth-mag.html`.
86-
8791
- ``"emag2_4km"``: Use a version of EMAG2 where all observations
8892
are relative to an altitude of 4 km above the geoid and include
8993
data over land.
90-
9194
- ``"wdmam"``: World Digital Magnetic Anomaly Map (WDMAM).
9295
See :gmt-datasets:`earth-wdmam.html`.
9396

pygmt/datasets/earth_relief.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
55
The grids are available in various resolutions.
66
"""
7+
from typing import Literal
8+
79
from pygmt.datasets.load_remote_dataset import _load_remote_dataset
810
from pygmt.exceptions import GMTInvalidInput
911
from pygmt.helpers import kwargs_to_strings
@@ -16,7 +18,7 @@ def load_earth_relief(
1618
resolution="01d",
1719
region=None,
1820
registration=None,
19-
data_source="igpp",
21+
data_source: Literal["igpp", "gebco", "gebcosi", "synbath"] = "igpp",
2022
use_srtm=False,
2123
):
2224
r"""
@@ -74,20 +76,17 @@ def load_earth_relief(
7476
``"gridline"`` for gridline registration. Default is ``"gridline"``
7577
for all resolutions except ``"15s"`` which is ``"pixel"`` only.
7678
77-
data_source : str
79+
data_source
7880
Select the source for the Earth relief data. Available options are:
7981
8082
- ``"igpp"``: IGPP Earth Relief [Default option]. See
8183
:gmt-datasets:`earth-relief.html`.
82-
8384
- ``"synbath"``: IGPP Earth Relief dataset that uses
8485
stastical properties of young seafloor to provide a more realistic
8586
relief of young areas with small seamounts.
86-
8787
- ``"gebco"``: GEBCO Earth Relief with only observed relief and
8888
inferred relief via altimetric gravity. See
8989
:gmt-datasets:`earth-gebco.html`.
90-
9190
- ``"gebcosi"``: GEBCO Earth Relief that gives sub-ice (si)
9291
elevations.
9392

0 commit comments

Comments
 (0)