home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 1326823221

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/7294#issuecomment-1326823221 https://api.github.com/repos/pydata/xarray/issues/7294 1326823221 IC_kwDOAMm_X85PFbc1 14808389 2022-11-24T20:39:03Z 2022-11-24T20:40:32Z MEMBER

transpose_coords is used to transpose coordinates with multiple dimensions: ```python In [1]: import xarray as xr ...: ...: ds = xr.tutorial.open_dataset("rasm") ...: ds.Tair.attrs.clear() ...: ds.Tair Out[1]: <xarray.DataArray 'Tair' (time: 36, y: 205, x: 275)> [2029500 values with dtype=float64] Coordinates: * time (time) object 1980-09-16 12:00:00 ... 1983-08-17 00:00:00 xc (y, x) float64 ... yc (y, x) float64 ... Dimensions without coordinates: y, x

In [2]: ds.Tair.transpose("x", "y", ..., transpose_coords=False) Out[2]: <xarray.DataArray 'Tair' (x: 275, y: 205, time: 36)> [2029500 values with dtype=float64] Coordinates: * time (time) object 1980-09-16 12:00:00 ... 1983-08-17 00:00:00 xc (y, x) float64 ... yc (y, x) float64 ... Dimensions without coordinates: x, y

In [3]: ds.Tair.transpose("x", "y", ..., transpose_coords=True) Out[3]: <xarray.DataArray 'Tair' (x: 275, y: 205, time: 36)> [2029500 values with dtype=float64] Coordinates: * time (time) object 1980-09-16 12:00:00 ... 1983-08-17 00:00:00 xc (x, y) float64 ... yc (x, y) float64 ... Dimensions without coordinates: x, y `` Interestingly,transpose_coordsis only an option forDataArray.transpose, and it defaults toTrue`. This means that the example from https://github.com/pydata/xarray/issues/7294#issue-1452123685 always does the same thing, so even if we did implement the reordering nothing would change.

As such, I'm -0.5 on changing the order in which the coordinates are stored, since the only time that order is used is the repr / HTML repr. In the past we have actually considered sorting the coordinates alphabetically, which did not happen because the coordinate names can be hashables of arbitrary types, and comparing a pair of hashables of different types is not easy.

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