Closed rabernat closed 4 years ago
Here another MWE without intake/google cloud storage.
import xarray as xr
import hvplot.xarray
ds = xr.tutorial.open_dataset('rasm', chunks={'x': 25, 'y': 25, 'time': -1})
ds = ds.assign_coords(x=ds.x, y=ds.y)
import holoviews as hv
hv.extension('bokeh')
I think the error above boils down to:
# fails:
ds.Tair.isel(time=0).hvplot.quadmesh('x', 'y', rasterize=True)
# works
ds.Tair.isel(time=0).hvplot.image('x', 'y', rasterize=True)
As a workaround, you could shade a Points element (also allows irregular spacing). I know it's not the same, but maybe it helps you in the short term?
# works:
import datashader as dsh
from holoviews.operation.datashader import datashade
ds.hvplot.points('x', 'y', c='Tair', rasterize=True, x_sampling=1, y_sampling=1, aggregator=dsh.mean('Tair'))
# equivalent:
l = hv.DynamicMap(
lambda t: hv.Points(ds.sel(time=t), ['x', 'y'], 'Tair'),
kdims=hv.Dimension('time', values=ds.time.values),
)
datashade(l, x_sampling=1, y_sampling=1, aggregator=dsh.mean('Tair'))
I believe this should be fixed in the next release but @jonmmease or @jbednar can correct me.
So I was wrong, it seems we don't yet have dask quadmesh rendering support in datashader, for now I'll have to insert a compute sadly.
Thanks for the update @philippjfr. My understanding was that quadmesh just underwent a big refactor to improve performance. Datashader quadmesh + dask is very important to the Pangeo project. @jbednar - I'm happy to see our NSF grant support such work.
Oh it turns out it was done by @jonmmease here, it was just never merged! We'll get that merged this weekend and hopefully get a release out by Monday.
I'm happy to see our NSF grant support such work.
Indeed, your NSF grant did support this work (datashader PR #855). :-) We just need to track down the last few issues and release it. Sorry for the confusion!
Didn't think to look in the PRs, since I assumed such a great change would have been merged asap but I did have a vague recollection of Jon working on it so I was surprised. Anyway, the to-do list for a datashader release is pretty short and I'll do my best to tick off items tonight and tomorrow.
@rabernat I'm trying to test this but am running into this error:
ValueError: Bad Request: https://www.googleapis.com/download/storage/v1/b/pangeo-cmems-duacs/o/.zmetadata?alt=media
b'User project specified in the request is invalid.'
The data are requester pays. So you'll need a google cloud account to pay the egress fees. @martindurant can probably advise. (xref https://github.com/pangeo-data/pangeo/issues/774)
Okay, I've tested with this example instead, which should be sufficient:
from intake import open_catalog
ds = xr.tutorial.load_dataset('rasm').Tair
ds.xc.values = da.from_array(ds.xc.values)
ds.yc.values = da.from_array(ds.yc.values)
ds.values = da.from_array(ds.values)
ds.hvplot.quadmesh('xc', 'yc', rasterize=True, dynamic=True)
Should be fixed now datashader 0.11 is released.
I am trying to use quadmesh + datashader + dask which is requiring datashader to be at version 0.11 or higher because of the above problem.
But, I cannot have datashader be v0.11 because it requires that numba cannot be 0.49. or 0.50.
And I am using xgcm.grid.transform
which requires that numba be version 0.49 or above.
Any suggestions for how to proceed from either the datashader or xgcm (@rabernat @jbusecke) side? Thanks.
Numba 0.51 should be available now. Could you try that?
@philippjfr Yes! Thank you a newer version is available and it has fixed the conundrum. I had checked the numba release notes to see the newest version and they apparently aren't quite updated so I thought I was stuck at 0.50.*. Thanks again!
ALL software version info
I am using the latest released versions of all the relevant libraries.
Hvplot 0.5.2 Datshader 0.10.0 Numba 0.48.0
Description of expected behavior and the observed behavior
Complete, minimal, self-contained example code that reproduces the issue
I am trying to plot an xarray dataset backed by dask using hvplot. Here is how I load the data. (Should be reproducible with intake installed.)
The following code works fine:
However, if I try to do quadmesh instead
I get a big long error.
Stack traceback and/or browser JavaScript console output
I recognize that the best place for this issue might be in another repo, but I thought I would try here first.