-
-
Notifications
You must be signed in to change notification settings - Fork 378
Open
Description
Is your feature request related to a problem? Please describe.
I would like to resample RGB data (shape H, W, 3) on a quadmesh grid, using datashader. This works with Canvas.raster but not Canvas.quadmesh.
Describe the solution you'd like
Canvas.quadmesh accepts 3D data, like Canvas.raster.
Reproducer
import datashader as dsh
import numpy as np
import xarray as xr
data = np.random.random((1000, 1000, 3))
da = xr.DataArray(
data,
coords={"x": np.linspace(-1, 1, 1000), "y": np.linspace(-1, 1, 1000), "band": [0, 1, 2]},
dims=("y", "x", "band"),
)
cvs = dsh.Canvas(
plot_height=512,
plot_width=512,
x_range=(-1, 1),
y_range=(-1, 1),
)
data = np.random.random((1000, 1000, 3))
da = xr.DataArray(
data,
coords={"x": np.linspace(-1, 1, 1000), "y": np.linspace(-1, 1, 1000), "band": [0, 1, 2]},
dims=("y", "x", "band"),
name="foo"
)
# works
cvs.raster(da.transpose(..., "y", "x"))
# fails
cvs.quadmesh(da.transpose(..., "y", "x"), x='x', y='y')
# -> ValueError: ('y', 'x') must be a permuted list of FrozenMappingWarningOnValuesAccess({'x': 1000, 'y': 1000, 'band': 3}), unless `...` is includedMetadata
Metadata
Assignees
Labels
No labels