Skip to main content

Download and merge DEM tiles for processing interferograms with ISCE2.

Project description

dem-stitcher

This tool aims to (a) provide a continuous raster of Digital Elevation Raster over an area of interest and (b) perform some standard transformations for processing. Such transformations include:

  • converting the vertical datum from a reference geoid to the WGS84 ellipsoidal
  • ensuring a coordinate reference system centered at either the upper-left corner (Area tag) or center of the pixel (Point tag).

We utilize the GIS formats from rasterio. This tool was developed to support cloud SAR processing using ISCE2 and various research. The early work of this repository was done by Charlie Marshak, David Bekaert, Michael Denbina, and Marc Simard.

The API can be summarized as

bounds = [-119.085, 33.402, -118.984, 35.435]
X, p = stitch_dem(bounds,
                  dem_name='glo_30',
                  dst_ellipsoidal_height=False,
                  dst_area_or_point='Area')
# X is an m x n numpy array
# p is a dictionary (or a rasterio profile) including relevant GIS metadata

Then, to save the DEM:

with rasterio.open('dem.tif', 'w', **p) as ds:
   ds.write(X, 1)

Installation with pip

Install dem stitcher: pip install dem-stitcher

For Development

  1. Clone this repo git clone https://github.com/ACCESS-Cloud-Based-InSAR/dem-stitcher.git
  2. Navigate with your terminal to the repo.
  3. Create a new environment and install requirements using conda env update -f environment.yml
  4. Install the package from cloned repo using pip install -e .

Credentials

The accessing of NASADEM and SRTM require earthdata login credentials to be put into the ~/.netrc file. If these are not present, the stitcher will fail with BadZipFile Error as the request is made behind the secnes with rasterio. Specifically,

machine urs.earthdata.nasa.gov
    login <username>
    password <password>

Notebooks

We have notebooks to demonstrate common usage:

We also demonstrate how the tiles used to organize the urls for the DEMs were generated for this tool were generated in this notebook.

DEMs

The DEMs that can currently be used with this tool are:

In [1]: from dem_stitcher.datasets import DATASETS; DATASETS
Out[1]: ['srtm_v3', 'nasadem', 'glo_30', '3dep', 'ned1']
  1. glo-30: Copernicus GLO-30 DEM 30 meter [link]
  2. The USGS DEMSs:
    • ned1: Ned 1 arc-second (deprecated by USGS) [link]
    • 3dep: 3Dep 1 arc-second[link]
  3. srtm_v3: SRTM v3 [link]
  4. nasadem: Nasadem [link]

Transformations

  1. All DEMs are resampled to epsg:4326 (most DEMs are in this CRS)
  2. All DEMs are resampled to match the bounds specified and align with the original DEM pixels
  3. Rasters can be transformed into reference system either referring to each pixel's center or upper-left corners of pixels (i.e. Point and Area tags in gdal, respectively, and seen as {'AREA_OR_POINT: 'Point'} in the case of pixel center reference system). Note that Area is the default pixel reference for gdal as indicated here. Some helpful resources about this book-keeping are below.
    • SRTM v3 and TDX are Pixel-centered, i.e. {'AREA_OR_POINT: 'Point'}.
    • The USGS DEMs are not, i.e. {'AREA_OR_POINT: 'Area'}.
  4. Transform geoid heights to WGS84 Ellipsoidal height. This is done using the rasters here. We generally resample the geoids and into the DEM reference frame before adjusting the vertical datum.

Testing

  1. Install pytest.
  2. Run pytest.

There are automatic github actions that run the said tests as well. Many more tests are still needed.

Contributing

  1. Create an GitHub issue ticket desrcribing what changes you need (e.g. issue-1)
  2. Fork this repo
  3. Make your modifications in your own fork
  4. Make a pull-request in this repo with the code in your fork and tag the repo owner / largest contributor as a reviewer

Support

Create an issue ticket.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dem_stitcher-2.1.0.tar.gz (25.7 MB view details)

Uploaded Source

Built Distribution

dem_stitcher-2.1.0-py3-none-any.whl (25.3 MB view details)

Uploaded Python 3

File details

Details for the file dem_stitcher-2.1.0.tar.gz.

File metadata

  • Download URL: dem_stitcher-2.1.0.tar.gz
  • Upload date:
  • Size: 25.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.12

File hashes

Hashes for dem_stitcher-2.1.0.tar.gz
Algorithm Hash digest
SHA256 19ed17fb3c0b463ee6370b0f1c2f87b4034a5efaa19ebf58ffe0271f6ce1156e
MD5 9d11f1c691e5c3b017e45804ac246fef
BLAKE2b-256 e8216d651b04df549fd6a4213d07a6ff165f152865a95c9f804a2c909b50b0b2

See more details on using hashes here.

File details

Details for the file dem_stitcher-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: dem_stitcher-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 25.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.12

File hashes

Hashes for dem_stitcher-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 74528270ea01998b3901481dd839ab934412a2d78771ca6a803501c17bfeed45
MD5 a88c3e3137bcb723ad50b1fff4200768
BLAKE2b-256 03b69cb18d5c5fed5ad7e9dbbb923fecfbf642ec7968696412aa61781cc27f6f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page