to_band

Contents

to_band#

to_band(to_convert: list[str | SpectralBandNames | SarBandNames | CloudsBandNames | DemBandNames | BandNames] | str | SpectralBandNames | SarBandNames | CloudsBandNames | DemBandNames | BandNames, as_list: bool = True) list | BandNames[source]#

Convert a string (or real value) to any alias, band or index.

You can pass the name or the value of the bands.

Parameters:
  • to_convert (Union[list, BandNames, str]) – Values to convert into band objects

  • as_list (bool) – Return the result as a list

Returns:

Bands as BandNames

Return type:

list

Examples

>>> from eoreader.bands import RED, DEM, CLOUDS
>>>
>>> to_band(["NDVI", "GREEN", RED, "VH_DSPK", "SLOPE", DEM, "CLOUDS", CLOUDS])
[<function NDVI at 0x00000154DDB12488>,
<SpectralBandNames.GREEN: 'GREEN'>,
<SpectralBandNames.RED: 'RED'>,
<SarBandNames.VH_DSPK: 'VH_DSPK'>,
<DemBandNames.SLOPE: 'SLOPE'>,
<DemBandNames.DEM: 'DEM'>,
<ClassifBandNames.CLOUDS: 'CLOUDS'>,
<ClassifBandNames.CLOUDS: 'CLOUDS'>]