- Home
- Documentation
- API reference
- Atmosphere
- hyperproc.atmos.dem
hyperproc.atmos.dem¶
Source-derived reference
Generated from the current hyperproc 0.1.2 checkout.
Implementation: hyperproc/atmos/dem.py. Signatures, defaults, docstrings, and expandable source are extracted statically; the module is not imported or executed. Names beginning with _ are implementation details, not a stable public API.
Use the function signature as the authority for individual parameter defaults and return annotations. Original docstrings sometimes group parameter names or wrap return descriptions across lines; these descriptions are preserved rather than inferred or rewritten.
Surface elevation for products that ship none, from the Copernicus DEM.
ISOFIT needs a height for every pixel (it sets the pressure altitude of the
look-up table). EMIT, PACE and the AVIRIS products carry one; DESIS, EnMAP,
Tanager and PRISMA do not. This module samples the Copernicus DEM GLO-30
(30 m, TanDEM-X, heights above the EGM2008 geoid, global except a handful of
countries that are only released at 90 m) from its public cloud-optimised
GeoTIFF tiles on AWS, one 1 x 1 degree tile at a time, and keeps the tiles
under $HYPERPROC_CACHE_DIR/dem so a region is fetched once.
Heights are above the EGM2008 geoid, which is what a pressure altitude wants; the JPL products (EMIT, AVIRIS) carry ellipsoidal heights instead, so the two differ by the local geoid undulation (about 36 m on the EMIT test granule off California), which changes the surface pressure by under 0.5 %.
Tiles that do not exist (open ocean, or the excluded countries at 30 m) fall
back to GLO-90 and then to sea level. Scenes that would need more than
MAX_TILES_30 tiles (a PACE granule spans 20 degrees) are sampled from
GLO-90 outright; at kilometre pixels that loses nothing.
SOURCES = {30: ('copernicus-dem-30m', 'Copernicus_DSM_COG_10'), 90: ('copernicus-dem-90m', 'Copernicus_DSM_COG_30')}
module-attribute
¶
MAX_TILES_30 = 60
module-attribute
¶
cache_dir() -> Path
¶
tile_id(lat0: int, lon0: int, resolution: int = 30) -> str
¶
Copernicus tile name for the 1-degree cell whose south-west corner is (lat0, lon0).
Source code in hyperproc/atmos/dem.py
tile_url(lat0: int, lon0: int, resolution: int = 30) -> str
¶
fetch_tile(lat0: int, lon0: int, resolution: int = 30, verbose: bool = False) -> Path | None
¶
The cached tile file, downloading it on first use; None when the tile does not exist.
Source code in hyperproc/atmos/dem.py
_read_tile(path: Path)
¶
sample(lat, lon, resolution: int = 30, fallback: bool = True, verbose: bool = False) -> np.ndarray
¶
Elevation (m above EGM2008) at every (lat, lon), bilinear within each tile.
NaN where the coordinates are not finite; 0 where no tile exists (sea).
Source code in hyperproc/atmos/dem.py
add_elevation(ds, resolution: int = 30, name: str = 'elev', overwrite: bool = False, verbose: bool = True)
¶
Attach a DEM-sampled elev (y, x) layer to a dataset that has none.
Uses the dataset's lat/lon layers, or derives them from the map
grid when the dataset is projected. Returns the dataset (modified in place).