energy_data_retrieval.terrain#
Read native elevation grids without resampling or inventing missing heights.
- class energy_data_retrieval.terrain.TerrainSource(id, name, surface, vertical_datum, reference_ids)[source]#
Bases:
objectProduct identity; vertical datum is independent of horizontal CRS.
- Parameters:
id (str)
name (str)
surface (str)
vertical_datum (str)
reference_ids (tuple[str, ...])
- id: str#
- name: str#
- surface: str#
- vertical_datum: str#
- reference_ids: tuple[str, ...]#
- class energy_data_retrieval.terrain.TerrainMetadata(source, crs, shape, bounds, pixel_spacing, horizontal_unit, nodata, scale, offset, elevation_unit='m')[source]#
Bases:
objectNative spacing uses CRS units, not a claimed positional accuracy.
- Parameters:
source (TerrainSource)
crs (str)
shape (tuple[int, int])
bounds (Bounds)
pixel_spacing (tuple[float, float])
horizontal_unit (str)
nodata (float | str | None)
scale (float)
offset (float)
elevation_unit (str)
- source: TerrainSource#
- crs: str#
- shape: tuple[int, int]#
- bounds: Bounds#
- pixel_spacing: tuple[float, float]#
- horizontal_unit: str#
- nodata: float | str | None#
- scale: float#
- offset: float#
- elevation_unit: str#
- class energy_data_retrieval.terrain.TerrainWindow(elevation_m, transform, metadata)[source]#
Bases:
objectDecoded metres; nodata/masked/nonfinite cells are NaN, zero is valid.
- Parameters:
elevation_m (ndarray[tuple[Any, ...], dtype[float64]])
transform (Affine)
metadata (TerrainMetadata)
- elevation_m: ndarray[tuple[Any, ...], dtype[float64]]#
- transform: Affine#
- metadata: TerrainMetadata#
- energy_data_retrieval.terrain.validate_point(latitude, longitude)[source]#
Validate WGS84 coordinates; +180 and +90 are excluded tile origins.
- Parameters:
latitude (float)
longitude (float)
- Return type:
None
- energy_data_retrieval.terrain.validate_bounds(bounds)[source]#
Require west, south, east, north; split antimeridian requests explicitly.
- Parameters:
bounds (Bounds)
- Return type:
None
- energy_data_retrieval.terrain.degree_tiles(bounds, *, maximum_tiles=16)[source]#
Southwest (latitude, longitude) origins of intersecting 1-degree tiles.
- Parameters:
bounds (Bounds)
maximum_tiles (int)
- Return type:
tuple[tuple[int, int], …]
- energy_data_retrieval.terrain.describe_terrain(path, source)[source]#
Inspect a local file without loading its elevation array.
Source descriptors declare metre-valued products. Retain the descriptor, request record and project metadata with the file; a CRS alone does not establish a vertical datum or distinguish a DSM from bare-earth terrain.
- Parameters:
path (Path)
source (TerrainSource)
- Return type:
- energy_data_retrieval.terrain.read_terrain(path, source, *, bounds_wgs84=None, maximum_pixels=4000000)[source]#
Read an enclosing native-pixel window, retaining its exact grid.
The requested bounding box must fit within this file. Obtain all intersecting tiles separately for larger areas. No reprojection, merging, hole filling, vertical conversion, overview selection or elevation interpolation occurs.
- Parameters:
path (Path)
source (TerrainSource)
bounds_wgs84 (Bounds | None)
maximum_pixels (int)
- Return type:
- energy_data_retrieval.terrain.write_terrain_window(window, path)[source]#
Save decoded metre elevations and source/datum tags, without resampling.
- Parameters:
window (TerrainWindow)
path (Path)
- Return type:
Path