home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 328401215

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/pull/1473#issuecomment-328401215 https://api.github.com/repos/pydata/xarray/issues/1473 328401215 MDEyOklzc3VlQ29tbWVudDMyODQwMTIxNQ== 1217238 2017-09-11T02:42:26Z 2017-09-11T02:42:26Z MEMBER

Two issues I encountered when testing this locally:

  1. Conflicting coordinates on indexers seem to be ignored: ``` In [4]: ds = xr.Dataset({'bar': ('x', [1, 2])}, {'x': [1, 2]})

In [5]: ds.isel(x=xr.DataArray([0, 1], [('x', [3, 4])])) Out[5]: <xarray.Dataset> Dimensions: (x: 2) Coordinates: * x (x) int64 1 2 Data variables: bar (x) int64 1 2 ``` I thought we agreed that these cases should raise an error, i.e., to require exact alignment? It's one thing to drop non-dimension coordinates, but dimension coordinates should not be ignored.

  1. The interaction with MultiIndex indexing seems to be somewhat off. Compare: ``` In [15]: midx = pd.MultiIndex.from_product([list('abc'), [0, 1]], ...: names=('one', 'two')) ...: mda = xr.DataArray(np.random.rand(6, 3), ...: [('x', midx), ('y', range(3))]) ...:

The multi-index remains with the name "x"

In [16]: mda.isel(x=xr.DataArray(np.arange(3), dims='z')) Out[16]: <xarray.DataArray (z: 3, y: 3)> array([[ 0.990021, 0.371052, 0.996406], [ 0.384432, 0.605875, 0.361161], [ 0.367431, 0.339736, 0.816142]]) Coordinates: x (z) object ('a', 0) ('a', 1) ('b', 0) * y (y) int64 0 1 2 Dimensions without coordinates: z

the multi-index is now called "z"

In [17]: mda.sel(x=xr.DataArray(mda.indexes['x'][:3], dims='z')) Out[17]: <xarray.DataArray (z: 3, y: 3)> array([[ 0.990021, 0.371052, 0.996406], [ 0.384432, 0.605875, 0.361161], [ 0.367431, 0.339736, 0.816142]]) Coordinates: x (z) object ('a', 0) ('a', 1) ('b', 0) * y (y) int64 0 1 2 * z (z) MultiIndex - one (z) object 'a' 'a' 'b' - two (z) int64 0 1 0 ```

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