preprocessing.select_bands
preprocessing.select_bands(
cube_path,
output_path,
band_names,
*,
normalize=True,
dtype='uint8',
nodata=None,
percentile=(1.0, 99.0),
fill_value=0.0,
)Subset bands from a fused cube and write a clean GeoTIFF.
Args: cube_path: Fused cube GeoTIFF (as produced by :func:fuse_response_tiffs). Band descriptions are read from the file’s descriptions metadata; this is how we look up bands by their mission-prefixed name. output_path: Where to write the subset GeoTIFF. band_names: Ordered list of band descriptions to keep, e.g. ["Sentinel-2_B03", "Sentinel-2_B04", "Sentinel-2_B08"]. Use :data:BAND_PRESETS for the named task-meaningful presets. normalize: If True, apply each band’s documented band_meta normalisation recipe (via :func:apply_band_norm). Falls back to per-band percentile stretching when no recipe is registered. If False, copy raw values into the destination dtype (which may overflow / clip). dtype: Output dtype. "uint8" rescales the normalised values to [0, 255]; "float32" leaves them in [0, 1]. nodata: Output nodata value. None (the default) writes the file with no nodata metadata – the safest setting for downstream tools that cast nodata into the output dtype. percentile: (lo, hi) percentiles for the per-band stretch fallback. Only used when a band has no registered normalisation recipe. fill_value: Replacement value for NaN pixels in the output, in the destination units (e.g. 0 for uint8, 0.0 for float32).
Returns: Path to the written GeoTIFF.
Raises: ValueError: If the cube has no band descriptions, or if any requested band is missing from the cube.