pygmt.datasets.load_earth_relief¶
-
pygmt.datasets.
load_earth_relief
(resolution='01d', region=None, registration=None)[source]¶ Load Earth relief grids (topography and bathymetry) in various resolutions.
The grids are downloaded to a user data directory (usually
~/.gmt/server/earth/earth_relief/
) the first time you invoke this function. Afterwards, it will load the grid from the data directory. So you’ll need an internet connection the first time around.These grids can also be accessed by passing in the file name
'@earth_relief_rru[_reg]'
to any grid plotting/processing function. Refer to https://docs.generic-mapping-tools.org/latest/datasets/remote-data.html for more details.- Parameters
resolution (str) – The grid resolution. The suffix
d
,m
ands
stand for arc-degree, arc-minute and arc-second. It can be'01d'
,'30m'
,'20m'
,'15m'
,'10m'
,'06m'
,'05m'
,'04m'
,'03m'
,'02m'
,'01m'
,'30s'
,'15s'
,'03s'
, or'01s'
.region (str or list) – The subregion of the grid to load. Required for Earth relief grids with resolutions <= 05m.
registration (str) – Grid registration type. Either
pixel
for pixel registration orgridline
for gridline registration. Default isNone
, where a pixel-registered grid is returned unless only the gridline-registered grid is available.
- Returns
grid (xarray.DataArray) – The Earth relief grid. Coordinates are latitude and longitude in degrees. Relief is in meters.
Notes
The DataArray doesn’s support slice operation, for Earth relief data with resolutions higher than “05m”, which are stored as smaller tiles.
Examples
>>> # load the default grid (pixel-registered 01d grid) >>> grid = load_earth_relief() >>> # load the 30m grid with "gridline" registration >>> grid = load_earth_relief("30m", registration="gridline") >>> # load high-resolution grid for a specific region >>> grid = load_earth_relief( ... "05m", region=[120, 160, 30, 60], registration="gridline" ... )