home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 352677925

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
352677925 MDExOlB1bGxSZXF1ZXN0MjA5OTMxMjYz 2375 Make `dim` optional on unstack 4806877 closed 0     13 2018-08-21T19:29:06Z 2018-09-05T16:01:23Z 2018-09-05T15:19:07Z CONTRIBUTOR   0 pydata/xarray/pulls/2375
  • [x] Tests added (for all bug fixes or enhancements)
  • [x] Tests passed (for all non-documentation changes)
  • [x] Fully documented, including whats-new.rst for all changes and api.rst for new API (remove if this change should not be visible to users, e.g., if it is an internal clean-up, or if this is part of a larger project that will be documented later)

Not sure if this is a desirable change but I thought it could be easily discussed as a PR. Just for context I was looking at flattening spatial data for machine learning pipelines and then reshaping after the output had been acquired.

I have a NxM array called b and am flattening it like:

python flat_input = b.stack(z=('y', 'x'))

Then I use that flat_input in my ML pipeline and get back an np.array (called output) which I want to unstack using all the metadata that went into stacking my original NxM array b.

python xr.full_like(flat_input, output).unstack(dim='z')

This PR just makes the dim argument optional in unstack so that we can use

python xr.full_like(flat_input, output).unstack()

As a follow on PR I was thinking of making a function called xr.unstack_like(other: xr.DataArray|xr.Dataset, data: array_like) to encompass this functionality. A couple questions:

1) Would something like xr.unstack_like be desirable? 2) Should we be using xr.full_like in this way? The documentation in xarray and numpy only mentions scalars, but arrays work fine in both. If this is a supported behavior I could add docs, and if not perhaps a copy and overwrite is a better approach?

Here is a gist of the workflow using a tweaked datashader example and datashader example data https://gist.github.com/jsignell/79a6cf2da5c1458211d9dcf34d4417df

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/2375/reactions",
    "total_count": 4,
    "+1": 4,
    "-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
  • 13 rows from issue in issue_comments
Powered by Datasette · Queries took 319.264ms · About: xarray-datasette