easysnowdata.processing.scale_offset#

easysnowdata.processing.scale_offset(obj: Dataset | DataArray, scale: float | Mapping[str, float] | None = None, offset: float | Mapping[str, float] | None = None, *, nodata_to_nan: bool = True) Dataset | DataArray[source]#

Apply value * scale + offset and return float data.

scale / offset may be scalars, per-variable mappings, or None to read scale/scale_factor and offset/add_offset from each variable’s attrs (odc-stac deliberately ignores raster:bands scale and offset, so this is where they get applied). A variable’s nodata attr (or rio.nodata) is masked to NaN first when nodata_to_nan. The scale and offset attrs are removed from the result so it cannot be applied twice.