Skip to content

Add Copernicus DEM (GLO-90/GLO-30) terrain backend - #75

Open
nebukadnezar wants to merge 1 commit into
bwinkel:masterfrom
nebukadnezar:copernicus-dem
Open

Add Copernicus DEM (GLO-90/GLO-30) terrain backend#75
nebukadnezar wants to merge 1 commit into
bwinkel:masterfrom
nebukadnezar:copernicus-dem

Conversation

@nebukadnezar

Copy link
Copy Markdown
Collaborator

Summary

Adds the Copernicus DEM (GLO-90 and GLO-30) as a terrain source alongside
SRTM, via two new SrtmConf servers. Also adds configurable missing-tile and
void handling, and fixes an SRTM void-mask off-by-one.

Motivation

  1. The SRTM auto-download servers are effectively retired (nasa_v2.1/v1.0
    point at the decommissioned USGS host; viewpano is unofficial). Copernicus
    on the AWS Open Data buckets is a reliably working, no-auth download path.
  2. Copernicus is global pole-to-pole; SRTM covers only 60N to 56S.
  3. Copernicus is void-free over water; SRTM .hgt voids currently propagate
    into height profiles.
  4. While here, this fixes a real SRTM void-mask bug (below).

What is added

  • Servers 'copernicus_glo90' and 'copernicus_glo30', wired into the existing
    download='missing' machinery. Availability is validated against the bucket
    tileList.txt, lazily fetched and cached in srtm_dir.
  • A Cloud-Optimised GeoTIFF reader alongside the .hgt reader. It handles the
    two differences from SRTM: pixel-centre (area) registration vs grid-node,
    and the latitude-dependent longitude spacing above |50 deg| (tiles are not
    square there; the reader uses the actual geotransform). The public API
    (srtm_height_data, srtm_height_profile, PathProp) is unchanged pole to pole.
  • rasterio is imported behind a guard (clear error if a Copernicus server is
    selected without it), matching the existing pattern in gis.py.

Failure-mode hardening

  • SrtmConf.on_missing: 'zeros' (default; warn + zero terrain, historic
    behaviour) or 'raise' (raise TileNotAvailableOnDiskError).
  • SrtmConf.void_fill: 'zero' (default), 'nan', or 'interp' (nearest-valid).

Bugfix: SRTM void mask

The reader masked only -32767/+32767, not the canonical SRTM void sentinel
-32768, so real voids leaked through and were linearly blended with valid
neighbours into deep spurious pits. All three are now masked.

Notes

  • The Copernicus DEM is a Digital Surface Model (includes vegetation and
    buildings), same category as SRTM; this is documented in the code.
  • Vertical datum is EGM2008 (SRTM uses EGM96); a metre-level difference that
    is not converted, since profiles depend on relative heights.

Tests

New tests in pathprof/tests/test_srtm.py: tile-name construction, pixel-centre
registration (synthetic plus a real Mont Blanc check), a value check against a
real downloaded GLO-90 tile (analogous to test_get_tile_data), non-square
high-latitude tiles, void masking and the three void_fill modes, on_missing
behaviour, tileList availability, download, and a GLO-90-vs-SRTM overlap
cross-check. Offline tests use small synthetic COGs and are skipped if
rasterio is absent; a few remote_data tests hit the real bucket.

Docs

docs/pathprof/working_with_srtm.rst gets a Copernicus section with the required
attribution. Module and SrtmConf docstrings and CHANGES.rst are updated.

Open points

  • rasterio: keep as-is, or move to an optional extra (pycraf[copernicus])?
  • Defaults: keep on_missing='zeros' (backwards-compatible) or flip to 'raise'?

Add two SrtmConf servers, copernicus_glo90 and copernicus_glo30, that read
the Copernicus DEM Cloud-Optimised GeoTIFFs from the AWS Open Data buckets.
These give a reliably working auto-download path (the SRTM servers are
effectively retired), global pole-to-pole coverage, and void-free terrain
over water.

The GeoTIFF reader reconciles the two ways Copernicus tiles differ from SRTM
.hgt: pixel-centre (area) registration vs grid-node, and the latitude-
dependent longitude spacing above |50 deg| (tiles are not square there). The
public API (srtm_height_data, srtm_height_profile, PathProp) is unchanged.
rasterio is used behind an import guard, matching the pattern in gis.py.

Add two SrtmConf failure-mode options: on_missing ('zeros'|'raise') and
void_fill ('zero'|'nan'|'interp'), both defaulting to the historic behaviour.

Fix the SRTM void mask: the canonical void sentinel -32768 was not masked
(only -32767/+32767 were), so genuine voids leaked through and were linearly
blended with valid neighbours into deep spurious pits.

Include tests, docs with the required Copernicus attribution, and a changelog
entry.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant