I'm trying to interactively view (52608x11999) gridded data as an image. I would like to zoom into a given feature and have datashader + holoviews re-render an appropriate amount of points. I'm looking at this tutorial: https://datashader.org/getting_started/Interactivity.html
Below is some code with dummy data that I can't get to work:
import numpy as np
import pandas as pd
import xarray as xr
import holoviews as hv
import holoviews.operation.datashader as hd
import hvplot.xarray # noqa
dates_ns = np.linspace(pd.Timestamp('2017-01-01').value, pd.Timestamp('2017-12-31').value, 365)
dates = pd.to_datetime(dates_ns)
t = np.linspace(-10,10,500)
data = np.random.rand(365,500)
data_xr = xr.DataArray(data, dims=['dates','time'], coords={'dates':dates, 'time':t})
img = hv.Image(data_xr)
hd.datashade(img)
I get the following error:
WARNING:param.dynamic_operation: Callable raised "AttributeError("'DataArray' object has no attribute '_file_obj'")".
Invoked as dynamic_operation(height=400, scale=1.0, width=400, x_range=None, y_range=None)
AttributeError: 'DataArray' object has no attribute '_file_obj'
Thanks!
This is a question that should easily be answered by Googling the error message plus "Datashader", leading you to https://github.com/holoviz/datashader/issues/990, but in any case the answer is that you need Datashader 0.12.1 or later if you want to use xarray 0.17 or later.