Auxiliary Data Tools

dem_autoload

obtain all relevant DEM tiles for selected geometries

dem_create

create a new DEM GeoTIFF file and optionally convert heights from geoid to ellipsoid

get_egm_lookup

Download lookup tables for converting EGM geoid heights to WGS84 ellipsoid heights.

pyroSAR.auxdata.dem_autoload(geometries, demType, vrt=None, buffer=None, username=None, password=None, product='dem', nodata=None, dst_nodata=None, hide_nodata=False, crop=True)[source]

obtain all relevant DEM tiles for selected geometries

Parameters
Returns

the names of the obtained files or None if a VRT file was defined

Return type

list or None

Examples

download all SRTM 1 arcsec DEMs overlapping with a Sentinel-1 scene and mosaic them to a single GeoTIFF file

from pyroSAR import identify
from pyroSAR.auxdata import dem_autoload
from spatialist import gdalwarp

# identify the SAR scene
filename = 'S1A_IW_SLC__1SDV_20150330T170734_20150330T170801_005264_006A6C_DA69.zip'
scene = identify(filename)

# extract the bounding box as spatialist.Vector object
bbox = scene.bbox()

# download the tiles and virtually combine them in an in-memory
# VRT file subsetted to the extent of the SAR scene plus a buffer of 0.01 degrees
vrt = '/vsimem/srtm1.vrt'
dem_autoload(geometries=[bbox], demType='SRTM 1Sec HGT',
             vrt=vrt, buffer=0.01)

# write the final GeoTIFF file
outname = scene.outname_base() + 'srtm1.tif'
gdalwarp(src=vrt, dst=outname, options={'format': 'GTiff'})

# alternatively use function dem_create and warp the DEM to UTM
# including conversion from geoid to ellipsoid heights
from pyroSAR.auxdata import dem_create
outname = scene.outname_base() + 'srtm1_ellp.tif'
dem_create(src=vrt, dst=outname, t_srs=32632, tr=(30, 30),
           geoid_convert=True, geoid='EGM96')
pyroSAR.auxdata.dem_create(src, dst, t_srs=None, tr=None, resampling_method='bilinear', threads=None, geoid_convert=False, geoid='EGM96', outputBounds=None, nodata=None, dtype=None, pbar=False)[source]

create a new DEM GeoTIFF file and optionally convert heights from geoid to ellipsoid

Parameters
  • src (str) – the input dataset, e.g. a VRT from function dem_autoload()

  • dst (str) – the output dataset

  • t_srs (None, int, str or osr.SpatialReference) – A target geographic reference system in WKT, EPSG, PROJ4 or OPENGIS format. See function spatialist.auxil.crsConvert() for details. Default (None): use the crs of src.

  • tr (None or tuple) – the target resolution as (xres, yres)

  • resampling_method (str) – the gdalwarp resampling method; See here for options.

  • threads (int, str or None) –

    the number of threads to use. Possible values:

    • Default None: use the value of GDAL_NUM_THREADS without modification. If GDAL_NUM_THREADS is None, multi-threading is still turned on and two threads are used, one for I/O and one for computation.

    • integer value: temporarily modify GDAL_NUM_THREADS and reset it once done. If 1, multithreading is turned off.

    • ALL_CPUS: special string to use all cores/CPUs of the computer; will also temporarily modify GDAL_NUM_THREADS.

  • geoid_convert (bool) – convert geoid heights?

  • geoid (str) –

    the geoid model to be corrected, only used if geoid_convert == True; current options:

    • ’EGM96’

    • ’EGM2008’

  • outputBounds (list or None) – output bounds as [xmin, ymin, xmax, ymax] in target SRS

  • nodata (int or float or str or None) – the no data value of the source and destination files. Can be used if no source nodata value can be read or to override it. A special string ‘None’ can be used to skip reading the value from the source file.

  • dtype (str or None) – override the data type of the written file; Default None: use same type as source data. Data type notations of GDAL (e.g. Float32) and numpy (e.g. int8) are supported.

  • pbar (bool) – add a progressbar?

pyroSAR.auxdata.get_egm_lookup(geoid, software)[source]

Download lookup tables for converting EGM geoid heights to WGS84 ellipsoid heights.

Parameters