Examples and Tutorials#
This page links to example Jupyter notebooks demonstrating the usage of SpiPy for snow property inversion from satellite imagery.
Main Workflow Examples#
1. Setup#
01_define_regions.ipynb - Define regions of interest for processing
2. Data Preparation (Prerequisites for Inversion)#
02_pansharpening.ipynb - Pansharpening to improve spatial resolution of Sentinel-2 bands
03_create_background_reflectance.ipynb - Generate R0 (background/snow-free) reflectance maps from snow-free periods
04_cloud_masking.ipynb - Cloud detection and masking for satellite imagery
3. Core Processing Pipeline#
05_sentinel_snow_inversion.ipynb - Main workflow: Sentinel-2 snow property inversion using SPIRES
Loading preprocessed Sentinel-2 data
Applying SPIRES algorithm
Batch processing with Dask
Saving inversion results (fsca, grain size, dust concentration)
4. Postprocessing#
06_postprocess_clouds.ipynb - Interpolate cloud gaps and fix sharpening artifacts in results
07_postprocess_trees.ipynb - Tree masking and inpainting using deep learning
5. Analysis and Visualization#
08_create_animations.ipynb - Generate temporal animations of snow properties
Test Notebooks#
These notebooks demonstrate specific functionality and can be used for testing:
test_interpolator.ipynb - Test LUT interpolation functionality
test_inversion.ipynb - Test basic inversion on single pixels/images
test_spectrum_diff.ipynb - Test spectral difference calculations
Recommended Learning Path#
For New Users#
If you’re new to SpiPy, we recommend going through the notebooks in this order:
test_interpolator.ipynb - Understand the core LUT interpolation
test_inversion.ipynb - See basic inversion examples on single pixels
05_sentinel_snow_inversion.ipynb - Full workflow with batch processing
Complete Workflow#
For processing your own Sentinel-2 data, follow this sequence:
01_define_regions.ipynb - Define your region of interest
02_pansharpening.ipynb - Improve spatial resolution
03_create_background_reflectance.ipynb - Generate R0 maps
04_cloud_masking.ipynb - Apply cloud detection
05_sentinel_snow_inversion.ipynb - Run SPIRES inversion
06_postprocess_clouds.ipynb - Fill cloud gaps
07_postprocess_trees.ipynb - (Optional) Remove tree artifacts
08_create_animations.ipynb - Visualize temporal evolution
Requirements#
Most notebooks require:
SpiPy package installed (see Getting Started)
Access to Sentinel-2 data (zarr format)
Lookup tables (LUT) for snow reflectance
Sufficient memory for processing satellite imagery
Some notebooks have additional requirements:
postprocess_trees.ipynbrequires PyTorch and simple-lama-inpaintingProcessing notebooks benefit from Dask for parallel computation
Data Notes#
Notebooks were authored against developer-specific data paths; you’ll need to edit the input/output paths near the top of each notebook to point at your own data
Most workflows were developed for the UCSB region but can be adapted
Large notebooks (>1MB) contain embedded outputs and visualizations
Development Notebooks#
The examples/development/ directory contains notebooks used during development, kept for reference:
legacy_speedy_invert.ipynb- Legacy MATLAB-style implementation comparisoncobyla.ipynb- COBYLA optimizer testinginvert2d.ipynb- 2D inversion experimentscompress_nc.ipynb- NetCDF compression utilitiesspicy_snow_experiment.ipynb- Comparison experiment against the spicy-snow approach