- pygmt.datasets.load_earth_relief(resolution='01d', region=None, registration=None, use_srtm=False)
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_res[_reg] to any grid plotting/processing function. res is the grid resolution (see below), and reg is grid registration type (p for pixel registration or g for gridline registration).
Refer to https://docs.generic-mapping-tools.org/latest/datasets/remote-data.html#global-earth-relief-grids for more details.
resolution (str) – The grid resolution. The suffix
sstand for arc-degree, arc-minute and arc-second. It can be
region (str or list) – The subregion of the grid to load, in the forms of a list [xmin, xmax, ymin, ymax] or a string xmin/xmax/ymin/ymax. Required for Earth relief grids with resolutions higher than 5 arc-minute (i.e.,
registration (str) – Grid registration type. Either
pixelfor pixel registration or
gridlinefor gridline registration. Default is
None, where a pixel-registered grid is returned unless only the gridline-registered grid is available.
use_srtm (bool) – By default, the land-only SRTM tiles from NASA are used to generate the
'01s'grids, and the missing ocean values are filled by up-sampling the SRTM15+V2.1 tiles which have a resolution of 15 arc-second (i.e.,
'15s'). If True, will only load the original land-only SRTM tiles.
xarray.DataArray) – The Earth relief grid. Coordinates are latitude and longitude in degrees. Relief is in meters.
xarray.DataArraygrid doesn’t support slice operation, for Earth relief data with resolutions of 5 arc-minutes or higher, which are stored as smaller tiles.
>>> # 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" ... ) >>> # load the original 3 arc-second land-only SRTM tiles from NASA >>> grid = load_earth_relief( ... "03s", ... region=[135, 136, 35, 36], ... registration="gridline", ... use_srtm=True, ... )