Auxiliary Data Tools¶
obtain all relevant DEM tiles for selected geometries |
|
create a new DEM GeoTIFF file and optionally convert heights from geoid to ellipsoid |
|
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
geometries (list[spatialist.vector.Vector]) – a list of
spatialist.vector.Vector
geometries to obtain DEM data for; CRS must be WGS84 LatLon (EPSG 4326)demType (str) –
the type of DEM to be used; current options:
’AW3D30’ (ALOS Global Digital Surface Model “ALOS World 3D - 30m”)
url: ftp://ftp.eorc.jaxa.jp/pub/ALOS/ext1/AW3D30/release_v1804
height reference: EGM96
’Copernicus 10m EEA DEM’ (Copernicus 10 m DEM available over EEA-39 countries)
registration: https://spacedata.copernicus.eu/web/cscda/data-access/registration
url: ftps://cdsdata.copernicus.eu/DEM-datasets/COP-DEM_EEA-10-DGED/2021_1
height reference: EGM2008
’Copernicus 30m Global DEM’
info: https://copernicus-dem-30m.s3.amazonaws.com/readme.html
url: https://copernicus-dem-30m.s3.eu-central-1.amazonaws.com/
height reference: EGM2008
’Copernicus 30m Global DEM II’
registration: https://spacedata.copernicus.eu/web/cscda/data-access/registration
url: ftps://cdsdata.copernicus.eu/DEM-datasets/COP-DEM_GLO-30-DGED/2021_1
height reference: EGM2008
’Copernicus 90m Global DEM’
info: https://copernicus-dem-90m.s3.amazonaws.com/readme.html
url: https://copernicus-dem-90m.s3.eu-central-1.amazonaws.com/
height reference: EGM2008
’Copernicus 90m Global DEM II’
registration: https://spacedata.copernicus.eu/web/cscda/data-access/registration
url: ftps://cdsdata.copernicus.eu/DEM-datasets/COP-DEM_GLO-90-DGED/2021_1
height reference: EGM2008
’GETASSE30’
info: https://seadas.gsfc.nasa.gov/help-8.1.0/desktop/GETASSE30ElevationModel.html
height reference: WGS84
’SRTM 1Sec HGT’
height reference: EGM96
’SRTM 3Sec’
url: https://srtm.csi.cgiar.org/wp-content/uploads/files/srtm_5x5/TIFF
height reference: EGM96
’TDX90m’
registration: https://geoservice.dlr.de/web/dataguide/tdm90
url: ftpes://tandemx-90m.dlr.de
height reference: WGS84
vrt (str or None) – an optional GDAL VRT file created from the obtained DEM tiles
buffer (int, float, None) – a buffer in degrees to add around the individual geometries
username (str or None) – (optional) the username for services requiring registration
password (str or None) – (optional) the password for the registration account
product (str) –
the sub-product to extract from the DEM product. The following options are available for the respective DEM types:
’AW3D30’
’dem’: the actual Digital Elevation Model
’msk’: mask information for each pixel (Cloud/Snow Mask, Land water and low correlation mask, Sea mask, Information of elevation dataset used for the void-filling processing)
’stk’: number of DSM-scene files which were used to produce the 5 m resolution DSM
’Copernicus 10m EEA DEM’
’dem’: the actual Digital Elevation Model
’edm’: editing mask
’flm’: filling mask
’hem’: height error mask
’wbm’: water body mask
’Copernicus 30m Global DEM’
’dem’: the actual Digital Elevation Model
’Copernicus 30m Global DEM II’
’dem’: the actual Digital Elevation Model
’edm’: editing mask
’flm’: filling mask
’hem’: height error mask
’wbm’: water body mask
’Copernicus 90m Global DEM’
’dem’: the actual Digital Elevation Model
’Copernicus 90m Global DEM II’
’dem’: the actual Digital Elevation Model
’edm’: editing mask
’flm’: filling mask
’hem’: height error mask
’wbm’: water body mask
’GETASSE30’
’dem’: the actual Digital Elevation Model
’SRTM 1Sec HGT’
’dem’: the actual Digital Elevation Model
’SRTM 3Sec’
’dem’: the actual Digital Elevation Model
’TDX90m’
’dem’: the actual Digital Elevation Model
’am2’: Amplitude Mosaic representing the minimum value
’amp’: Amplitude Mosaic representing the mean value
’com’: Consistency Mask
’cov’: Coverage Map
’hem’: Height Error Map
’lsm’: Layover and Shadow Mask, based on SRTM C-band and Globe DEM data
’wam’: Water Indication Mask
nodata (int or float or None) – the no data value of the source files.
dst_nodata (int or float or None) – the nodata value of the VRT file.
hide_nodata (bool) – hide the VRT no data value?
crop (bool) – crop to the provided geometries (or return the full extent of the DEM tiles)? Argument buffer is ignored if set to False.
- 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 ofsrc
.tr (None or tuple) – the target resolution as (xres, yres)
resampling_method (str) – the gdalwarp resampling method; See here for options.
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