Overview
Thedvnl_io module provides utilities for reading Defense Meteorological Satellite Program (DMSP) Visible Near-infrared (DVNL) GeoTIFF files with proper NoData handling.
read_raster_metadata
Reads basic metadata from a raster file without loading the full array.Parameters
Path to the GeoTIFF file
Returns
Dictionary containing raster metadata including:
width: Raster width in pixelsheight: Raster height in pixelscrs: Coordinate reference systemtransform: Affine transformation matrixdtype: Data type of the rasternodata: NoData value
Example
read_raster_window_filtered
Reads a specific window from a raster with NoData filtering.Parameters
Path to the GeoTIFF file
Window object specifying the region to read (row offset, column offset, height, width)
Returns
Float32 array with NoData values replaced by
np.nanNoData Handling
This function handles NoData in two ways:- Metadata NoData: If the raster has a NoData value in its metadata, those pixels are converted to
np.nan - Outlier Detection: Values exceeding
1e10are also converted tonp.nan(DVNL data sometimes has extreme values without proper metadata)
Example
Use Cases
- Memory-efficient processing: Read only the region of interest
- Tiled processing: Process large rasters in smaller chunks
- Convolution operations: Read with halo overlap for kernel operations
See Also
- DVNL Preprocessing - CLI tools for DVNL data processing
- Kernels - Convolution kernels for light dispersion