home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 817885693

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
817885693 MDU6SXNzdWU4MTc4ODU2OTM= 4968 swap_coords() function ? 32069530 open 0     0 2021-02-27T10:00:53Z 2021-02-27T10:01:52Z   NONE      

Hi all,

I have a DataArray with coordinates 'time'. I want to swap the time coordinate with another coordinate which is not in the array. swap_dims() allows to give a non-existing dimension but I cannot define the coords at the same time. I usually use a workaround as follow. a = xr.DataArray(np.random.rand(10), dims='time', coords={'time':1.e-4*np.arange(10)}) celerity=3e8 space = celerity * a['time'] a = a.swap_dims({'time':'space'}) a = a.assign_coords({'space':space.data})

I think it could be interesting to be able to swap_coords which could do the last two lines at the same time. Basically a swap_coords() function

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