Overview
Thelight_pollution_sampler module samples DVNL (Day/Night Visible Lights) raster data during horizon profile generation to estimate local sky brightness and Bortle class.
LightPollutionSampler
Samples aggregated DVNL radiance at geographic coordinates.Parameters
Path to the aggregated (convolved) DVNL GeoTIFF file
Methods
sample_at
Sample DVNL radiance at a specific location.Latitude in decimal degrees (WGS84)
Longitude in decimal degrees (WGS84)
None if outside coverage or NoData
estimate_sqm
Estimate Sky Quality Meter reading at a location.Latitude in decimal degrees
Longitude in decimal degrees
None if no data
Formula: Uses the empirical calibration model:
estimate_bortle
Estimate Bortle dark-sky class at a location.Latitude in decimal degrees
Longitude in decimal degrees
None if no data
Example
Integration with Horizon Engine
The sampler is used during horizon profile generation to:- Sample at observer location: Determine zenith sky brightness
- Sample along rays: Build directional light pollution maps
- Create light domes: Visualize light sources on the horizon
Usage in HorizonBaker
Thread Safety
The sampler usesRASTERIO_LOCK for thread-safe concurrent access to the GeoTIFF file.
Performance Considerations
- Coordinate transformation: Uses pyproj for accurate WGS84 → raster CRS conversion
- Bilinear interpolation: Sub-pixel sampling for smooth gradients
- Caching: Rasterio’s internal caching reduces repeated I/O
See Also
- Light Pollution Concepts - DVNL processing pipeline
- Bortle Scale - SQM to Bortle conversion
- DVNL I/O - Reading DVNL rasters