odc.geo.xr.ODCExtensionDa.colorize
- ODCExtensionDa.colorize(cmap=None, attrs=None, *, clip: bool = False, vmin: float | None = None, vmax: float | None = None, robust: bool | None = None) DataArray
Apply colormap to data.
There are two modes of operation:
Map categorical values from
x
to RGBA according tocmap
lookup table.Interpolate into RGBA using matplotlib colormaps (needs matplotlib installed)
Note
When using matplotlib colormaps with Dask inputs one must configure vmin/vmax to ensure all chunks are colorized consistently.
- Parameters:
x (
Any
) – Input xarray data array (can be Dask)cmap – Lookup table
cmap[x] -> RGB(A)
or matplotlib colormaprobust (
Optional
[bool
]) – Use percentiles for clampingvmin=2%, vmax=98%
attrs – xarray attributes table, if not supplied input attributes are copied across
clip (
bool
) – IfTrue
clip values fromx
to be in the safe range forcmap
.
- Return type: