home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 251154675

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/issues/1030#issuecomment-251154675 https://api.github.com/repos/pydata/xarray/issues/1030 251154675 MDEyOklzc3VlQ29tbWVudDI1MTE1NDY3NQ== 1217238 2016-10-03T16:29:27Z 2016-10-03T16:29:27Z MEMBER

One option that gets you part way there:

python arrays = [ds['data_band%d' % i].rename({'wn_band%d' % i: 'wn'}).assign_coords(band=i) for i in range(1, 4)] combined = xr.concat(arrays, dim='wn')

This would still need some work (e.g., with set_index #1028) to set the MultiIndex. Ideally, maybe you could write something like combined.set_index(spectrum=['band', 'wn']) to create the new dimension and MultiIndex all at once.

It does seem like something like the key argument to pandas.concat would make sense here: http://pandas.pydata.org/pandas-docs/stable/merging.html#more-concatenating-with-group-keys

The API is not so obvious for us, though, because we need to supply the new dimension name and levels all at once. Maybe something like xr.concat(arrays, dim={'spectrum': ['band', 'wn']} would work.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  180676935
Powered by Datasette · Queries took 0.581ms · About: xarray-datasette