terrain

Terrain HDF reading and GeoTIFF/VRT export.

Provides export_terrain() — reads a RasMapper terrain HDF5 file, mosaics the source GeoTIFFs by priority, applies any Levee-type ground-line modifications stored in the same HDF, and writes the result to a GeoTIFF or GDAL VRT.

Derived from analysis of:

RasMapperLib/RasMapperLib/TerrainLayer.cs RasMapperLib/RasMapperLib.Terrain/RasterFileInfo.cs RasMapperLib/RasMapperLib/GroundLineModificationLayer.cs RasMapperLib/RasMapperLib/ElevationModificationGroup.cs

rivia.hdf.terrain.export_terrain(hdf_path, raster_path, copy=False)[source]

Export a RasMapper terrain HDF to a GeoTIFF or GDAL VRT.

Reads all source GeoTIFFs from the Terrain/ group of hdf_path, mosaics them in priority order (lowest @Priority value wins), applies any Levee-type ground-line modifications from the Modifications/ group, and writes the result to raster_path.

When raster_path has a .vrt extension the output is a GDAL VRT that references the original source TIFFs directly rather than re-encoding pixels. If modifications are present a sidecar <stem>_mods.tif is written beside the VRT and included as the top-most layer.

Parameters:
  • hdf_path (str | Path) – Path to a RasMapper terrain HDF file (File Type = "HEC Terrain").

  • raster_path (str | Path) – Destination path. Use a .tif extension for a merged GeoTIFF or a .vrt extension for a GDAL VRT. Parent directories are created automatically.

  • copy (bool) – Only relevant when raster_path is a .vrt. When True each source TIFF is copied into the VRT’s parent directory and the VRT uses relative paths. When False (default) the VRT uses absolute paths and source files are not copied.

Returns:

Resolved absolute path of the written file.

Return type:

Path

Raises:
  • FileNotFoundError – If hdf_path does not exist, or any source TIFF referenced in the HDF is missing.

  • KeyError – If the HDF contains no Terrain/ group or no source TIFF entries.