home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 261131958

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
261131958 MDExOlB1bGxSZXF1ZXN0MTQzNTExMTA3 1597 Add methods for combining variables of differing dimensionality 1386642 closed 0     46 2017-09-27T22:01:57Z 2019-07-05T15:59:51Z 2019-07-05T00:32:51Z CONTRIBUTOR   0 pydata/xarray/pulls/1597
  • [x] Closes #1317
  • [x] Tests added / passed
  • [x] Passes git diff upstream/master | flake8 --diff
  • [x] Fully documented, including whats-new.rst for all changes and api.rst for new API

While working on #1317, I settled upon combining stack and to_array to create two dimensional numpy arrays given an xarray Dataset. Unfortunately, to_array automatically broadcasts the variables of dataset, which is not always a desirable behavior. For instance, I was trying to combine precipitation (a horizontal field) and temperature (a 3D field) into one array.

This PR enables this by adding two new methods to xarray: - Dataset.stack_cat, and - DataArray.unstack_cat.

stack_cat uses stack, expand_dims, and concat to reshape a Dataset into a Dataarray with a helpful MultiIndex, and unstack_cat reverses the process.

I implemented this functionality as a new method since to_array is such a clean method already. I really appreciate your thoughts on this. Thanks!

cc @jhamman @shoyer

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/1597/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    13221727 pull

Links from other tables

  • 0 rows from issues_id in issues_labels
  • 46 rows from issue in issue_comments
Powered by Datasette · Queries took 0.688ms · About: xarray-datasette