Tools for validating OPERA RTC products.
If you are working locally:
- Make sure you have conda/mamba installed
- Create the
opera_calval_rtc
conda environment using one of theyaml
files in theenvironments
directory- In a terminal, run:
mamba env create -f path/to/calval-RTC/environment/jlab4_environment.yaml
- Use
calval-RTC/environment/jlab3_environment.yaml
if you'd like to use Jupyter Lab~=3.0 instead of Jupyter Lab~=4.0
- Use
- In a terminal, run:
- Activate your environment and start Jupyter Lab.
- In a terminal run:
cd path/to/calval-RTC
conda activate opera_calval_rtc
python -m ipykernel install --user --name opera_calval_rtc
jupyter lab
- In a terminal run:
If you are working in OpenSARLab:
- create the
opera_calval_rtc
conda environment usingenvironment/osl_environment.yaml
- Use the
~/conda_environments/Create_OSL_Conda_Environments.ipynb
notebook to create the environment
- Use the
- In a terminal, run:
cd path/to/calval-RTC
conda activate opera_calval_rtc
python -m ipykernel install --user --name opera_calval_rtc
jupyter lab
- Launch the
Bulk_Validation.ipynb
notebook. - 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 Kernel
option in theKernel
menu, 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_S1
for 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
scenes
list in the script to contain the desired scene IDs - Update
opera_dir
to the directory in which you would like to store your RTC directories - Update
keep_date_index
to 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_rtc
python path/to/papermill_OPERA_RTC_download_reproject_mosaic_sample_bursts.py
- Download and mosaic OPERA RTC sample burst data for a given Sentinel-1 scene using the notebook
OPERA_RTC_download_reproject_mosaic_sample_bursts.ipynb
or 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 absolute_geolocation_evaluation/ALE_OPERA-RTC.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 absolute_geolocation_evaluation/ALE_OPERA-RTC.ipynb
notebook on a list of paths to OPERA RTC mosaics using the calval-RTC/absolute_geolocation_evaluation/papermill_absolute_geolocation_evaluation.py
Python script
- Update the
data_dirs
list in the script with paths to directories containing OPERA RTC mosaics - In a terminal, run the following commands:
conda activate opera_calval_rtc
python path/to/absolute_geolocation_evaluation/papermill_absolute_geolocation_evaluation.py
- 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.ipynb
or 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 coregistration/coregistration.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 coregistration/papermill_coregistration.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_list
to save or delete intermediate data
- uncomment data products to delete
- Save changes to script
- Run script in
opera_calval_rtc
conda environment- Open a terminal and run the following commands
conda activate opera_calval_rtc
Python path/to/coregistration/papermill_coregistration.py
3) 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.ipynb
or 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
log
to set log or power scale - Update
save
to save output plots as PNGs, or not
- Save changes to script
- Run script in
opera_calval_rtc
conda environment- Open a terminal and run the following commands
conda activate opera_calval_rtc
Python path/to/flattening/papermill_flattening.py