odc.geo.xr.colorize
- odc.geo.xr.colorize(x, cmap=None, attrs=None, *, clip=False, vmin=None, vmax=None, robust=None)[source]
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: