Tools for validating OPERA RTC products.
If you are working locally:
- Make sure you have conda/mamba installed
- Create the
opera_calval_rtcconda environment using one of theyamlfiles in theenvironmentsdirectory- In a terminal, run:
mamba env create -f path/to/calval-RTC/environment/environment.yaml
- In a terminal, run:
- Activate your environment and start Jupyter Lab.
- In a terminal run:
cd path/to/calval-RTCconda activate opera_calval_rtcpython -m ipykernel install --user --name opera_calval_rtcjupyter lab
- In a terminal run:
The image includes all software needed to run the workflows in a Jupyter Lab environment
docker pull ghcr.io/opera-cal-val/calval-rtc:latest
docker build -t calval-rtc:latest path/to/calval-RTC/environment/
- In a terminal, run:
cd path/to/calval-RTCconda activate opera_calval_rtcpython -m ipykernel install --user --name opera_calval_rtcjupyter lab
- Launch the
Bulk_Validation.ipynbnotebook. - Depending on where you run the notebook (locally, in OpenSARLab, or on another JupyterHub), you may need to select the kernel for the conda environment after launching the notebook
- Using the kernel selector at the top right of your notebook Jupyter Lab tab or the
Change Kerneloption in theKernelmenu, selectopera_calval_rtc
- Using the kernel selector at the top right of your notebook Jupyter Lab tab or the
- Run the notebook
- The notebook will prompt you to select a validation module, validation site, and Sentinel-1 orbital path
- It will download the needed data and perform validation on every available scene for a given module, site, and orbital path
- All output will be stored at the path:
../OPERA_L2-RTC_CalVal
- The notebook will prompt you to select a validation module, validation site, and Sentinel-1 orbital path
Run the OPERA_RTC_download_reproject_mosaic_sample_bursts.ipynb notebook to create RTC and static file mosaics as inputs to CalVal modules.
The notebook:
- Inputs a Sentinel-1 scene ID
- Identifies potential bursts associated with the scene
- Searches
s3://opera-pst-rs-pop1/products/RTC_S1for bursts - Filters discovered bursts for the most recent, 2nd to most recent, etc... batch of samples
- Downloads VV, VH, incidence angle map, local incidence angle map, and layover/shadow mask
- Projects all bursts in scene to predominant UTM (if necessary)
- Merges all bursts and saves mosaics
- Deletes bursts
Run the OPERA_RTC_download_reproject_mosaic_sample_bursts.ipynb notebook on a list of Sentinel-1 scenes using the papermill_OPERA_RTC_download_reproject_mosaic_sample_bursts.py Python script.
- Update the
sceneslist in the script to contain the desired scene IDs - Update the
prod_versionnumber in the script to reflect the desired product version number (default 1.0) - Update
opera_dirto the directory in which you would like to store your RTC directories - Update
keep_date_indexto target a given batch of samples- 0: oldest sample, -1: most recent sample, -2: 2nd to most recent sample, etc...
- In a terminal, run the following commands:
conda activate opera_calval_rtcpython path/to/papermill_OPERA_RTC_download_reproject_mosaic_sample_bursts.py
Point Target-Based Absolute Geolocation Evaluation Module
- Download and mosaic OPERA RTC sample burst data for a given Sentinel-1 scene using the notebook
OPERA_RTC_download_reproject_mosaic_sample_bursts.ipynbor the Python scriptpapermill_OPERA_RTC_download_reproject_mosaic_sample_bursts.py(see above instructions) - Run the notebook to evaluate absolute geolocation on a single scene or the Python script to evaluate multiple scenes (instructions follow)
Run ALE/ALE.ipynb notebook
The notebook:
- Inputs a path to the directory holding an RTC mosaic
- Creates an output directory named
absolute_geolocation_{S1 scene ID} - Deletes all mosaics except VV polarization, which is moved to the output directory
- Identifies corner reflector site intersecting data
- Downloads corner reflector data
- Filters corner reflectors, removing those facing away from the sensor
- Calculates the geolocation error in Northing and Easting
- Removes corner reflectors that fall on the edge of a pixel
- Plots the error
- Appends results to a CSV file
Run the ALE/ALE.ipynb notebook on a list of paths to OPERA RTC mosaics using the calval-RTC/ALE/papermill_ALE.py Python script
- Update the
data_dirs_parentpath in the script to reflect the parent path of the directories containing OPERA RTC mosaics - In a terminal, run the following commands:
conda activate opera_calval_rtcpython path/to/ALE/papermill_ALE.py
Cross-Correlation-Based Relative Geolocation Evaluation
- Download and mosaic a OPERA RTC sample burst data for a stack of Sentinel-1 scenes using the notebook
OPERA_RTC_download_reproject_mosaic_sample_bursts.ipynbor the Python scriptpapermill_OPERA_RTC_download_reproject_mosaic_sample_bursts.py(see above instructions) - Run the notebook to evaluate relative geolocation between scenes with a cross-correlation approach (instructions follow)
Run the RLE/RLE.ipynb notebook
The notebook:
- Buffers all scenes in the stack so they have the same extents
- Remove the top and bottom 1% Gamma0 values
- Divide each scene into 64 tiles
- Perform phase cross correlation on:
- nearest neighbors
- scene1 scene2, scene2 scene3, scene3 scene4, etc...
- first and last scene in stack
- nearest 4th neighbor scenes
- scene1 scene4, scene4 scene8, scene8 scene12, etc...
- nearest neighbors
- Plot results
- Write results to CSV
Run the RLE/papermill_RLE.py script on multiple RTC stacks
- Update
stack_dirs, adding paths to the directories holding RTC stacks - Update
delete_mosaics
True: deletes input dataFalse: saves input data
- Update
cleanup_listto save or delete intermediate data
- uncomment data products to delete
- Save changes to script
- Run script in
opera_calval_rtcconda environment- Open a terminal and run the following commands
conda activate opera_calval_rtcPython path/to/RLE/papermill_RLE.py
Radiometric Terrain Flattening Performance Evaluation Module: Gamma Naught Comparisons of Foreslope, Flat, and Backslope Pixels in Forested Regions
- Download and mosaic OPERA RTC sample burst data for a given Sentinel-1 scene using the notebook
OPERA_RTC_download_reproject_mosaic_sample_bursts.ipynbor the Python scriptpapermill_OPERA_RTC_download_reproject_mosaic_sample_bursts.py(see above instructions)
- Prepare the data for the analysis notebook by running the following 3 data prep notebooks
flattening/data_prep/prep_flattening_part_1.ipynb
- Downloads Copernicus Global Land Cover (100m) tiles, projects them to OPERA RTC's UTM, mosaics them, and subsets mosaic to OPERA RTC extents
flattening/data_prep/prep_flattening_part_2.ipynb
- Creates geotiffs for each polarization and slope. All non-forested pixels are masked and sets of tiffs are produced for each polarization containing only foreslope pixels, backslope pixels, or flat pixels.
flattening/data_prep/Prep_OPERA_RTC_CalVal_Slope_Compare_Part_3.ipynb
- Create MGRS tiles for each prepared geotiff
- Run analysis notebook
flattening/flattening_analysis/flattening_analysis.ipynb
Run flattening/papermill_flattening.py to run all four notebooks on multiple RTCs
- Update
data_dirs, adding paths to directories holding RTCs - Update
logto set log or power scale - Update
saveto save output plots as PNGs, or not
- Save changes to script
- Run script in
opera_calval_rtcconda environment- Open a terminal and run the following commands
conda activate opera_calval_rtcPython path/to/flattening/papermill_flattening.py