diff --git a/pctiler/pctiler/colormaps/__init__.py b/pctiler/pctiler/colormaps/__init__.py index edb91046..a53cc43f 100644 --- a/pctiler/pctiler/colormaps/__init__.py +++ b/pctiler/pctiler/colormaps/__init__.py @@ -8,6 +8,7 @@ from .alos_palsar_mosaic import alos_palsar_mosaic_colormaps from .chloris import chloris_colormaps +from .io_bii import io_bii_colormaps from .jrc import jrc_colormaps from .lidarusgs import lidar_colormaps from .lulc import lulc_colormaps @@ -25,6 +26,7 @@ ################################################################################ registered_cmaps = cmap custom_colormaps: Dict[str, ColorMapType] = { + **io_bii_colormaps, **jrc_colormaps, **lulc_colormaps, **modis_colormaps, diff --git a/pctiler/pctiler/colormaps/io_bii.py b/pctiler/pctiler/colormaps/io_bii.py new file mode 100644 index 00000000..d2dcc766 --- /dev/null +++ b/pctiler/pctiler/colormaps/io_bii.py @@ -0,0 +1,32 @@ +from typing import Dict, cast + +import matplotlib +import numpy as np +from rio_tiler.types import ColorMapType, ColorTuple + + +def make_io_bii_colormap() -> ColorMapType: + io_bii = matplotlib.colors.LinearSegmentedColormap.from_list( + "io_bii", + [ + (0.0, "#72736c"), + (0.2, "#ccd3c5"), + (0.4, "#cceaa2"), + (0.6, "#69be72"), + (0.8, "#309d53"), + (1.0, "#006a37"), + ], + 256, + ) + ramp = np.linspace(0, 1, 256) + cmap_vals = io_bii(ramp)[:, :] + cmap_uint8 = (cmap_vals * 255).astype("uint8") + colormap = { + idx: cast(ColorTuple, tuple(value)) for idx, value in enumerate(cmap_uint8) + } + return colormap + + +io_bii_colormaps: Dict[str, ColorMapType] = { + "io-bii": make_io_bii_colormap(), +}