Closed ahuang11 closed 5 years ago
I can reproduce this using holoviews.operation.datashader.rasterize()
, so I think it's an issue with rasterize()
itself rather than anything in hvplot:
It seems to be specific to QuadMesh objects, because the same data doesn't get flipped for Image objects:
I've made a possible fix for this problem on holoviews: https://github.com/ioam/holoviews/pull/2883
@ahuang11, could you try it out and see if it works for you? It definitely fixes it in the example I show above, but I don't know if this is the right fix, i.e., whether it will break some other case.
Looks good for this case too. Thanks for the quick support!
(Interestingly, quadmesh without rasterize=True before a fix was also flipped: https://github.com/pyviz/hvplot/issues/23)
Oh I explored other cases too to see if it broke anything; when I pass in crs=crs.PlateCarree()
it crashes, but to use gv.operation.project_image()
I need to specify the crs...
import os
import xarray as xr
import holoviews as hv
import geoviews as gv
import hvplot.xarray
hv.extension('bokeh')
os.system(
'wget -nc '
'ftp://ftp.cdc.noaa.gov/'
'Datasets/ncep.reanalysis.dailyavgs/'
'surface/'
'air.sig995.2018.nc'
)
obs_ds = xr.open_dataset('air.sig995.2018.nc')
qm = obs_ds.hvplot.quadmesh(x='lon', y='lat', z='air', groupby='time',
rasterize=True, crs=crs.PlateCarree(central_longitude=360)))
gv.operation.project_image(qm, projection=ccrs.NorthPolarStereo())
but works if it's an Image
qm = obs_ds.hvplot.image(x='lon', y='lat', z='air', groupby='time',
rasterize=True, crs=crs.PlateCarree(central_longitude=360))
gv.operation.project_image(qm, projection=ccrs.NorthPolarStereo()).options(projection=ccrs.NorthPolarStereo())
and also works if I supply a projection...
obs_ds.hvplot.quadmesh(x='lon', y='lat', z='air', groupby='time',
crs=crs.PlateCarree(central_longitude=360),
projection=ccrs.NorthPolarStereo())
but if I add rasterize=True to the last bit, it gives an empty globe (until I interact by zooming out)
obs_ds.hvplot.quadmesh(x='lon', y='lat', z='air', groupby='time',
crs=crs.PlateCarree(central_longitude=360),
rasterize=True,
projection=ccrs.NorthPolarStereo())
Probably best to let @philippjfr review this, as he knows all the various ways this code can get used, whereas I can see only this specific case. Unfortunately, he may not be able to respond any time soon...
Not a problem at all; there's no rush! Thanks for all the help and making these amazing tools!
Should be fixed in https://github.com/ioam/holoviews/pull/3017
Fixed.