Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TYP: Add type hints for 'data_source' in load_earth_relief and load_earth_magnetic_anomaly functions #2849

Merged
merged 4 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions pygmt/datasets/earth_magnetic_anomaly.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

The grids are available in various resolutions.
"""
from typing import Literal

from pygmt.datasets.load_remote_dataset import _load_remote_dataset
from pygmt.exceptions import GMTInvalidInput
from pygmt.helpers import kwargs_to_strings
Expand All @@ -13,7 +15,10 @@

@kwargs_to_strings(region="sequence")
def load_earth_magnetic_anomaly(
resolution="01d", region=None, registration=None, data_source="emag2"
resolution="01d",
region=None,
registration=None,
data_source: Literal["emag2", "emag2_4km", "wdmam"] = "emag2",
):
r"""
Load the Earth magnetic anomaly datasets in various resolutions.
Expand Down Expand Up @@ -77,17 +82,15 @@ def load_earth_magnetic_anomaly(
for all resolutions except ``"02m"`` for ``data_source="emag2"`` or
``data_source="emag2_4km"``, which are ``"pixel"`` only.

data_source : str
data_source
Select the source of the magnetic anomaly data. Available options are:

- ``"emag2"``: EMAG2 Earth Magnetic Anomaly Model [Default
option]. It only includes data observed at sea level over
oceanic regions. See :gmt-datasets:`earth-mag.html`.

- ``"emag2"``: EMAG2 Earth Magnetic Anomaly Model. It only includes
data observed at sea level over oceanic regions.
See :gmt-datasets:`earth-mag.html`.
- ``"emag2_4km"``: Use a version of EMAG2 where all observations
are relative to an altitude of 4 km above the geoid and include
data over land.

- ``"wdmam"``: World Digital Magnetic Anomaly Map (WDMAM).
See :gmt-datasets:`earth-wdmam.html`.

Expand Down
20 changes: 9 additions & 11 deletions pygmt/datasets/earth_relief.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

The grids are available in various resolutions.
"""
from typing import Literal

from pygmt.datasets.load_remote_dataset import _load_remote_dataset
from pygmt.exceptions import GMTInvalidInput
from pygmt.helpers import kwargs_to_strings
Expand All @@ -16,7 +18,7 @@ def load_earth_relief(
resolution="01d",
region=None,
registration=None,
data_source="igpp",
data_source: Literal["igpp", "gebco", "gebcosi", "synbath"] = "igpp",
use_srtm=False,
):
r"""
Expand Down Expand Up @@ -74,22 +76,18 @@ def load_earth_relief(
``"gridline"`` for gridline registration. Default is ``"gridline"``
for all resolutions except ``"15s"`` which is ``"pixel"`` only.

data_source : str
data_source
Select the source for the Earth relief data. Available options are:

- ``"igpp"``: IGPP Earth Relief [Default option]. See
- ``"igpp"``: IGPP Earth Relief. See
:gmt-datasets:`earth-relief.html`.

- ``"synbath"``: IGPP Earth Relief dataset that uses
stastical properties of young seafloor to provide a more realistic
relief of young areas with small seamounts.

- ``"synbath"``: IGPP Earth Relief dataset that uses stastical
properties of young seafloor to provide a more realistic relief
of young areas with small seamounts.
- ``"gebco"``: GEBCO Earth Relief with only observed relief and
inferred relief via altimetric gravity. See
:gmt-datasets:`earth-gebco.html`.

- ``"gebcosi"``: GEBCO Earth Relief that gives sub-ice (si)
elevations.
- ``"gebcosi"``: GEBCO Earth Relief that gives sub-ice (si) elevations.

use_srtm : bool
By default, the land-only SRTM tiles from NASA are used to generate the
Expand Down
Loading