Add chloris-biomass rendering config (#27)
This commit is contained in:
Родитель
30c5f8c9a6
Коммит
6d53b657a1
|
@ -77,6 +77,15 @@ COLLECTION_RENDER_CONFIG = {
|
|||
mosaic_preview_coords=[37.2141, -104.2947],
|
||||
minzoom=9,
|
||||
),
|
||||
"chloris-biomass": DefaultRenderConfig(
|
||||
assets=["data"],
|
||||
render_params={"colormap_name": "chloris-biomass", "rescale": [1, 750000]},
|
||||
has_mosaic=False,
|
||||
mosaic_preview_zoom=2,
|
||||
mosaic_preview_coords=[30.0572, 80.1735],
|
||||
requires_token=True,
|
||||
minzoom=2,
|
||||
),
|
||||
"cop-dem-glo-30": DefaultRenderConfig(
|
||||
assets=["data"],
|
||||
render_params={"colormap_name": "terrain", "rescale": [-1000, 4000]},
|
||||
|
|
|
@ -6,6 +6,7 @@ from rio_tiler.colormap import cmap
|
|||
from rio_tiler.types import ColorMapType
|
||||
from titiler.core.dependencies import ColorMapParams
|
||||
|
||||
from .chloris import chloris_colormaps
|
||||
from .jrc import jrc_colormaps
|
||||
from .lulc import lulc_colormaps
|
||||
from .mtbs import mtbs_colormaps
|
||||
|
@ -20,6 +21,7 @@ custom_colormaps: Dict[str, ColorMapType] = {
|
|||
**jrc_colormaps,
|
||||
**lulc_colormaps,
|
||||
**mtbs_colormaps,
|
||||
**chloris_colormaps,
|
||||
}
|
||||
|
||||
for k, v in custom_colormaps.items():
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
from typing import Dict, cast
|
||||
|
||||
import matplotlib
|
||||
import numpy as np
|
||||
from rio_tiler.types import ColorMapType, ColorTuple
|
||||
|
||||
|
||||
def make_biomass_colormap() -> ColorMapType:
|
||||
biomass = matplotlib.colors.LinearSegmentedColormap.from_list(
|
||||
"chloris-biomass",
|
||||
[
|
||||
"#c6c875",
|
||||
"#77a865",
|
||||
"#3d8757",
|
||||
"#29583a",
|
||||
"#2e3926",
|
||||
"#050603",
|
||||
],
|
||||
256,
|
||||
)
|
||||
ramp = np.linspace(0, 1, 256)
|
||||
cmap_vals = biomass(ramp)[:, :]
|
||||
cmap_uint8 = (cmap_vals * 255).astype("uint8")
|
||||
colormap = {
|
||||
idx: cast(ColorTuple, tuple(value)) for idx, value in enumerate(cmap_uint8)
|
||||
}
|
||||
return colormap
|
||||
|
||||
|
||||
chloris_colormaps: Dict[str, ColorMapType] = {
|
||||
"chloris-biomass": make_biomass_colormap(),
|
||||
}
|
Загрузка…
Ссылка в новой задаче