Create upsampled DEMs for InSAR processing
Project description
DEM creator
Tool for making Digital Elevation Maps (DEMs) in binary data format (16-bit integers, little endian) for use in Interferometric SAR (InSAR) processing
sardem
creates a cropped (and possibly upsampled) digital elevation map:
usage: sardem [-h] [--bbox left bottom right top] [--geojson GEOJSON] [--wkt-file WKT_FILE] [--xrate XRATE] [--yrate YRATE] [--output OUTPUT] [--data-source {NASA,NASA_WATER,COP}] [-isce] [--keep-egm] [--shift-rsc]
[left_lon] [top_lat] [dlon] [dlat]
The default data source, --data-source NASA
, uses the SRTM 1 arcsecond data. You can also use the newer Copernicus Digital Surface Model (DSM).
Note To convert the elevation values to heights about the WGS84 ellipsoid (which is the default), GDAL is required. See below:
Setup and installation
pip install sardem
This creates the command line executable sardem
Alternatively, you can clone to build/install:
git clone https://github.com/scottstanie/sardem
cd sardem
make
which will run pip install --upgrade .
and create the command line script.
If you use virtualenv
# Optional for using virtualenv
virtualenv ~/envs/sardem && source ~/envs/sardem/bin/activate # Or wherever you store your virtual envs
# Or if you have virtualenv wrapper: mkvirtualenv sardem
pip install sardem
Converting to WGS84 ellipsoidal heights from EGM96/EGM2008 geoid heights
GDAL is required for the conversion, which is most easily installed using conda
(or mamba
):
conda install -c conda-forge gdal
# or
# conda install -c conda-forge mamba
# mamba install -c conda-forge gdal
Command Line Interface
The full options for the command line tool in sardem/cli.py
can be found using
$ sardem --help
sardem -h
usage: sardem [-h] [--bbox left bottom right top] [--geojson GEOJSON] [--wkt-file WKT_FILE] [--xrate XRATE] [--yrate YRATE] [--output OUTPUT] [--data-source {NASA,NASA_WATER,COP}] [-isce] [--keep-egm] [--shift-rsc]
[left_lon] [top_lat] [dlon] [dlat]
Stiches SRTM .hgt files to make (upsampled) DEM
Pick a lat/lon bounding box for a DEM, and it will download
the necessary SRTM1 tiles, stitch together, then upsample.
Usage Examples:
sardem --bbox -156 18.8 -154.7 20.3 # bounding box: left bottom right top
sardem -156.0 20.2 1 2 --xrate 2 --yrate 2 # Makes a box 1 degree wide, 2 deg high
sardem --bbox -156 18.8 -154.7 20.3 --data-source COP # Copernicus DEM
sardem --geojson dem_area.geojson -x 11 -y 3 # Use geojson file to define area
sardem --bbox -156 18.8 -154.7 20.3 --data-source NASA_WATER -o my_watermask.wbd # Water mask
sardem --bbox -156 18.8 -154.7 20.3 --data COP -isce # Generate .isce XML files as well
Default out is elevation.dem for the final upsampled DEM.
Also creates elevation.dem.rsc with start lat/lon, stride, and other info.
positional arguments:
left_lon Left (western) most longitude of DEM box (degrees, west=negative)
top_lat Top (northern) most latitude of DEM box (degrees)
dlon Width of DEM box (degrees)
dlat Height of DEM box (degrees)
options:
-h, --help show this help message and exit
--bbox left bottom right top
Bounding box of area of interest (e.g. --bbox -106.1 30.1 -103.1 33.1 ).
--geojson GEOJSON, -g GEOJSON
Alternate to corner/dlon/dlat box specification:
File containing the geojson object for DEM bounds
--wkt-file WKT_FILE Alternate to corner/dlon/dlat box specification:
File containing the WKT string for DEM bounds
--xrate XRATE, -x XRATE
Rate in x dir to upsample DEM (default=1, no upsampling)
--yrate YRATE, -y YRATE
Rate in y dir to upsample DEM (default=1, no upsampling)
--output OUTPUT, -o OUTPUT
Name of output dem file (default=elevation.dem for DEM, watermask.wbd for water mask)
--data-source {NASA,NASA_WATER,COP}, -d {NASA,NASA_WATER,COP}
Source of DEM data (default NASA). See README for more.
-isce, --make-isce-xml
Make an isce2 XML file for the DEM.
--keep-egm Keep the DEM heights as geoid heights above EGM96 or EGM2008. Default is to convert to WGS84 for InSAR processing.
--shift-rsc Shift the .rsc file by half a pixel so that X_FIRST and Y_FIRST are at the pixel center (instead of GDAL's convention of the top left edge). Default is GDAL's top-left edge convention.
The code used for bilinear interpolation in the upsampling routine is in cython/upsample.c
, and is wrapped in cython to allow easier installation and ability to call the function from Python.
The installation is handled through pip install
, or by running make build
.
Functions for working with digital elevation maps (DEMs) are mostly contained in the Downloader
and Stitcher
classes within sardem/dem.py
and sardem/download.py
.
NASA SRTM Data access
The default data source is NASA's Shuttle Radar Topography Mission (SRTM) version 3 global 1 degree data. See https://lpdaac.usgs.gov/dataset_discovery/measures/measures_products_table/srtmgl3s_v003 . The data is valid outside of arctic regions (-60 to 60 degrees latitude), and is zeros over open ocean.
This data requires a username and password from here: https://urs.earthdata.nasa.gov/users/new
You will be prompted for a username and password when running with NASA data. It will save into your ~/.netrc file for future use, which means you will not have to enter a username and password any subsequent times. The entry will look like this:
machine urs.earthdata.nasa.gov
login USERNAME
password PASSWORD
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for sardem-0.10.7-pp37-pypy37_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1008666d77f8b927daffd0baac95b4c53a82be5a14e86a21b8d4abd1da4e1b59 |
|
MD5 | f6cebffb777da2341834d4842d7cf9ec |
|
BLAKE2b-256 | 9f7a1528bbb3cab72361e52de50e722231e4c62513e4e3871a06c44317221c30 |
Hashes for sardem-0.10.7-pp37-pypy37_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56f45124ffa11b943706ec3ba2c7d3bf9c0b27c09c17390932b0d6b4e4db89df |
|
MD5 | 32ab367bbeed2ac593e4c73599ad6eea |
|
BLAKE2b-256 | 021cf974cd5b15575a25b25d9050fadb929b39b82cd08b20123d1a3f32e19740 |
Hashes for sardem-0.10.7-pp37-pypy37_pp73-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 632f7a65f2ed1c1f4de9c05d145c771cb9b12fb3d494ddce72fb8adb685f2547 |
|
MD5 | 28703c88432ccb7569555b1b413fdd62 |
|
BLAKE2b-256 | f97ddceea89ae9727bbba58b2c26060088c6bfbcb0b4a89de01a6ffde69343a7 |
Hashes for sardem-0.10.7-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7cbd79ff2d070b262655cc3722c7ab2576be5628b64264217c3f6ece90b6db3a |
|
MD5 | be682278ce7904e23a94fff557b7d7db |
|
BLAKE2b-256 | feb756d42c07386256476212d3ae572c9687414397e07925d934fe6819b1f289 |
Hashes for sardem-0.10.7-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9859aef26279f07d2c4ff27d6aac62af291f2f6aef1de83f03b15b1ca5462c77 |
|
MD5 | 7f7e857333e1f9e818e973deec85ac1a |
|
BLAKE2b-256 | f1afcdce53e20887825bae6041f01fe2fd893b03b2dd66f255e6817c32933da2 |
Hashes for sardem-0.10.7-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6fc5289deb0b17ebe77ed5c49a94da96f26cd9c4c41c81aa0feaa41bf679fe6b |
|
MD5 | 46ddfa3a3390b2989f68a9243d986ea1 |
|
BLAKE2b-256 | 345d845a6b12bd39ba4adda87dcaf1162bc8f375e9efd1980c43e0470d884faa |
Hashes for sardem-0.10.7-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b06a45f51331d79f783160f6a60423f936eb3b08301fca428ce265789d80079 |
|
MD5 | 16c4621336dc3232d7c39d4d43420c69 |
|
BLAKE2b-256 | 2d8a151f32d3b9aa481cf6ba66daad7cc5ad1cd202e94d40c291beadf41bbaec |
Hashes for sardem-0.10.7-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d14338e302406dbd3838c667339658922fd52d14268d1ea583d68e35420bae5 |
|
MD5 | f2f913d325f64b01becbdc40f35f06e8 |
|
BLAKE2b-256 | 587917e4badbe6d288d40fef781ea89cfb0e185e0b01bb2b68216bc92d2a9cf0 |
Hashes for sardem-0.10.7-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57689498927d7ac2e3fff1b9b417db0be05736f6582326d0d3036d32a0c15301 |
|
MD5 | 203474e47ce036861c7b7dcd09c87e25 |
|
BLAKE2b-256 | 66df516568a27a4503c1e26abc6cad372198ea2dcacfff8c18931a98eeb3b06f |
Hashes for sardem-0.10.7-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 222053f9a16b20d980e996e23cdb2388d7a04cc82e60f46bf0aa12fa369a0465 |
|
MD5 | dce66e503631096bbdbecb707727c8a6 |
|
BLAKE2b-256 | 697f2c8a833c56a78e4788b088abf9e324a4df99fdbefcc8797c524298b86e04 |
Hashes for sardem-0.10.7-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e54d8ad2c79c575ed27ed91f735470fff13cfa24594911f139cbc7ecd9eef16 |
|
MD5 | 4074e250e1e2ed4ee979de5368c8eade |
|
BLAKE2b-256 | 79b31b273540d248b82f64b50dd93e863b63b62dc90d3ce1409a4470ca260af8 |
Hashes for sardem-0.10.7-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d9e904c0d967819abcbe964b3dcf5102858c65cc08b1aff3292b59db2fa0268c |
|
MD5 | 63ccf552c9ad5ae8df3f4d0b71be5840 |
|
BLAKE2b-256 | e1404458827a3dd8156a33ae6ac1bf26de534b1b10d761dfbb46595fa32286e7 |
Hashes for sardem-0.10.7-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e8b5ffd8e2230a151e8da65a078ad2d0d66dc1dad30231c31bf4c83132d0db6e |
|
MD5 | b97f9c783b61886f03d7eb149593896c |
|
BLAKE2b-256 | 2d4fdb85f17caff636d4bef0679a8c497579f579ed1613b6eeecb6030963870f |
Hashes for sardem-0.10.7-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a72461e529041d24bde885a067f0c5e94c67a2696188e042edcc35a279f9a5ad |
|
MD5 | b461551b016c5480fc0e9d1ac38bbe10 |
|
BLAKE2b-256 | c3a1d12616f1498fd9080b32638d89dd0b7e852088fb980e30108834e406e9d0 |
Hashes for sardem-0.10.7-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8faf1832556b40a2964fcb8992417210fd22d42a48618a3cfabd08445c6c7184 |
|
MD5 | f35b6bc1b3d5912cfb254daef20ca321 |
|
BLAKE2b-256 | 378b622ec09c59863e985fc333d1b532a06eb2f3a522c3ca7f4e4a548f293885 |
Hashes for sardem-0.10.7-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e97bd139d86299402a698d911fb82bd37be7b65147add31eaab771e0caa3d90 |
|
MD5 | 2163020e3c73108d9bda900692fb96f3 |
|
BLAKE2b-256 | a56cb94eb820a371dceea1a1e42c9d7d7b4eb347385b817920540e405181165a |
Hashes for sardem-0.10.7-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | faa6f497275b5c7ad149d75626a75fd017ba79d767f7ef3cd2a92ae1062f23c2 |
|
MD5 | 18fd6014f2cc4b023199e310fa4507bb |
|
BLAKE2b-256 | 33842a962af3858b2aac8d74890eb07008797f2281d70a74c9263217d7293ae8 |
Hashes for sardem-0.10.7-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7275f0a9f7f3f33a4656b22cccb2b4366cc4fdefb3fa4a0c07db5bfe65a80d2f |
|
MD5 | cba49a25fb5e028780d3d6d5aa189399 |
|
BLAKE2b-256 | 496d77dcc5743a7dbb4dff1f09a2036c7e369f5a70e36ea67d0689e0be17e178 |