pygmt.datasets.load_black_marble
- pygmt.datasets.load_black_marble(resolution='01d', region=None)[source]
Load NASA Black Marble images in various resolutions.
The images are downloaded to a user data directory (usually
~/.gmt/server/earth/earth_night/
) the first time you invoke this function. Afterwards, it will load the image from the data directory. So you’ll need an internet connection the first time around.These images can also be accessed by passing in the file name @earth_night_res to any image processing function or plotting method. res is the image resolution (see below).
Refer to https://www.generic-mapping-tools.org/remote-datasets/earth-daynight.html for more details about available datasets, including version information and references.
- Parameters:
resolution (
Literal
['01d'
,'30m'
,'20m'
,'15m'
,'10m'
,'06m'
,'05m'
,'04m'
,'03m'
,'02m'
,'01m'
,'30s'
], default:'01d'
) – The image resolution. The suffixd
,m
, ands
stand for arc-degrees, arc-minutes, and arc-seconds.region (
Sequence
[float
] |str
|None
, default:None
) – The subregion of the image to load, in the form of a sequence [xmin, xmax, ymin, ymax].
- Return type:
- Returns:
image – The NASA Black Marble image. Coordinates are latitude and longitude in degrees.
Note
The registration and coordinate system type of the returned
xarray.DataArray
image can be accessed via the GMT accessors (i.e.,image.gmt.registration
andimage.gmt.gtype
respectively). However, these properties may be lost after specific image operations (such as slicing) and will need to be manually set before passing the image to any PyGMT data processing or plotting functions. Refer topygmt.GMTDataArrayAccessor
for detailed explanations and workarounds.Examples
>>> from pygmt.datasets import load_black_marble >>> # load the default image (pixel-registered 1 arc-degree image) >>> image = load_black_marble()