-
-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
geo=True and rasterize=True makes the plot disappear #673
Comments
It is again coming from changes made in holoviz/hvplot#1053 Edit: I was wrong |
Nice! |
I was too quick; does not seem to be an hvplot as I can recreate it with: import xarray as xr
import geoviews as gv
import numpy as np
from holoviews.operation.datashader import rasterize
gv.extension("bokeh")
data = xr.DataArray(
np.random.random((100, 50)),
coords=dict(lon=np.arange(200, 300), lat=np.arange(25, 75)),
)
rasterize(gv.Image(data), width=10, height=10) |
Tried going back in time, and it does not seem to be a recent regression, as no one of the following works: ❯ conda list "python|holoviews|geoviews|bokeh"
# packages in environment at /home/shh/miniconda3/envs/geo_bug:
#
# Name Version Build Channel
bokeh 2.4.3 pyhd8ed1ab_3 conda-forge
brotli-python 1.1.0 py38h17151c0_0 conda-forge
geoviews 1.9.3 pyhd8ed1ab_0 conda-forge
geoviews-core 1.9.3 pyha770c72_0 conda-forge
holoviews 1.14.5 pyhd8ed1ab_0 conda-forge
python 3.8.17 he550d4f_0_cpython conda-forge
python-dateutil 2.8.2 pyhd8ed1ab_0 conda-forge
python-tzdata 2023.3 pyhd8ed1ab_0 conda-forge
python_abi 3.8 3_cp38 conda-forge # packages in environment at /home/shh/miniconda3/envs/geo_bug:
#
# Name Version Build Channel
bokeh 2.2.3 py38h578d9bd_0 conda-forge
brotli-python 1.1.0 py38h17151c0_0 conda-forge
geoviews 1.8.2 py_0 conda-forge
geoviews-core 1.8.2 py_0 conda-forge
holoviews 1.14.5 pyhd8ed1ab_0 conda-forge
python 3.8.17 he550d4f_0_cpython conda-forge
python-dateutil 2.8.2 pyhd8ed1ab_0 conda-forge
python-tzdata 2023.3 pyhd8ed1ab_0 conda-forge
python_abi 3.8 3_cp38 conda-forge Will move it to GeoViews for now. |
What about including datashader? |
I used Datashader 1.15.2. I did not expect Datashader to be a problem as it doesn't have any knowledge of geo-related information, and just get coordinates and data passed through it. Did a test with 0.14.4, which reproduced the same results. |
I'm quite surprised that no one has commented about this yet besides me haha. I should probably dive deeper into this soon... |
I believe i had posted something about it a year or two ago but no one was interested so I deleted the post :) glad to see it ressurface. |
Workaround seems to work import xarray as xr
import panel as pn
import holoviews as hv
from holoviews.operation.datashader import rasterize
import geoviews as gv
import cartopy.crs as ccrs
hv.renderer("bokeh").webgl = False
import hvplot.xarray
ds = xr.tutorial.open_dataset("air_temperature").isel(time=0)
# pn.serve(ds.hvplot("lon", "lat", rasterize=True, crs=ccrs.PlateCarree(), projection=ccrs.PlateCarree()))
pn.serve(rasterize(gv.project(gv.Image(ds, ["lon", "lat"], ["air"])))) |
x0 == x1 here for some reason after zooming
|
Aha, I think it's an issue with 0 to 360 vs -180 to 180
|
https://github.com/holoviz/holoviews/blame/main/holoviews/operation/resample.py#L142 I think it comes down to: x0, x1 is ranged from -180 to 180, while ex0 is ex1 is ranged from 0 to 360, so when the following computed, it gives import numpy as np
x0, x1, ex0, ex1 = -154.39239111669974, -33.72522063810877, 198.75, 331.25
x_range = (np.nanmin([np.nanmax([x0, ex0]), ex1]),
np.nanmax([np.nanmin([x1, ex1]), ex0]))
x_range |
This original issue was an hvplot issue. Renaming this issue for the geoviews issue. holoviz/hvplot#1105 |
Data disappears on zoom.
The text was updated successfully, but these errors were encountered: