hypso.processing.bands#

Band subsets: keep some of a product’s bands and drop the rest (Product.select_bands).

From L1B on only: calibration needs every band (the smile correction resamples each spectrum across bands), so L1A is always complete. Each kept band keeps its index in the sensor’s full band set (the band_index coordinate, and each band variable’s band attribute in files), which is what TOA reflectance (F0) and metadata/srf (Band_<index>) look bands up by - so selecting bands and then processing gives the same values as processing all bands and selecting afterwards.

Functions#

select_bands(tree[, wavelength_range, wavelengths, ...])

A product tree with only some of its bands.

Module Contents#

hypso.processing.bands.select_bands(tree, wavelength_range=None, wavelengths=None, indices=None)[source]#

A product tree with only some of its bands.

Parameters:
  • tree (xarray.DataTree) – L1B, L1C or L2A product tree.

  • wavelength_range (tuple of float, optional) – (min, max) in nm: the bands whose centre lies within it.

  • wavelengths (array_like, optional) – Wavelengths in nm: the nearest band to each.

  • indices (array_like of int, optional) – Band indices in the sensor’s full band set (band_index).

Returns:

Same level, with the kept bands’ band_index, metadata/srf (and metadata/machi) trimmed to them, and a select_bands step.

Return type:

xarray.DataTree