home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 208312826

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
208312826 MDU6SXNzdWUyMDgzMTI4MjY= 1273 replace a dim with a coordinate from another dataset 1197350 open 0     4 2017-02-17T02:15:36Z 2022-04-09T15:26:20Z   MEMBER      

I often want a function that takes a dataarray / dataset and replaces a dimension with a coordinate from a different dataset.

@shoyer proposed the following simple solution. ```python def replace_dim(da, olddim, newdim): renamed = da.rename({olddim: newdim.name})

# note that alignment along a dimension is skipped when you are overriding
# the relevant coordinate values
renamed.coords[newdim.name] = newdim
return renamed

```

Is this of broad enough interest to add a build in method for?

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

Links from other tables

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