Skip to content
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

Incorrect values of lat/lon on hover using latest version #347

Closed
hdsingh opened this issue Aug 9, 2019 · 10 comments · Fixed by #358
Closed

Incorrect values of lat/lon on hover using latest version #347

hdsingh opened this issue Aug 9, 2019 · 10 comments · Fixed by #358

Comments

@hdsingh
Copy link

hdsingh commented Aug 9, 2019

Correct hover values in hv.__version__: 1.12.1:
Screenshot from 2019-08-09 12-03-24

Incorrect hover values in hv.__version__: 1.12.4:
Screenshot from 2019-08-09 12-03-41

Reproducible example:

import xarray as xr
import hvplot.xarray
import holoviews as hv
import cartopy.crs as ccrs
print("hv.__version__: ",hv.__version__)

url = 'http://opendap.co-ops.nos.noaa.gov/thredds/dodsC/NOAA/LOOFS/MODELS/201907/glofs.loofs.fields.forecast.20190720.t06z.nc'
data = xr.open_dataset(url)
data = data.set_coords(['lat','lon'])

mesh = data.air_u[-1:,:,:].hvplot.quadmesh(x='lon', y='lat', rasterize=True, crs=ccrs.PlateCarree())
mesh

Also correct behaviour is shown without using crs.

@philippjfr philippjfr transferred this issue from holoviz/holoviews Aug 9, 2019
@fmaussion
Copy link

I've been hit by this as well. As a workaround I wanted to create a custom hover showing the z values only.

I have a vg.dataset looking as following:

dataset = gv.Dataset(ds, ['longitude', 'latitude'], 'trends', crs=crs.PlateCarree())
print(dataset)
:Dataset   [longitude,latitude]   (trends)

But when I create a custom hover, the values are not shown and I see a ??? instead:

from bokeh.models import HoverTool
hover = HoverTool(
        tooltips=[
            ("Trend", "@trends"),
        ]
    )

image = dataset.to(gv.Image).redim.range(trends=(-1.5, 1.5))
plot = image.opts(cmap='RdBu_r', colorbar=True, width=1000, height=500, 
                  projection=crs.Mollweide(), tools=[hover], active_tools=['pan','wheel_zoom']) * gf.coastline
plot

Selection_034

It's probably me doing something wrong here, but what?

@fmaussion
Copy link

fmaussion commented Aug 29, 2019

Nevermind my question above, this seems to not yet be supported in Holoviews.

Using @image works (took me some time to find out)

@rsignell-usgs
Copy link
Contributor

@jbednar , I'm hoping this is on the list of tasks to be done for Pangeo. We would really like to stop pinning holoviews to 1.12.1.

@jsignell
Copy link
Member

As a workaround, adding the projection arg seemed to fix this for me. The projection arg is meant to specify the target projection of the plot.

import xarray as xr
import hvplot.xarray
import holoviews as hv
import cartopy.crs as ccrs
print("hv.__version__: ",hv.__version__)

url = 'http://opendap.co-ops.nos.noaa.gov/thredds/dodsC/NOAA/LOOFS/MODELS/201907/glofs.loofs.fields.forecast.20190720.t06z.nc'
data = xr.open_dataset(url)
data = data.set_coords(['lat','lon'])

mesh = data.air_u[-1:,:,:].hvplot.quadmesh(x='lon', y='lat', rasterize=True, 
                                           crs=ccrs.PlateCarree(), projection=ccrs.PlateCarree())
mesh

Screen Shot 2019-09-18 at 5 06 37 PM

@philippjfr
Copy link
Member

So using latest holoviews and geoviews I actually can't reproduce this.

@philippjfr
Copy link
Member

@jsignell Could you confirm?

@philippjfr
Copy link
Member

Huh, very strange, suddenly I can reproduce it again.

@jsignell
Copy link
Member

Maybe you left off rasterize=True?

@philippjfr
Copy link
Member

So the very strange thing here is that it all seems to be set up correctly and it works when you do:

pn.panel(hv.render(mesh))

But somehow when letting HoloViews render it, the CustomJSHover does not get called.

@tom-andersson
Copy link

I'm getting the same hover issue (lat/lon show up as projected coords, not in degrees) with hvplot=0.7.2, geoviews=1.9.1, bokeh=2.3.0. I see from digging through issues like this that the bug was meant to be fixed a couple years ago. Any advice?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants