{"action":"reopened","issue":{"url":"https://api.github.com/repos/ioam/holoviews/issues/2016","repository_url":"https://api.github.com/repos/ioam/holoviews","labels_url":"https://api.github.com/repos/ioam/holoviews/issues/2016/labels{/name}","comments_url":"https://api.github.com/repos/ioam/holoviews/issues/2016/comments","events_url":"https://api.github.com/repos/ioam/holoviews/issues/2016/events","html_url":"https://github.com/ioam/holoviews/issues/2016","id":267520593,"number":2016,"title":"Dimension re-ordering in gridded data","user":{"login":"agvaughan","id":868159,"avatar_url":"https://avatars2.githubusercontent.com/u/868159?v=4","gravatar_id":"","url":"https://api.github.com/users/agvaughan","html_url":"https://github.com/agvaughan","followers_url":"https://api.github.com/users/agvaughan/followers","following_url":"https://api.github.com/users/agvaughan/following{/other_user}","gists_url":"https://api.github.com/users/agvaughan/gists{/gist_id}","starred_url":"https://api.github.com/users/agvaughan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agvaughan/subscriptions","organizations_url":"https://api.github.com/users/agvaughan/orgs","repos_url":"https://api.github.com/users/agvaughan/repos","events_url":"https://api.github.com/users/agvaughan/events{/privacy}","received_events_url":"https://api.github.com/users/agvaughan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-10-23T02:00:43Z","updated_at":"2017-10-23T02:37:59Z","closed_at":null,"author_association":"NONE","body":"I was playing around with gridded datasets, and found a bug that seems to reverse-index the dimensions of any 3D array passed as data.  The result is either a weird re-ordering of dimensions (if dimension sizes are equal), or failure (if dimension sizes are not equal).\r\n\r\nTo reproduce, here's code adapted from http://holoviews.org/getting_started/Gridded_Datasets.html\r\n```\r\nimport numpy as np\r\nimport pandas as pd\r\nimport bokeh\r\nimport holoviews as hv\r\nhv.extension('matplotlib','bokeh')\r\n\r\n#data = np.random.rand(10,10,10)    # This works!\r\ndata = np.random.rand(11,11,10)     # This doesn't!\r\n\r\nds = hv.Dataset( \r\n    (np.arange(data.shape[0]),\r\n     np.arange(data.shape[1]),\r\n     np.arange(data.shape[2]),\r\n     data),\r\n    kdims=['x','y','z'], vdims=['Fluorescence'])\r\n\r\n%opts Image (cmap='viridis')\r\nds.to(hv.Image, ['x', 'y'])\r\n```\r\n\r\nTwo changes seem to fix this problem:\r\n\r\n(1) xarray.py\r\n```\r\n- 76            coords = [(kd.name, data[kd.name]) for kd in kdims][::-1]\r\n+ 76            coords = [(kd.name, data[kd.name]) for kd in kdims]\r\n```\r\n\r\nThis alleviates an issue in dataarray.py (line 87) where we generate new_coords from a zip(dims,coords).  Here dims is in the original order, and coords is reversed becasue of the [::-1] above.\r\n\r\n(2) grid.py\r\n```\r\n- 336        int_inds = [np.argwhere(v) for v in value_select] [::-1]\r\n+ 336       int_inds = [np.argwhere(v) for v in value_select]  \r\n```\r\n\r\nThis alleviates an error at \r\n`340            data[vdim.name] = dataset.data[vdim.name][index]`\r\nwhere int_inds will index via the wrong dimensions.\r\n\r\n\r\nWith both of these changes, the plot succeeds.  I'm reluctant to file this as a simple pull request, because I assume that the list reversals above had some purpose.  \r\n\r\nBut the current behavior seems sub-optimal. Thoughts?\r\n\r\n\r\n\r\n\r\n"}}
{"actor":{"display_login":"philippjfr"}}