DEM tools
A collection of functions to handle digital elevation models in GAMMA
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) |
|
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 (
Vector) – a vector geometry delimiting the output DEM sizedemType (
str) – the type of DEM to be used; seedem_autoload()for optionsoutfile (
str) – the name of the final DEM filebuffer (
int|float|None) – a buffer in degrees to create around the geometryt_srs (
int|str|SpatialReference) – A target geographic reference system in WKT, EPSG, PROJ4 or OPENGIS format. See functionspatialist.auxil.crsConvert()for details. Default: 4326.tr (
tuple[int|float,int|float] |None) – the target resolution as (xres, yres) in units oft_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|None) – a directory to write GAMMA logfiles tousername (
str|None) – (optional) the user name for services requiring registration; seedem_autoload()password (
str|None) – (optional) the password for the registration accountgeoid_mode (
Literal['gamma','gdal']) – the software to be used for converting geoid to ellipsoid heights (if necessary)resampling_method (
str) – the gdalwarp resampling method; See here for options.
- Return type:
- pyroSAR.gamma.dem.dem_import(src, dst, geoid=None, logpath=None, outdir=None, shellscript=None)[source]
convert an existing DEM in GDAL-readable format to GAMMA format including optional geoid-ellipsoid conversion.
- Parameters:
src (
str) – the input DEMdst (
str) – the output DEMgeoid (
Literal['EGM96','EGM2008'] |None) – the geoid height reference of src; supported options. Default None: assume WGS84 ellipsoid heights and do not convert heights.outdir (
str|None) – the directory to execute the command inshellscript (
str|None) – a file to write the GAMMA commands to in shell format
- Return type:
- 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)