Overview
The SQM calibration tools establish empirical relationships between satellite-derived radiance data and ground-truth Sky Quality Meter measurements, then apply these models to generate sky brightness maps.terralab-calibrate-sqm
Fits an empirical model between aggregated DVNL radiance and ground-truth SQM measurements.Purpose
- Train a robust regression model from field observations
- Account for elevation effects on sky brightness
- Use Huber loss for robustness to outliers
- Evaluate model performance with MAE and RMSE metrics
- Save trained models for reuse
Usage
Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
csv | Path | Yes | CSV file with calibration data |
output | Path | Yes | Path to save trained .joblib model |
Input CSV Format
The input CSV must contain the following columns:| Column | Type | Units | Description |
|---|---|---|---|
lat | Float | Degrees | Latitude of measurement location |
lon | Float | Degrees | Longitude of measurement location |
agg_dvnl | Float | nW/cm²/sr | Aggregated DVNL radiance value |
elevation_m | Float | Meters | Elevation above sea level |
sqm | Float | mag/arcsec² | Measured sky brightness |
Example CSV
Examples
Basic calibration:Output
The command outputs:-
Calibration metrics:
- MAE (Mean Absolute Error) in mag/arcsec²
- RMSE (Root Mean Square Error) in mag/arcsec²
-
Saved model file:
- .joblib format for use with
terralab-predict-sqm
- .joblib format for use with
Model Details
- Algorithm: Huber regression (robust to outliers)
- Features: Aggregated DVNL radiance, elevation
- Target: SQM sky brightness (mag/arcsec²)
- Robustness: Automatically handles measurement noise
terralab-predict-sqm
Applies a calibrated model to a convolved DVNL raster to produce a zenith SQM map.Purpose
- Generate wall-to-wall sky brightness predictions
- Apply calibrated models across large geographic areas
- Optionally incorporate elevation data
- Produce publication-quality sky brightness maps
Usage
Arguments
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
input_agg | Path | Yes | - | Convolved aggregated DVNL raster (.tif) |
model | Path | Yes | - | Path to calibrated .joblib model |
output | Path | Yes | - | Output SQM raster (.tif) |
--elevation | Float | No | 0.0 | Default elevation (m) if no DEM provided |
Examples
Basic prediction at sea level:Output
The output raster contains:- Values: Predicted SQM in mag/arcsec² (higher = darker sky)
- Format: Float32 GeoTIFF
- NoData: NaN where input was masked
- Compression: LZW
- Georeference: Same as input raster
Interpreting Results
SQM Value Ranges:| SQM (mag/arcsec²) | Sky Quality | Description |
|---|---|---|
| < 18.0 | Poor | Urban/suburban sky |
| 18.0 - 20.0 | Moderate | Rural with light pollution |
| 20.0 - 21.5 | Good | Dark rural sky |
| 21.5 - 22.0 | Excellent | Pristine dark sky |
| > 22.0 | Exceptional | Remote natural darkness |
Workflow Integration
This tool is typically the final step in the workflow:Limitations
- Elevation: Currently uses a single default elevation value for the entire raster. For areas with significant topographic variation, consider processing in elevation bands or wait for DEM integration.
- Calibration region: Models work best when applied to regions similar to the calibration dataset.
- Atmospheric conditions: Assumes typical atmospheric transparency; not suitable for cloudy or hazy conditions.
Performance
- Processes in blocks for memory efficiency
- Typical speed: ~1-5 million pixels/second (hardware dependent)
- Large rasters (> 50,000×50,000) may take several minutes