Skip to content

Terrain: DEM & geoid

Terrain support for conversion: auto-fetch the covering Copernicus GLO-30 DEM tiles and the EGM geoid grid, so umbra convert --dem auto --geoid auto needs no hand-found elevation data.

DEM

fetch_dem_for_bbox

fetch_dem_for_bbox(bbox, dest_dir=None, *, base=COPERNICUS_DEM_30M_BASE, download=download_url, session=None)

Fetch the Copernicus GLO-30 DEM covering bbox and return a local raster path.

bbox is (west, south, east, north) in EPSG:4326 degrees. Every 1°×1° tile covering it is downloaded to dest_dir (default :func:default_dem_cache_dir) via the resume-safe download callable; tiles Copernicus omits because they are all-ocean (a 404) are skipped. The return is a single rasterio-openable DEM: the one tile as-is when the bbox falls in a single cell, or a merged mosaic (dem_mosaic_*.tif in dest_dir) when it spans several.

Raises :class:DemUnavailableError when no covering tile exists (e.g. a scene entirely over open water — pass an explicit --dem PATH there).

download is injectable so the whole path is offline-testable without the bucket; only the multi-tile mosaic step imports rasterio.

copernicus_tile_id

copernicus_tile_id(lat_deg, lon_deg)

Copernicus GLO-30 tile id for the 1°×1° cell whose SW corner is (lat, lon).

Copernicus tiles are named by their south-west integer-degree corner, so the cell containing a point is found by flooring its coordinates. lat_deg / lon_deg are those floored degrees (lat_deg in [-90, 89]).

copernicus_tile_id(45, 6) 'Copernicus_DSM_COG_10_N45_00_E006_00_DEM' copernicus_tile_id(-1, -1) 'Copernicus_DSM_COG_10_S01_00_W001_00_DEM'

tile_ids_for_bbox

tile_ids_for_bbox(west, south, east, north)

Tile ids of every Copernicus DEM cell covering the bbox.

See :func:tiles_covering_bbox for the coverage rule.

default_dem_cache_dir

default_dem_cache_dir()

Where auto-fetched DEM tiles are cached.

$UMBRA_DEM_DIR overrides everything; otherwise tiles sit beside the catalog index under the XDG cache dir ($XDG_CACHE_HOME or ~/.cache) at umbra-py/dem.

DemUnavailableError

DemUnavailableError(message='', *, hint=None)

Bases: UmbraError

No Copernicus DEM tile covers the requested footprint (e.g. all ocean).

Geoid

fetch_geoid_grid

fetch_geoid_grid(dest_dir=None, *, name=DEFAULT_GEOID_GRID, base=PROJ_CDN_BASE, download=download_url, session=None)

Fetch a global geoid-undulation grid and return its local path.

The grid name (default :data:DEFAULT_GEOID_GRID, the EGM96 15′ model) is downloaded once to dest_dir (default :func:default_geoid_cache_dir) via the resume-safe download callable and cached there, so a repeat call re-downloads nothing. The return is a single rasterio-openable raster whose band 1 is the geoid undulation N in metres — exactly what :func:umbra_py.convert._geoid_corrected_sampler adds to each sampled DEM height, so it feeds straight into the --geoid PATH path.

Unlike a DEM there is nothing to tile: the EGM grid is global, so one file covers every scene and no footprint bbox is needed. download is injectable so the whole path is offline-testable without the CDN.

geoid_grid_url

geoid_grid_url(name=DEFAULT_GEOID_GRID, *, base=PROJ_CDN_BASE)

Public HTTPS URL of the geoid grid name on the PROJ CDN.

default_geoid_cache_dir

default_geoid_cache_dir()

Where the auto-fetched geoid grid is cached.

$UMBRA_GEOID_DIR overrides everything; otherwise the grid sits beside the catalog index and DEM tiles under the XDG cache dir ($XDG_CACHE_HOME or ~/.cache) at umbra-py/geoid.