holoviz / geoviews

Simple, concise geographical visualization in Python
http://geoviews.org
BSD 3-Clause "New" or "Revised" License
594 stars 77 forks source link

Coastline + Rasterize shows blank plot #726

Closed ahuang11 closed 2 months ago

ahuang11 commented 4 months ago

Still an issue from https://github.com/holoviz/geoviews/pull/722

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.extension("bokeh")
import hvplot.xarray
ds = xr.tutorial.open_dataset("air_temperature").isel(time=0)

rasterize(gv.Image(ds, ["lon", "lat"], ["air"])) * gv.feature.coastline()
TheoMathurin commented 3 months ago

It's odd, in my experience the issue manifested itself when there was a datashader operation involved on both elements (image and geometry), as reported in #593.

ahuang11 commented 2 months ago

Finally figured out what is causing this issue, but not sure why. It was introduced in https://github.com/holoviz/geoviews/pull/722

Commenting out https://github.com/holoviz/geoviews/pull/722/files#diff-170766bf0fca811f003fd9c97058f978c51b672af33a49cceab87d3584de2cf5R126-R129 makes it work again

image

With that snippet though, rasterize(obj) * coastline returns empty image

image

Even if I ONLY keep without the unwrap clause, it'd still return an empty image with an overlay

    def update_frame(self, key, ranges=None, element=None):
        super().update_frame(key, ranges, element)

Any ideas @hoxbro or @philippjfr?

ahuang11 commented 2 months ago

Heh asking for help always helps me figure it out faster :D

I guess the lesson is always follow best practices; optional kwargs should always have key=value. The positional args didn't match the keyword arguments.

image image