to_str

Contents

to_str#

to_str(to_convert: list[str | SpectralBandNames | SarBandNames | CloudsBandNames | DemBandNames | BandNames] | str | SpectralBandNames | SarBandNames | CloudsBandNames | DemBandNames | BandNames, as_list: bool = True) list | str[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 str

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

Returns:

Bands as strings

Return type:

list

Examples

>>> from eoreader.bands import RED, DEM, CLOUDS
>>>
>>> to_str(["NDVI", "GREEN", RED, "VH_DSPK", "SLOPE", DEM, "CLOUDS", CLOUDS])
['NDVI', 'GREEN', 'RED', 'VH_DSPK', 'SLOPE', 'DEM', 'CLOUDS', 'CLOUDS']