elevation#
Submodules#
Attributes#
Exceptions#
Raised when a product label retired in elevation 2.0 is requested. |
Functions#
|
Clean up the product cache from temporary files. |
|
Clip the DEM to given bounds. |
|
Show the STAC metadata of the datasets. |
|
Remove the product cache entirely. |
|
Show info about the product cache. |
|
Return the DEM cache folder to use, as an absolute path. |
|
Seed the DEM to given bounds. |
|
Audit the system for issues. |
Package Contents#
- exception elevation.ProductRetiredError#
Bases:
KeyErrorRaised when a product label retired in elevation 2.0 is requested.
Subclasses
KeyError, like an unknown product label, but renders the migration message without thereprquoting thatKeyErroradds.
- elevation.clean(cache_dir=None, product=DEFAULT_PRODUCT)#
Clean up the product cache from temporary files.
- Parameters:
cache_dir – Root of the DEM cache folder.
product – DEM product choice.
- elevation.clip(bounds, output=DEFAULT_OUTPUT, margin=MARGIN, product=DEFAULT_PRODUCT, *, cache_dir=None, gdal_options=DEFAULT_GDAL_OPTIONS, max_download_tiles=MAX_DOWNLOAD_TILES)#
Clip the DEM to given bounds.
- Parameters:
bounds – Output bounds in ‘left bottom right top’ order.
output – Path to output file. Existing files will be overwritten.
margin – Decimal degree margin added to the bounds. Use ‘%’ for percent margin.
product – DEM product choice.
cache_dir – Root of the DEM cache folder.
gdal_options – GDAL creation options of the output file, e.g. ‘-co COMPRESS=LZW’.
max_download_tiles – Maximum number of tiles to download.
- elevation.dataset(dataset=None)#
Show the STAC metadata of the datasets.
- Parameters:
dataset – Dataset choice, all the products if not given.
- Returns:
The dataset STAC files, in PRODUCTS order, as a stream of YAML documents.
- elevation.distclean(cache_dir=None, product=DEFAULT_PRODUCT)#
Remove the product cache entirely.
- Parameters:
cache_dir – Root of the DEM cache folder.
product – DEM product choice.
- elevation.info(cache_dir=None, product=DEFAULT_PRODUCT)#
Show info about the product cache.
- Parameters:
cache_dir – Root of the DEM cache folder.
product – DEM product choice.
- Returns:
The product cache report.
- elevation.resolve_cache_dir(cache_dir)#
Return the DEM cache folder to use, as an absolute path.
The
cache_dirargument takes precedence over theEIO_CACHE_DIRenvironment variable, that takes precedence over theCACHE_DIRdefault.
- elevation.seed(cache_dir=None, product=DEFAULT_PRODUCT, bounds=None, max_download_tiles=MAX_DOWNLOAD_TILES, *, margin=MARGIN)#
Seed the DEM to given bounds.
A remote product is not downloaded whole: only the chunks of the store that cover the bounds are read in place and cached.
- Parameters:
cache_dir – Root of the DEM cache folder.
product – DEM product choice.
bounds – Output bounds in ‘left bottom right top’ order.
max_download_tiles – Maximum number of tiles to download.
margin – Decimal degree margin added to the bounds. Use ‘%’ for percent margin.
- Returns:
The datasource root and the bounds with the margin applied.
- elevation.selfcheck(tools=TOOLS, verbose=False)#
Audit the system for issues.
- Parameters:
tools – Tools description, defaults to TOOLS.
verbose – Report each tool as it is tested.
- elevation.CACHE_DIR: str#
- elevation.DEFAULT_GDAL_OPTIONS = '-co TILED=YES -co COMPRESS=DEFLATE -co ZLEVEL=9 -co NUM_THREADS=ALL_CPUS'#
- elevation.DEFAULT_OUTPUT = 'out.tif'#
- elevation.DEFAULT_PRODUCT = 'MAPZEN'#
- elevation.MARGIN = '0'#
- elevation.MAX_DOWNLOAD_TILES = 25#
- elevation.PRODUCTS = ['MAPZEN', 'GLO-30', 'AW3D30', 'SRTM1_GEOID', 'SRTM1_ELLIP', 'GLO-90', 'SRTM3']#
- elevation.RETIRED_PRODUCTS: dict[str, str]#
- elevation.TOOLS: list[tuple[str, str]] = [('gdal_translate', 'gdal_translate --version'), ('gdalbuildvrt', 'gdalbuildvrt --version'),...#