Skip to content

Commit

Permalink
Add type hints to resolution and region parameters
Browse files Browse the repository at this point in the history
Following changes at #3260 and #3272
  • Loading branch information
weiji14 committed Sep 28, 2024
1 parent 54184fb commit e6c2964
Showing 1 changed file with 28 additions and 12 deletions.
40 changes: 28 additions & 12 deletions pygmt/datasets/earth_daynight.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,32 @@
The grids are available in various resolutions.
"""

from collections.abc import Sequence
from typing import Literal

import xarray as xr
from pygmt.datasets.load_remote_dataset import _load_remote_dataset
from pygmt.helpers import kwargs_to_strings

__doctest_skip__ = ["load_blue_marble"]


@kwargs_to_strings(region="sequence")
def load_blue_marble(resolution="01d", region=None):
def load_blue_marble(
resolution: Literal[
"01d",
"30m",
"20m",
"15m",
"10m",
"06m",
"05m",
"04m",
"03m",
"02m",
"01m",
"30s",
] = "01d",
region: Sequence[float] | str | None = None,
) -> xr.DataArray:
r"""
Load NASA Blue Marble images in various resolutions.
Expand All @@ -36,20 +54,18 @@ def load_blue_marble(resolution="01d", region=None):
Parameters
----------
resolution : str
resolution
The image resolution. The suffix ``d``, ``m``, and ``s`` stand for arc-degree,
arc-minute, and arc-second. It can be ``"01d"``, ``"30m"``, ``"20m"``,
``"15m"``, ``"10m"``, ``"06m"``, ``"05m"``, ``"04m"``, ``"03m"``, ``"02m"``,
``"01m"``, or ``"30s"``.
arc-minute, and arc-second.
region : str or list
The subregion of the image to load, in the form of a list [*xmin*, *xmax*,
*ymin*, *ymax*] or a string *xmin/xmax/ymin/ymax*. Required for images with
resolutions higher than 5 arc-minutes (i.e., ``"05m"``).
region
The subregion of the image to load, in the form of a sequence [*xmin*, *xmax*,
*ymin*, *ymax*]. Required for images with resolutions higher than 5 arc-minutes
(i.e., ``"05m"``).
Returns
-------
image : :class:`xarray.DataArray`
image
The NASA Blue Marble image. Coordinates are latitude and longitude in degrees.
Examples
Expand Down

0 comments on commit e6c2964

Please sign in to comment.