DEM tools¶
A collection of functions to handle digital elevation models in GAMMA
automatically create a DEM in GAMMA format for a defined spatial geometry.
|
|
convert an existing DEM in GDAL-readable format to GAMMA format including optional geoid-ellipsoid conversion. |
|
create GAMMA parameter text files for DEM files |
|
interpolate missing values in the SRTM DEM (value -32768) |
|
concatenate hgt file names overlapping with multiple SAR scenes |
|
automatic downloading and unpacking of srtm tiles |
|
Create a DEM in GAMMA format from SRTM tiles |
|
mosaicing of multiple DEMs |
|
byte swapping from small to big endian (as required by GAMMA) |
- pyroSAR.gamma.dem.dem_autocreate(geometry, demType, outfile, buffer=None, t_srs=4326, tr=None, logpath=None, username=None, password=None, geoid_mode='gamma', resampling_method='bilinear')[source]¶
- automatically create a DEM in GAMMA format for a defined spatial geometry.The following steps will be performed:
collect all tiles overlapping with the geometry using
pyroSAR.auxdata.dem_autoload()if they don’t yet exist locally they will automatically be downloaded
the tiles will be downloaded into the SNAP auxdata directory structure, e.g.
$HOME/.snap/auxdata/dem/SRTM 3Sec
create a mosaic GeoTIFF of the same spatial extent as the input geometry plus a defined buffer using
pyroSAR.auxdata.dem_create()if necessary, subtract the geoid-ellipsoid difference (see
pyroSAR.auxdata.dem_autoload()for height references of different supported DEMs)convert the result to GAMMA format
If
t_srsis 4326 and the DEM’s height reference is either WGS84 ellipsoid or EGM96 geoid, the commandsrtm2demcan be used. This is kept for backwards compatibility.For all other cases the newer command
dem_importcan be used if it exists and if the commandcreate_dem_paraccepts a parameter EPSG.
- Parameters:
geometry (spatialist.vector.Vector) – a vector geometry delimiting the output DEM size
demType (str) – the type of DEM to be used; see
dem_autoload()for optionsoutfile (str) – the name of the final DEM file
buffer (float or None) – a buffer in degrees to create around the geometry
t_srs (int, str or osgeo.osr.SpatialReference) – A target geographic reference system in WKT, EPSG, PROJ4 or OPENGIS format. See function
spatialist.auxil.crsConvert()for details. Default: 4326.tr (tuple or None) – the target resolution as (xres, yres) in units of
t_srs; ift_srsis kept at its default value of 4326,trdoes not need to be defined and the original resolution is preserved; in all other cases the default of None is rejectedlogpath (str) – a directory to write GAMMA logfiles to
username (str or None) – (optional) the user name for services requiring registration; see
dem_autoload()password (str or None) – (optional) the password for the registration account
geoid_mode (str) –
the software to be used for converting geoid to ellipsoid heights (if necessary); options:
’gamma’
’gdal’
resampling_method (str) – the gdalwarp resampling method; See here for options.
- pyroSAR.gamma.dem.dem_import(src, dst, geoid=None, logpath=None, outdir=None)[source]¶
convert an existing DEM in GDAL-readable format to GAMMA format including optional geoid-ellipsoid conversion.
- Parameters:
src (str) – the input DEM
dst (str) – the output DEM
geoid (str or None) –
the geoid height reference of src; supported options:
’EGM96’
’EGM2008’
None: assume WGS84 ellipsoid heights and do not convert heights
logpath (str or None) – a directory to write logfiles to
outdir (str or None) – the directory to execute the command in
- pyroSAR.gamma.dem.dempar(dem, logpath=None)[source]¶
create GAMMA parameter text files for DEM files
currently only EQA and UTM projections with WGS84 ellipsoid are supported
- pyroSAR.gamma.dem.fill(dem, dem_out, logpath=None, replace=False)[source]¶
interpolate missing values in the SRTM DEM (value -32768)
- pyroSAR.gamma.dem.hgt(parfiles)[source]¶
concatenate hgt file names overlapping with multiple SAR scenes
this list is read for corner coordinates of which the next integer lower left latitude and longitude is computed
hgt files are supplied in 1 degree equiangular format named e.g. N16W094.hgt (with pattern [NS][0-9]{2}[EW][0-9]{3}.hgt
For north and east hemisphere the respective absolute latitude and longitude values are smaller than the lower left coordinate of the SAR image
west and south coordinates are negative and hence the nearest lower left integer absolute value is going to be larger
- pyroSAR.gamma.dem.hgt_collect(parfiles, outdir, demdir=None, arcsec=3)[source]¶
automatic downloading and unpacking of srtm tiles
- Parameters:
- Returns:
the names of all local hgt tiles overlapping with the parfiles
- Return type:
- pyroSAR.gamma.dem.makeSRTM(scenes, srtmdir, outname)[source]¶
Create a DEM in GAMMA format from SRTM tiles
coordinates are read to determine the required DEM extent and select the necessary hgt tiles
mosaics SRTM DEM tiles, converts them to GAMMA format and subtracts offset to WGS84 ellipsoid
intended for SRTM products downloaded from:
CGIAR: https://srtm.csi.cgiar.org