Sentinel-2 Surface Reflectance & ERA5 Air Temperature
This repository contains a remote sensing processing workflow developed as part of a technical assignment for OpenHydro.
The objective is to:
- Extract satellite and reanalysis data for a water reservoir
- Apply basic processing steps
- Summarise assumptions, limitations, and operational relevance
Two datasets are used:
- Sentinel-2 optical imagery (surface reflectance)
- ERA5 reanalysis (2 m air temperature)
The study area is Shitou Koumen Reservoir (China), with analysis focused on October 2024.
- Collection:
sentinel-2-l2a - Provider: Microsoft Planetary Computer (STAC)
- Product: Level-2A Bottom-Of-Atmosphere (BOA) reflectance
- Spatial resolution: 10 m
- Units: Scaled integer reflectance (scale factor = 10,000)
Bands used:
- Band 4 (Red)
- Band 8 (Near-Infrared, used for cloud masking)
- Dataset: ERA5 single-level monthly means
- Provider: Copernicus Climate Data Store (CDS)
- Variable: 2 m air temperature
- Spatial resolution: ~31 km
- Units: Kelvin (converted to °C during processing)
- Query Sentinel-2 Level-2A scenes via STAC
- Filter scenes by:
- Time range (October 2024)
- Scene cloud cover (< 60%)
- Spatial intersection with the reservoir AOI
- Clip imagery to the reservoir polygon
- Apply cloud masking using NIR reflectance thresholding
- Compute:
- Per-image mean reflectance
- Monthly pixel-wise mean reflectance
- Export raster and tabular outputs
- Download ERA5 monthly mean 2 m air temperature
- Fix longitude convention (0–360 → −180–180)
- Assign geographic CRS (EPSG:4326)
- Extract reservoir values using:
- Polygon clipping (default)
- Centroid sampling (optional)
- Compute reservoir-level statistics
- Export clipped raster and CSV summary
- Sentinel-2 cloud masking uses NIR reflectance rather than SCL classes to better target clouds over water
- Radiometric scaling (division by 10,000) is applied at the statistics stage to reduce memory usage
- ERA5 extraction uses buffering to ensure at least one grid cell overlaps the reservoir
- Monthly aggregation is used to reduce noise and simplify interpretation
- Monthly mean reflectance GeoTIFF
- Per-image statistics CSV
- Monthly statistics CSV
- Reservoir-clipped temperature GeoTIFF
- Monthly reservoir mean temperature CSV
This project uses Poetry for dependency management and reproducible environments.
If Poetry is not already installed:
curl -sSL https://install.python-poetry.org | python3 -
Ensure Poetry is available on your path:
poetry --version
Install dependancies
poetry install
Activate Poetry environment
poetry env activate
Then run the line that is printed in the terminal to activate the environment.
poetry install
ERA5 data is downloaded from the Copernicus Climate Data Store (CDS).
Before running ERA5 scripts, configure your CDS credentials:
Create an account at: https://cds.climate.copernicus.eu
Create a file at ~/.cdsapirc with the following contents:
url: https://cds.climate.copernicus.eu/api/v2 key: :
Run the notebook (notebooks/main_notebook.ipynb)