mapshader.core.shade_discrete#

mapshader.core.shade_discrete(agg, color_key, name='shaded', alpha=255, nodata=0)[source]#

Convert a DataArray to an image by choosing an RGBA pixel color for each value by discrete approach.

Parameters:
  • agg (xarray.DataArray) – The input datasource.

  • color_key (dict) – Categories colors.

  • name (str, default=shaded) – Name of the datasource array.

  • alpha (int, default=255) – Value between 0 - 255 representing the alpha value to use for colormapped pixels that contain data.

  • nodata (int, default=0) – The maximum data value, all the values less than this will be replaced with 0.

Returns:

img – A DataArray representing an image.

Return type:

xarray.DataArray