English | Deutsch

Elevation (Copernicus DEM)

The height of the ground in metres. The Copernicus digital elevation model (DEM) covers the whole world on a 30 m grid. Use it for relief maps, slopes, and to find out which parts of an area lie low.

At a glance

Download function

download_digital_elevation_model(), short download_dem

Plot function

plot_digital_elevation_model(), short plot_dem

Source

Copernicus DEM (collection COPERNICUS_30), band DEM

Pixel size

30 m

Result

one band of floating-point numbers in metres

Clouds

not affected

Period

none needed. The model is static; temporal_extent is optional.

Example

from cdec import download_dem, plot_dem

spatial_extent = {"west": 8.721771, "south": 53.025027, "east": 8.904419, "north": 53.114965}  # Bremen

path = download_dem("data/dem_bremen.tif", spatial_extent)   # no period needed
plot_dem(path)
Elevation map of Bremen: low green land along a river, some higher brown spots, heights from about -14 to 43 metres.

Bremen, heights in metres. Copernicus DEM, see Data sources and credits.

Things to know

  • No period. The model was made once (from data of 2010 to 2015). The function uses that period if you do not give one, so a recent period would find no data (Choose the period).

  • A surface model. It shows the top of what the satellite measured, which includes buildings and forest canopies, not only the bare ground.

  • Heights are metres, measured from a model of the sea level (the geoid), so values near the coast can be slightly negative. The example area ranges from about -14 to 43 m.

  • The plot uses terrain colours; they follow the lowest and the highest value of the image. Give two maps the same vmin and vmax to compare them.

  • The file uses longitude and latitude (EPSG:4326).

See also

Land cover (ESA WorldCover), Plot and save maps

Download

cdec.download_digital_elevation_model(file_path, spatial_extent, temporal_extent=('2010-12-12T00:00:00Z', '2015-01-16T00:00:00Z'), *, create_cog=True, overview_resampling='average')[source]

Short alias: download_dem

Download a Copernicus digital elevation model.

The function loads the DEM band from the static COPERNICUS_30 openEO collection and reduces its time dimension to one elevation raster. The collection’s known acquisition period is used by default, so users do not have to provide a temporal extent.

Parameters:
  • file_path (str | Path) – Destination path of the GeoTIFF file. Missing parent directories are created automatically.

  • spatial_extent (SpatialExtent) – Area to download: an openEO bounding-box dictionary such as {"west": 8.7, "south": 53.0, "east": 8.9, "north": 53.1} (degrees, WGS 84), a Shapely geometry, or the path to a GeoJSON file.

  • temporal_extent (TemporalExtent) – Collection period used for the openEO request. The default covers the acquisition period of the Copernicus DEM and normally does not need to be changed: the DEM is a static data set, so a recent period such as June 2024 is outside of it and normally finds no data.

  • create_cog (bool) – If True, write a Cloud Optimized GeoTIFF. If False, keep a regular GeoTIFF.

  • overview_resampling (OverviewResampling) – Resampling method used to build COG overview levels. "average" is a suitable default for continuous elevation data.

Returns:

Absolute path of the GeoTIFF that was written. The file has one band of floating-point numbers (float32): the elevation in metres. Pixels without data are NaN, which the file declares as its no-data value. The coordinate system is geographic (EPSG:4326, degrees); the pixel size is 0.00042 x 0.00028 degrees (east-west x north-south), about 30 m.

Return type:

Path

Plot

cdec.plot_digital_elevation_model(file_path, *, ax=None, title=None, cmap='terrain', vmin=None, vmax=None, colorbar=True, show=None)[source]

Short alias: plot_dem

Draw the heights of download_digital_elevation_model.

The values are metres above sea level. The “terrain” colour map goes from blue and green (low) over yellow and brown to white (high). The range follows the values of this image; in flat country such as Bremen a few metres of difference already use the whole colour map.

Parameters:
  • file_path (str | Path) – The GeoTIFF written by download_dem.

  • ax (Axes | None) – A matplotlib Axes to draw into. None creates a new figure.

  • title (str | None) – Title of the plot. Default: “Elevation”. Use "" for no title.

  • cmap (str) – Name of a matplotlib colour map.

  • vmin (float | None) – Values at the two ends of the colour map, in metres. None takes the smallest and largest value of the image.

  • vmax (float | None) – Values at the two ends of the colour map, in metres. None takes the smallest and largest value of the image.

  • colorbar (bool) – Draw a colour bar.

  • show (bool | None) – Call plt.show() at the end. The default (None) shows the figure only if this function created it.

Returns:

The axes with the plot, for further changes.

Return type:

matplotlib.axes.Axes

Raises:

ValueError – If the file does not have exactly one band.