question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

holoviews 1.10 no longer respects the order of coordinates of an xarray dataset

See original GitHub issue

There is a change of behaviour between holoviews 1.9.5 and 1.10 with the way to build kdims from coordinates of an xarray dataset.

I noticed this because I have an images stack with coordinates (x,y,time) ; let’s call it ds. It is handy to visualize it with hv.Dataset(ds).to(hv.Image) because holoviews nicely infers that x and y are the kdims of the image and uses a menu for the time. With 1.10 though, the kdims become (time,x,y) and the inference is no longer what we could expect.

Here is a small exemple to reproduce this :

import numpy as np,holoviews as hv,xarray as xr
from collections import OrderedDict
data = np.zeros((3,4,5))
coords = OrderedDict(b=range(3), c=range(4), a=range(5))
dataset=xr.Dataset(coords=coords)
dataset['value']=([*dataset.coords.keys()], data)

The output is an xarray with dimensions (a,b,c) and coordinates (b,c,a) as we can check with print([*dataset.dims],[*dataset.coords]).

This command hv.Dataset(dataset).kdims gives:

  • output of 1.9.5 : [Dimension(‘b’), Dimension(‘c’), Dimension(‘a’)]
  • output of 1.10 : [Dimension(‘a’), Dimension(‘b’), Dimension(‘c’)]

Has it something to do with changes in the XArrayInterface?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
philippjfrcommented, Apr 19, 2018

If there was some way to tell whether the coord order was defined explicitly or was just decided implicitly by the dictionary ordering I’d be happy to make use of that but as it is I’m inclined to stick with the new behavior for consistency.

1reaction
philippjfrcommented, Apr 19, 2018

Thanks for reporting this. It does seem to be a significant change in behavior and I think we should return to the old behavior for 1.10.1.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Releases — HoloViews v1.15.3
Fix to respect series order in stacked area plot (#5236) ... Unfortunately a number of tile sources are no longer publicly available.
Read more >
Improved xarray support #2319 - holoviz/holoviews - GitHub
Right now, coordinates are converted into kdims, and dimensions without coordinates are ignored. IMO, it would be better to let the user ...
Read more >
Can't visualise Points over Image - HoloViews
I'm working on a piece of code to plot two time-varying geographic datasets on the same figure. My goal is to have a...
Read more >
holoviews Changelog - pyup.io
In future, HoloViews will not allow non-string values for pandas ... Coordinates user guide ... Fix to respect series order in stacked area...
Read more >
icepyx - Read the Docs
it is no longer hosted by NSIDC), you will get a “no data matched your ... ATTENTION: icepyx loads your data by creating...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found