colormap#
Module for computing colormaps from single band rasters.
- sen2chain.colormap.matplotlib_colormap_to_rgb(cmap: LinearSegmentedColormap, revers=False) Dict[int, Tuple[int, int, int]]#
Returns a matplotlib colormap as a dictionnary of RGB values. See: https://matplotlib.org/examples/color/colormaps_reference.html
- Parameters:
cmap – matplotlib colormap.
revers – if true, reverse the colormap.
- sen2chain.colormap.get_tsv_colormap(lut_path: str) Dict[int, Tuple[int, int, int]]#
Reads a tsv look-up table (values separated by tabs) and returns the content as a dictionnary : {i:(r, g, b), …}.
- Parameters:
lut_path – look-up table path.
- sen2chain.colormap.create_colormap(raster: str | PosixPath, lut_dict: Dict[int, Tuple[int, int, int]], cloud_mask: str | None = None, out_path: str | PosixPath = './colormap.tif', out_crs: str | None = None, clouds_color: str = 'black', out_resolution: Tuple[int, int] = (100, 100)) str#
Colormapping of a single-band raster with a look-up table passed as a dictionary {i:(r, g, b), …}. If a cloud mask is provided, clouds are colored in black
- Parameters:
raster – path to raster.
lut_dict – dictionary containing RGB values.
cloud_mask – path to the cloud mask.
out_path – path to the output.
out_crs – output CRS.
clouds_color – color of the clouds (black or white).
out_resolution – output resolution.
- sen2chain.colormap.create_rvb(raster: str | PosixPath, lut_dict: Dict[int, Tuple[int, int, int]], cloud_mask: str | None = None, out_path: str | PosixPath = './colormap_rvb.tif', out_crs: str | None = None, clouds_color: str = 'black', out_resolution: Tuple[int, int] = (100, 100), stretch: Tuple[float, float] = (-10000, 10000)) str#
Colormapping of a single-band raster with a look-up table passed as a dictionary {i:(r, g, b), …}. If a cloud mask is provided, clouds are colored in black
- Parameters:
raster – path to raster.
lut_dict – dictionary containing RGB values.
cloud_mask – path to the cloud mask.
out_path – path to the output.
out_crs – output CRS.
clouds_color – color of the clouds (black or white).
out_resolution – output resolution (pixel size (m)).
- sen2chain.colormap.create_l2a_ql(b02: str | PosixPath, b03: str | PosixPath, b04: str | PosixPath, out_path: str | PosixPath = './L2A_QL.tif', out_resolution: Tuple[int, int] = (100, 100), jpg=False) str#
Creating a color RVB quicklook from 3 single band files passed as arguments :param b02: path to B raster :param b03: path to G raster :param b04: path to R raster :param out_path: path to the output. :param out_resolution: output resolution, default 100mx100m .
- sen2chain.colormap.create_l1c_ql(tci: str | PosixPath, out_path: str | PosixPath = './L1C_QL.tif', out_resolution: Tuple[int, int] = (100, 100), jpg=False) str#
Creating a color RVB quicklook from tci 3 bands file passed as argument :param tci: path to tci raster :param out_path: path to the output. :param out_resolution: output resolution, default 100mx100m .
- sen2chain.colormap.create_l1c_ql_v2(tci: str | PosixPath, out_path: str | PosixPath = './L1C_QL.tif', out_resolution: Tuple[int, int] = (100, 100), jpg=False) str#
Creating a color RVB quicklook from tci 3 bands file passed as argument :param tci: path to tci raster :param out_path: path to the output. :param out_resolution: output resolution, default 100mx100m .
- sen2chain.colormap.create_l2a_ql_v2(tci: str | PosixPath, out_path: str | PosixPath = './L2A_QL.tif', out_resolution: Tuple[int, int] = (100, 100), jpg=False) str#
Creating a color RVB quicklook from tci 3 bands file passed as argument :param tci: path to tci raster :param out_path: path to the output. :param out_resolution: output resolution, default 100mx100m .