holoviz / datashader

Quickly and accurately render even the largest data.
http://datashader.org
BSD 3-Clause "New" or "Revised" License
3.24k stars 363 forks source link

"Coordinate is not backed by a Dask array" Errror when lazy loading xarray dataarray #1315

Open rsignell opened 5 months ago

rsignell commented 5 months ago

Screenshots or screencasts of the bug in action

datashader_issue

ALL software version info

09:24 $ conda list | grep -E "bokeh|datashader|holoviews|geoviews|hvplot|panel|dask|fsspec|intake|s3fs" 
bokeh                     3.3.4                    pypi_0    pypi
bokeh-root-cmd            0.1.2                    pypi_0    pypi
dask                      2023.8.1                 pypi_0    pypi
dask-core                 2023.8.1           pyhd8ed1ab_0    conda-forge
dask-gateway              2023.9.0                 pypi_0    pypi
dask-geopandas            0.3.1                    pypi_0    pypi
dask-image                2023.3.0                 pypi_0    pypi
datashader                0.16.0                   pypi_0    pypi
fsspec                    2023.12.2+32.g0c909ee          pypi_0    pypi
geoviews                  1.11.0                   pypi_0    pypi
geoviews-core             1.11.0             pyha770c72_0    conda-forge
holoviews                 1.18.1                   pypi_0    pypi
hvplot                    0.9.2                    pypi_0    pypi
intake                    0.7.0                    pypi_0    pypi
intake-esm                2023.6.14                pypi_0    pypi
intake-geopandas          0.4.0                    pypi_0    pypi
intake-parquet            0.3.0                    pypi_0    pypi
intake-stac               0.4.0                    pypi_0    pypi
intake-xarray             0.7.0                    pypi_0    pypi
jupyter-bokeh             3.0.7                    pypi_0    pypi
jupyter-panel-proxy       0.1.0                    pypi_0    pypi
jupyter_bokeh             3.0.7              pyhd8ed1ab_0    conda-forge
panel                     1.3.8                    pypi_0    pypi
s3fs                      2023.12.2                pypi_0    pypi

Description of expected behavior and the observed behavior

When I try to use hvplot with rasterize=True on this xarray dataarray it fails with:

WARNING:param.dynamic_operation: Callable raised "ValueError('DataArray Hwave is backed by a Dask array, \nbut coordinate lon_rho is not backed by a Dask array with identical \ndimension order and chunks')".
...
ValueError: DataArray Hwave is backed by a Dask array, 
but coordinate lon_rho is not backed by a Dask array with identical 
dimension order and chunks

Complete, minimal, self-contained example code that reproduces the issue

This is completely reproducible (loads data via S3 with no AWS credentials required):

import xarray as xr
import hvplot.xarray
import intake
import fsspec

intake_catalog_url = 'https://usgs-coawst.s3.amazonaws.com/useast-archive/coawst_intake.yml'
ds = intake.open_catalog(intake_catalog_url)['COAWST-USEAST'].to_dask()
da = ds['Hwave']
print(da)
# THIS DOESN'T work: use lazy loading with datashader 
da2d = da.sel(ocean_time='2012-10-29 12:00', method='nearest')
da2d.hvplot.quadmesh(x='lon_rho', y='lat_rho', rasterize=True)

it's worth noting that we don't get errors if we either: (1) load the data into memory first, (2) turn off datashader or (3) mod the coordinates to appease datashader. In other words, these all work:

da2d = da.sel(ocean_time='2012-10-29 12:00', method='nearest').load()
da2d.hvplot.quadmesh(x='lon_rho', y='lat_rho', rasterize=True)
da2d = da.sel(ocean_time='2012-10-29 12:00', method='nearest')
da2d.hvplot.quadmesh(x='lon_rho', y='lat_rho')
da2d = da.sel(ocean_time='2012-10-29 12:00', method='nearest')
da2d['lon_rho'] = da2d['lon_rho'].chunk()
da2d['lat_rho'] = da2d['lat_rho'].chunk()
da2d.unify_chunks().hvplot.quadmesh(x='lon_rho', y='lat_rho', rasterize=True)

Stack traceback and/or browser JavaScript console output

WARNING:param.dynamic_operation: Callable raised "ValueError('DataArray Hwave is backed by a Dask array, \nbut coordinate lon_rho is not backed by a Dask array with identical \ndimension order and chunks')".
Invoked as dynamic_operation(height=300, scale=1.0, width=700, x_range=None, y_range=None)
WARNING:param.dynamic_operation: Callable raised "ValueError('DataArray Hwave is backed by a Dask array, \nbut coordinate lon_rho is not backed by a Dask array with identical \ndimension order and chunks')".
Invoked as dynamic_operation(height=300, scale=1.0, width=700, x_range=None, y_range=None)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/IPython/core/formatters.py:974, in MimeBundleFormatter.__call__(self, obj, include, exclude)
    971     method = get_real_method(obj, self.print_method)
    973     if method is not None:
--> 974         return method(include=include, exclude=exclude)
    975     return None
    976 else:

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/holoviews/core/dimension.py:1286, in Dimensioned._repr_mimebundle_(self, include, exclude)
   1279 def _repr_mimebundle_(self, include=None, exclude=None):
   1280     """
   1281     Resolves the class hierarchy for the class rendering the
   1282     object using any display hooks registered on Store.display
   1283     hooks.  The output of all registered display_hooks is then
   1284     combined and returned.
   1285     """
-> 1286     return Store.render(self)

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/holoviews/core/options.py:1428, in Store.render(cls, obj)
   1426 data, metadata = {}, {}
   1427 for hook in hooks:
-> 1428     ret = hook(obj)
   1429     if ret is None:
   1430         continue

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/holoviews/ipython/display_hooks.py:287, in pprint_display(obj)
    285 if not ip.display_formatter.formatters['text/plain'].pprint:
    286     return None
--> 287 return display(obj, raw_output=True)

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/holoviews/ipython/display_hooks.py:261, in display(obj, raw_output, **kwargs)
    259 elif isinstance(obj, (HoloMap, DynamicMap)):
    260     with option_state(obj):
--> 261         output = map_display(obj)
    262 elif isinstance(obj, Plot):
    263     output = render(obj)

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/holoviews/ipython/display_hooks.py:149, in display_hook.<locals>.wrapped(element)
    147 try:
    148     max_frames = OutputSettings.options['max_frames']
--> 149     mimebundle = fn(element, max_frames=max_frames)
    150     if mimebundle is None:
    151         return {}, {}

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/holoviews/ipython/display_hooks.py:209, in map_display(vmap, max_frames)
    206     max_frame_warning(max_frames)
    207     return None
--> 209 return render(vmap)

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/holoviews/ipython/display_hooks.py:76, in render(obj, **kwargs)
     73 if renderer.fig == 'pdf':
     74     renderer = renderer.instance(fig='png')
---> 76 return renderer.components(obj, **kwargs)

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/holoviews/plotting/renderer.py:396, in Renderer.components(self, obj, fmt, comm, **kwargs)
    393 embed = (not (dynamic or streams or self.widget_mode == 'live') or config.embed)
    395 if embed or config.comms == 'default':
--> 396     return self._render_panel(plot, embed, comm)
    397 return self._render_ipywidget(plot)

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/holoviews/plotting/renderer.py:403, in Renderer._render_panel(self, plot, embed, comm)
    401 doc = Document()
    402 with config.set(embed=embed):
--> 403     model = plot.layout._render_model(doc, comm)
    404 if embed:
    405     return render_model(model, comm)

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/panel/viewable.py:748, in Viewable._render_model(self, doc, comm)
    746 if comm is None:
    747     comm = state._comm_manager.get_server_comm()
--> 748 model = self.get_root(doc, comm)
    750 if self._design and self._design.theme.bokeh_theme:
    751     doc.theme = self._design.theme.bokeh_theme

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/panel/layout/base.py:311, in Panel.get_root(self, doc, comm, preprocess)
    307 def get_root(
    308     self, doc: Optional[Document] = None, comm: Optional[Comm] = None,
    309     preprocess: bool = True
    310 ) -> Model:
--> 311     root = super().get_root(doc, comm, preprocess)
    312     # ALERT: Find a better way to handle this
    313     if hasattr(root, 'styles') and 'overflow-x' in root.styles:

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/panel/viewable.py:666, in Renderable.get_root(self, doc, comm, preprocess)
    664 wrapper = self._design._wrapper(self)
    665 if wrapper is self:
--> 666     root = self._get_model(doc, comm=comm)
    667     if preprocess:
    668         self._preprocess(root)

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/panel/layout/base.py:177, in Panel._get_model(self, doc, root, parent, comm)
    175 root = root or model
    176 self._models[root.ref['id']] = (model, parent)
--> 177 objects, _ = self._get_objects(model, [], doc, root, comm)
    178 props = self._get_properties(doc)
    179 props[self._property_mapping['objects']] = objects

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/panel/layout/base.py:159, in Panel._get_objects(self, model, old_objects, doc, root, comm)
    157 else:
    158     try:
--> 159         child = pane._get_model(doc, root, model, comm)
    160     except RerenderError as e:
    161         if e.layout is not None and e.layout is not self:

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/panel/pane/holoviews.py:423, in HoloViews._get_model(self, doc, root, parent, comm)
    421     plot = self.object
    422 else:
--> 423     plot = self._render(doc, comm, root)
    425 plot.pane = self
    426 backend = plot.renderer.backend

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/panel/pane/holoviews.py:518, in HoloViews._render(self, doc, comm, root)
    515     if comm:
    516         kwargs['comm'] = comm
--> 518 return renderer.get_plot(self.object, **kwargs)

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/holoviews/plotting/bokeh/renderer.py:68, in BokehRenderer.get_plot(self_or_cls, obj, doc, renderer, **kwargs)
     61 @bothmethod
     62 def get_plot(self_or_cls, obj, doc=None, renderer=None, **kwargs):
     63     """
     64     Given a HoloViews Viewable return a corresponding plot instance.
     65     Allows supplying a document attach the plot to, useful when
     66     combining the bokeh model with another plot.
     67     """
---> 68     plot = super().get_plot(obj, doc, renderer, **kwargs)
     69     if plot.document is None:
     70         plot.document = Document() if self_or_cls.notebook_context else curdoc()

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/holoviews/plotting/renderer.py:217, in Renderer.get_plot(self_or_cls, obj, doc, renderer, comm, **kwargs)
    214     raise SkipRendering(msg.format(dims=dims))
    216 # Initialize DynamicMaps with first data item
--> 217 initialize_dynamic(obj)
    219 if not renderer:
    220     renderer = self_or_cls

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/holoviews/plotting/util.py:270, in initialize_dynamic(obj)
    268     continue
    269 if not len(dmap):
--> 270     dmap[dmap._initial_key()]

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/holoviews/core/spaces.py:1216, in DynamicMap.__getitem__(self, key)
   1214 # Not a cross product and nothing cached so compute element.
   1215 if cache is not None: return cache
-> 1216 val = self._execute_callback(*tuple_key)
   1217 if data_slice:
   1218     val = self._dataslice(val, data_slice)

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/holoviews/core/spaces.py:983, in DynamicMap._execute_callback(self, *args)
    980     kwargs['_memoization_hash_'] = hash_items
    982 with dynamicmap_memoization(self.callback, self.streams):
--> 983     retval = self.callback(*args, **kwargs)
    984 return self._style(retval)

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/holoviews/core/spaces.py:581, in Callable.__call__(self, *args, **kwargs)
    578     args, kwargs = (), dict(pos_kwargs, **kwargs)
    580 try:
--> 581     ret = self.callable(*args, **kwargs)
    582 except KeyError:
    583     # KeyError is caught separately because it is used to signal
    584     # invalid keys on DynamicMap and should not warn
    585     raise

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/holoviews/util/__init__.py:1033, in Dynamic._dynamic_operation.<locals>.dynamic_operation(*key, **kwargs)
   1032 def dynamic_operation(*key, **kwargs):
-> 1033     key, obj = resolve(key, kwargs)
   1034     return apply(obj, *key, **kwargs)

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/holoviews/util/__init__.py:1022, in Dynamic._dynamic_operation.<locals>.resolve(key, kwargs)
   1020 elif isinstance(map_obj, DynamicMap) and map_obj._posarg_keys and not key:
   1021     key = tuple(kwargs[k] for k in map_obj._posarg_keys)
-> 1022 return key, map_obj[key]

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/holoviews/core/spaces.py:1216, in DynamicMap.__getitem__(self, key)
   1214 # Not a cross product and nothing cached so compute element.
   1215 if cache is not None: return cache
-> 1216 val = self._execute_callback(*tuple_key)
   1217 if data_slice:
   1218     val = self._dataslice(val, data_slice)

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/holoviews/core/spaces.py:983, in DynamicMap._execute_callback(self, *args)
    980     kwargs['_memoization_hash_'] = hash_items
    982 with dynamicmap_memoization(self.callback, self.streams):
--> 983     retval = self.callback(*args, **kwargs)
    984 return self._style(retval)

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/holoviews/core/spaces.py:581, in Callable.__call__(self, *args, **kwargs)
    578     args, kwargs = (), dict(pos_kwargs, **kwargs)
    580 try:
--> 581     ret = self.callable(*args, **kwargs)
    582 except KeyError:
    583     # KeyError is caught separately because it is used to signal
    584     # invalid keys on DynamicMap and should not warn
    585     raise

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/holoviews/util/__init__.py:1034, in Dynamic._dynamic_operation.<locals>.dynamic_operation(*key, **kwargs)
   1032 def dynamic_operation(*key, **kwargs):
   1033     key, obj = resolve(key, kwargs)
-> 1034     return apply(obj, *key, **kwargs)

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/holoviews/util/__init__.py:1026, in Dynamic._dynamic_operation.<locals>.apply(element, *key, **kwargs)
   1024 def apply(element, *key, **kwargs):
   1025     kwargs = dict(util.resolve_dependent_kwargs(self.p.kwargs), **kwargs)
-> 1026     processed = self._process(element, key, kwargs)
   1027     if (self.p.link_dataset and isinstance(element, Dataset) and
   1028         isinstance(processed, Dataset) and processed._dataset is None):
   1029         processed._dataset = element.dataset

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/holoviews/util/__init__.py:1008, in Dynamic._process(self, element, key, kwargs)
   1006 elif isinstance(self.p.operation, Operation):
   1007     kwargs = {k: v for k, v in kwargs.items() if k in self.p.operation.param}
-> 1008     return self.p.operation.process_element(element, key, **kwargs)
   1009 else:
   1010     return self.p.operation(element, **kwargs)

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/holoviews/core/operation.py:194, in Operation.process_element(self, element, key, **params)
    191 else:
    192     self.p = param.ParamOverrides(self, params,
    193                                   allow_extra_keywords=self._allow_extra_keywords)
--> 194 return self._apply(element, key)

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/holoviews/core/operation.py:141, in Operation._apply(self, element, key)
    139     if not in_method:
    140         element._in_method = True
--> 141 ret = self._process(element, key)
    142 if hasattr(element, '_in_method') and not in_method:
    143     element._in_method = in_method

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/holoviews/operation/datashader.py:1504, in rasterize._process(self, element, key)
   1501     op = transform.instance(**{k:v for k,v in extended_kws.items()
   1502                                if k in transform.param})
   1503     op._precomputed = self._precomputed
-> 1504     element = element.map(op, predicate)
   1505     self._precomputed = op._precomputed
   1507 unused_params = list(all_supplied_kws - all_allowed_kws)

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/holoviews/core/data/__init__.py:196, in PipelineMeta.pipelined.<locals>.pipelined_fn(*args, **kwargs)
    193     inst._in_method = True
    195 try:
--> 196     result = method_fn(*args, **kwargs)
    197     if PipelineMeta.disable:
    198         return result

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/holoviews/core/data/__init__.py:1213, in Dataset.map(self, *args, **kwargs)
   1211 @wraps(LabelledData.map)
   1212 def map(self, *args, **kwargs):
-> 1213     return super().map(*args, **kwargs)

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/holoviews/core/dimension.py:697, in LabelledData.map(self, map_fn, specs, clone)
    695     return deep_mapped
    696 else:
--> 697     return map_fn(self) if applies else self

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/holoviews/core/operation.py:214, in Operation.__call__(self, element, **kwargs)
    210         return element.clone([(k, self._apply(el, key=k))
    211                               for k, el in element.items()])
    212     elif ((self._per_element and isinstance(element, Element)) or
    213           (not self._per_element and isinstance(element, ViewableElement))):
--> 214         return self._apply(element)
    215 elif 'streams' not in kwargs:
    216     kwargs['streams'] = self.p.streams

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/holoviews/core/operation.py:141, in Operation._apply(self, element, key)
    139     if not in_method:
    140         element._in_method = True
--> 141 ret = self._process(element, key)
    142 if hasattr(element, '_in_method') and not in_method:
    143     element._in_method = in_method

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/holoviews/operation/datashader.py:1121, in quadmesh_rasterize._process(self, element, key)
   1117 cvs = ds.Canvas(plot_width=width, plot_height=height,
   1118                 x_range=x_range, y_range=y_range)
   1120 vdim = getattr(agg_fn, 'column', element.vdims[0].name)
-> 1121 agg = cvs.quadmesh(data[vdim], x.name, y.name, agg_fn)
   1122 xdim, ydim = list(agg.dims)[:2][::-1]
   1123 if xtype == "datetime":

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/datashader/core.py:879, in Canvas.quadmesh(self, source, x, y, agg)
    877         elif xarr.ndim == 2:
    878             glyph = QuadMeshCurvilinear(x, y, name)
--> 879             return bypixel(source, self, glyph, agg)
    880         else:
    881             raise ValueError("""\
    882 x- and y-coordinate arrays must have 1 or 2 dimensions.
    883     Received arrays with dimensions: {dims}""".format(
    884                 dims=list(xarr.dims)))

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/datashader/core.py:1335, in bypixel(source, canvas, glyph, agg, antialias)
   1333 with warnings.catch_warnings():
   1334     warnings.filterwarnings('ignore', r'All-NaN (slice|axis) encountered')
-> 1335     return bypixel.pipeline(source, schema, canvas, glyph, agg, antialias=antialias)

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/datashader/utils.py:114, in Dispatcher.__call__(self, head, *rest, **kwargs)
    112 typ = type(head)
    113 if typ in lk:
--> 114     return lk[typ](head, *rest, **kwargs)
    115 for cls in getmro(typ)[1:]:
    116     if cls in lk:

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/datashader/data_libraries/xarray.py:32, in xarray_pipeline(xr_ds, schema, canvas, glyph, summary, antialias)
     30 else:
     31     from datashader.data_libraries.dask_xarray import dask_xarray_pipeline
---> 32     return dask_xarray_pipeline(
     33         glyph, xr_ds, schema, canvas, summary, antialias=antialias, cuda=cuda)

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/datashader/data_libraries/dask_xarray.py:17, in dask_xarray_pipeline(glyph, xr_ds, schema, canvas, summary, antialias, cuda)
     16 def dask_xarray_pipeline(glyph, xr_ds, schema, canvas, summary, *, antialias=False, cuda=False):
---> 17     dsk, name = dask_glyph_dispatch(
     18         glyph, xr_ds, schema, canvas, summary, antialias=antialias, cuda=cuda)
     20     # Get user configured scheduler (if any), or fall back to default
     21     # scheduler for dask DataFrame
     22     scheduler = dask.base.get_scheduler() or xr_ds.__dask_scheduler__

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/datashader/utils.py:114, in Dispatcher.__call__(self, head, *rest, **kwargs)
    112 typ = type(head)
    113 if typ in lk:
--> 114     return lk[typ](head, *rest, **kwargs)
    115 for cls in getmro(typ)[1:]:
    116     if cls in lk:

File /home/conda/global/c38ce6b3dd031e242f379cd2db6eeed4b319d52166140421c3853ba62d37ab15-20240202-114729-108416-82-pangeo2/lib/python3.11/site-packages/datashader/data_libraries/dask_xarray.py:271, in dask_curvilinear(glyph, xr_ds, schema, canvas, summary, antialias, cuda)
    263 err_msg = (
    264     "DataArray {name} is backed by a Dask array, \n"
    265     "but coordinate {coord} is not backed by a Dask array with identical \n"
    266     "dimension order and chunks"
    267 )
    268 if (not isinstance(x_centers, dask.array.Array) or
    269         xr_ds[glyph.name].dims != xr_ds[glyph.x].dims or
    270         xr_ds[glyph.name].chunks != xr_ds[glyph.x].chunks):
--> 271     raise ValueError(err_msg.format(name=glyph.name, coord=glyph.x))
    273 if (not isinstance(y_centers, dask.array.Array) or
    274         xr_ds[glyph.name].dims != xr_ds[glyph.y].dims or
    275         xr_ds[glyph.name].chunks != xr_ds[glyph.y].chunks):
    276     raise ValueError(err_msg.format(name=glyph.name, coord=glyph.y))

ValueError: DataArray Hwave is backed by a Dask array, 
but coordinate lon_rho is not backed by a Dask array with identical 
dimension order and chunks
hoxbro commented 4 months ago

I don't get the error, when running the code, though it takes 30 seconds to run.

https://github.com/holoviz/datashader/assets/19758978/dfc667d2-dc92-40b6-8dc7-3c743f667f8b

❯ conda list | grep -E "bokeh|datashader|holoviews|geoviews|hvplot|panel|dask|fsspec|intake|s3fs"
bokeh                     3.3.4              pyhd8ed1ab_0    conda-forge
dask                      2024.1.1           pyhd8ed1ab_0    conda-forge
dask-core                 2024.1.1           pyhd8ed1ab_0    conda-forge
datashader                0.16.1a1.post13+g03adc9a           dev_0    <develop>
fsspec                    2024.2.0           pyhca7485f_0    conda-forge
geoviews                  1.11.1a1.post2+ge990682.dirty           dev_0    <develop>
holoviews                 1.18.2a2.post40+g42a87f6e4.dirty           dev_0    <develop>
hvplot                    0.9.2.post4+g3815910           dev_0    <develop>
intake                    0.7.0              pyhd8ed1ab_0    conda-forge
intake-parquet            0.3.0              pyhd8ed1ab_0    conda-forge
intake-sql                0.4.0              pyhd8ed1ab_0    conda-forge
intake-xarray             0.7.0              pyhd8ed1ab_0    conda-forge
ipywidgets_bokeh          1.5.0                      py_0    bokeh
jupyter_bokeh             3.0.7              pyhd8ed1ab_0    conda-forge
panel                     1.4.0a1.post46+gb663e8e6.dirty           dev_0    <develop>
s3fs                      2024.2.0           pyhd8ed1ab_0    conda-forge