This directory contains example notebooks demonstrating the usage of SpiPy for snow property inversion from satellite imagery.
01_define_regions.ipynb- Define regions of interest for processing
02_pansharpening.ipynb- Pansharpening to improve spatial resolution of Sentinel-2 bands03_create_background_reflectance.ipynb- Generate R0 (background/snow-free) reflectance maps from snow-free periods04_cloud_masking.ipynb- Cloud detection and masking for satellite imagery
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)
06_postprocess_clouds.ipynb- Interpolate cloud gaps and fix sharpening artifacts in results07_postprocess_trees.ipynb- Tree masking and inpainting using deep learning
08_create_animations.ipynb- Generate temporal animations of snow properties
These notebooks demonstrate specific functionality and can be used for testing:
test_interpolator.ipynb- Test LUT interpolation functionalitytest_inversion.ipynb- Test basic inversion on single pixels/imagestest_spectrum_diff.ipynb- Test spectral difference calculations
The following notebooks were used during development and are kept for reference:
legacy_speedy_invert.ipynb- Legacy MATLAB-style implementation comparisoncobyla.ipynb- COBYLA optimizer testinginvert2d.ipynb- 2D inversion experimentscompress_nc.ipynb- NetCDF compression utilities
UCSB_fsca.mp4- Example animation output showing fractional snow-covered area
Most notebooks require:
- SpiPy package installed
- 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-inpainting- Processing notebooks benefit from Dask for parallel computation
For new users, we recommend going through the notebooks in this order:
test_interpolator.ipynb- Understand the core LUT interpolationtest_inversion.ipynb- See basic inversion examples on single pixels05_sentinel_snow_inversion.ipynb- Full workflow with batch processing
For processing your own Sentinel-2 data:
01_define_regions.ipynb- Define your region of interest02_pansharpening.ipynb- Improve spatial resolution03_create_background_reflectance.ipynb- Generate R0 maps04_cloud_masking.ipynb- Apply cloud detection05_sentinel_snow_inversion.ipynb- Run SPIRES inversion06_postprocess_clouds.ipynb- Fill cloud gaps07_postprocess_trees.ipynb- (Optional) Remove tree artifacts08_create_animations.ipynb- Visualize temporal evolution
- Notebooks assume data is stored in
/scratch/tristate/or/data/sentinel2/directories - Most workflows are designed for UCSB region but can be adapted
- Large notebooks (>1MB) contain embedded outputs and visualizations