mapshader.core.raster_aggregation#

mapshader.core.raster_aggregation(cvs, data, interpolate='linear', padding=0, agg_method=<datashader.reductions.max object>)[source]#

Sample a raster dataset by canvas size and bounds.

Parameters:
  • cvs (datashader.Canvas) – The input canvas.

  • data (xarray.DataArray, xr.Dataset or dask.Array) – The input datasource.

  • interpolate (str, default=linear) – Resampling mode when upsampling raster. Options include: nearest, linear.

  • padding (int, default=0) – The padding to be added over the coordinates bounds range.

  • agg_method (Reduction, default=datashader.reductions.max()) – Resampling mode when downsampling raster. The supported options include: first, last, mean, mode, var, std, min, The agg can be specified as either a string name or as a reduction function, but note that the function object will be used only to extract the agg type (mean, max, etc.) and the optional column name; the hardcoded raster code supports only a fixed set of reductions and ignores the actual code of the provided agg.

Returns:

agg – The transformed datasource.

Return type:

xarray.DataArray