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 to cmap lookup table.

  • Interpolate into RGBA using matplotlib colormaps (needs matplotlib installed)


When using matplotlib colormaps with Dask inputs one must configure vmin/vmax to ensure all chunks are colorized consistently.

  • x (Any) – Input xarray data array (can be Dask)

  • cmap – Lookup table cmap[x] -> RGB(A) or matplotlib colormap

  • vmin (Optional[float]) – Valid range to colorize

  • vmax (Optional[float]) – Valid range to colorize

  • robust (Optional[bool]) – Use percentiles for clamping vmin=2%, vmax=98%

  • attrs – xarray attributes table, if not supplied input attributes are copied across

  • clip (bool) – If True clip values from x to be in the safe range for cmap.

Return type: