Package for OPERA DISP Tile Map Server (TMS) creation.
- Ensure that conda is installed on your system (we recommend using mambaforge to reduce setup times).
- Download a local version of the
OPERA-DISP-TMSrepository (git clone https://github.com/ASFHyP3/opera-disp-tms.git) - In the base directory for this project call
mamba env create -f environment.ymlto create your Python environment, then activate it (mamba activate opera-disp-tms) - Finally, install a development version of the package (
python -m pip install -e .)
To run all commands in sequence use:
git clone https://github.com/ASFHyP3/opera-disp-tms.git
cd OPERA-DISP-TMS
mamba env create -f environment.yml
mamba activate opera-disp-tms
python -m pip install -e .This application requires Earthdata Login credentials to download OPERA Displacement data. These credentials can be provided either via a urs.earthdata.nasa.gov entry in your .netrc file, or via EARTHDATA_USERNAME and EARTHDATA_PASSWORD environment variables.
For instructions on setting up your Earthdata Login via a .netrc file, check out this guide.
The weekly-tileset-generation.py script delivers updated velocity mosaics to the ASF Displacement portal at https://displacement.asf.alaska.edu. This script:
- Queries CMR for
OPERA_L3_DISP-S1_V1granules to determine the ascending and descending frames for which data is available. - Submits
OPERA_DISP_TMSjobs to https://hyp3-api.asf.alaska.edu/ to generate ascending and descending mosaics. - Syncs the new mosaics to the production hosting bucket at
s3://asf-services-web-content-prod/.
To run this script:
- Configure an
edc-prodprofile in your.aws/configand.aws/credentialsfiles.- (Optional) For speedier results, run from
us-west-2and increasemax_concurrent_requestsper AWS CLI S3 Configuration.
- (Optional) For speedier results, run from
- Set up your .netrc file per Credentials.
- Install the application per Installation and activate the conda environment.
- Navigate to the scripts directory and run the script.
- (Optional) This script will take hours to run, so running it as a background process via
screenortmuxis recommended. cd scripts; python weekly-tileset-generation.py
- (Optional) This script will take hours to run, so running it as a background process via
Warning
This application uses S3 Direct Access to download OPERA Displacement data, and must be run in the us-west-2 AWS region.
The create_measurement_geotiff CLI command can be used to generate a short wavelength velocity geotiff for a given OPERA frame:
create_measurement_geotiff 11115 velocity 20140101 20260101Where 11115 is OPERA frame id of the granule stack in CMR, and 20140101/20260101 specify the start/end of the secondary date search range in format %Y%m%d.
The velocity will be calculated from the minimum set of granules needed to span the temporal search range.
The resulting products have the name format:
velocity_{frame id}_{start date}_{end_date}.tif
For example:
velocity_11115_20140101_20260101.tif
The create_tile_map CLI command generates a directory with small.png tiles from a s3 bucket with a list of rasters in a common projection, following the OSGeo Tile Map Service Specification, using gdal2tiles: https://gdal.org/en/latest/programs/gdal2tiles.html
To create a tile map from a set of velocity GeoTIFFs:
create_tile_map velocity --bucket myBucket --bucket-prefix myPrefixThis will look for all .tif files in s3://myBucket/myPrefix/ and use them to make the tile map.
A simple web page with a viewer based on OpenLayers is included to visualize the map in a browser, e.g. tiles/openlayers.html.
The output directory can be copied to a public AWS S3 bucket (or any other web server) to access the map tiles over the internet:
aws s3 cp tiles/ s3://myBucket/tiles/ --recursive
The online map can then be reviewed in a browser, e.g. https://myBucket.s3.amazonaws.com/tiles/openlayers.html
The general strategy used to produce the mosaic visualizations is as follows:
- For each of ASCENDING and DESCENDING:
- Query CMR to identify all frames with data for the given flight direction
- For each frame, create an average velocity GeoTIFF
- Find the minimum set of granules spanning the full temporal extent of the available data
- Create a short wavelength displacement time series from those granules
- Take a linear regression of that time series to determine velocity
- If a pixel is NoData in <= 10% of granules, treat NoData as zero in the time series for that pixel
- If a pixel is NoData in > 10% of granules, set the velocity for that pixel to NoData
- Set values outside [-0.03 m/yr, +0.03 m/yr] to -0.03 and +0.03
- Write the average velocity values to a geotiff
- Overlay the individual frame GeoTIFFs into a mosaic
- In areas where multiple frames overlap, prefer showing near-range pixels over far-range pixels (e.g. easternmost frame on top for ascending, westernmost on top for descending)
- If the preferred frame has no data for a particular pixel, let the data value of the less-preferred frame show through
The OPERA-DISP-TMS package is licensed under the Apache License, Version 2 license. See the LICENSE file for more details.
We strive to create a welcoming and inclusive community for all contributors. As such, all contributors to this project are expected to adhere to our code of conduct.
Please see CODE_OF_CONDUCT.md for the full code of conduct text.