Open morf1102 opened 8 months ago
Thanks for reporting this.
Do you need to specifically use QuadMesh? If not, a workaround is just using an image:
import hvplot.xarray
import numpy as np
import xarray as xr
from cartopy import crs
ds = xr.tutorial.open_dataset('air_temperature').isel(time=0)
ds.hvplot(
project=True,
rasterize=True,
projection=crs.Orthographic(central_longitude=-88),
coastline=True,
global_extent=True,
)
Seems like a bug in hvplot:
import numpy as np
import xarray as xr
import geoviews as gv
from cartopy import crs
from holoviews.operation.datashader import rasterize
import panel as pn
gv.extension("bokeh")
ds = xr.tutorial.open_dataset("air_temperature").isel(time=0)
pn.panel(rasterize(
gv.QuadMesh(ds, ["lon", "lat"], ["air"], crs=crs.PlateCarree())
).opts("Image", projection=crs.Orthographic(central_longitude=-88), global_extent=True, tools=["hover"])).show()
Okay, seems like a bug with project=True
+ rasterize=True
import hvplot.xarray
import numpy as np
import xarray as xr
from cartopy import crs
ds = xr.tutorial.open_dataset('air_temperature').isel(time=0)
ds.hvplot.quadmesh(
geo=True,
rasterize=True,
dynamic=True,
projection=crs.Orthographic(),
)
This seems to work.
Without project=True
, it works until move the plot or zoom in. If I do, half of the map goes blank like this:
Huh, I remember encountering this before... but I forget if there was a work around. Maybe @Hoxbro remembers?
Seems to break with geoviews too:
import numpy as np
import xarray as xr
import geoviews as gv
from cartopy import crs
from holoviews.operation.datashader import rasterize
import panel as pn
gv.extension("bokeh")
ds = xr.tutorial.open_dataset("air_temperature").isel(time=0)
rasterize(
gv.QuadMesh(ds, ["lon", "lat"], ["air"], crs=crs.PlateCarree())
).opts("Image", projection=crs.Orthographic(central_longitude=-88), global_extent=True, tools=["hover"])
Maybe @Hoxbro remembers?
I haven't seen this before, so unfortunately, there is no help from me :slightly_frowning_face:
Quadmesh would be better, but using an image seems to work for now. Thanks @ahuang11 for your help!
I'm not sure if this is a bug or if I'm doing something wrong, but when I try to use cartopy's
crs.Orthographic()
projection, I get this warning:And my map looks like this:
However, if I remove
rasterize=True
, everything seems to work:Here's the code I used to create the first map:
Versions: