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/2410#issuecomment-969329589,https://api.github.com/repos/pydata/xarray/issues/2410,969329589,IC_kwDOAMm_X845xsu1,20617032,2021-11-15T21:17:14Z,2021-11-15T21:17:14Z,NONE,"It appears there is an incorrect statement in the 'indexing' section of the terminology page. > By construction, `len(arr.dims) == len(arr.indexes)` But this simple code does not reproduce this result ``` da = xr.DataArray(np.random.randn(2, 3), dims=(""x"", ""y""), coords={""x"": [10, 20]}) len(da.dims) == len(da.indexes) >False ``` Because the dimension y does not have any coordinates associated with it. Maybe I am missing something, but it seems a clarification should be added that this is only true for dimensions with coordinates assigned to them. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,359240638 https://github.com/pydata/xarray/issues/2410#issuecomment-884235104,https://api.github.com/repos/pydata/xarray/issues/2410,884235104,IC_kwDOAMm_X840tFtg,2448579,2021-07-21T14:28:17Z,2021-07-21T14:28:17Z,MEMBER,Actualy we should update the `indexing.rst` page with the nice text here.,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,359240638 https://github.com/pydata/xarray/issues/2410#issuecomment-884233832,https://api.github.com/repos/pydata/xarray/issues/2410,884233832,IC_kwDOAMm_X840tFZo,2448579,2021-07-21T14:26:35Z,2021-07-21T14:26:35Z,MEMBER,We have a version here now: https://xarray.pydata.org/en/stable/user-guide/terminology.html,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,359240638 https://github.com/pydata/xarray/issues/2410#issuecomment-883889458,https://api.github.com/repos/pydata/xarray/issues/2410,883889458,IC_kwDOAMm_X840rxUy,26384082,2021-07-21T05:00:50Z,2021-07-21T05:00:50Z,NONE,"In order to maintain a list of currently relevant issues, we mark issues as stale after a period of inactivity If this issue remains relevant, please comment here or remove the `stale` label; otherwise it will be marked as closed automatically ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,359240638 https://github.com/pydata/xarray/issues/2410#issuecomment-522344351,https://api.github.com/repos/pydata/xarray/issues/2410,522344351,MDEyOklzc3VlQ29tbWVudDUyMjM0NDM1MQ==,2818208,2019-08-18T18:29:52Z,2019-08-18T18:29:52Z,CONTRIBUTOR,"@horta, what's the status on this? @max-sixty and I were discussing a glossary over in https://github.com/pydata/xarray/issues/3176. I think this is an important contribution and am happy to help if needed.","{""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,359240638 https://github.com/pydata/xarray/issues/2410#issuecomment-422368970,https://api.github.com/repos/pydata/xarray/issues/2410,422368970,MDEyOklzc3VlQ29tbWVudDQyMjM2ODk3MA==,514522,2018-09-18T12:17:06Z,2018-09-18T12:17:06Z,CONTRIBUTOR,"I will first try to have both together. I'm well aware that learning by examples (that is true for me at least and apparently to most of people: tldr library), so at first I will try to combine all in one page: 1. Starts with examples, going from simple ones to more complicated one with no definition whasoever. 2. Begins a section defining terms and giving examples that ellucidate them (the first section we have here) 3. Ends with a formal description of the algorithm (the second section we have here) I prefer starting with 2 and 3 for me to actually understand xarray...","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,359240638 https://github.com/pydata/xarray/issues/2410#issuecomment-422354832,https://api.github.com/repos/pydata/xarray/issues/2410,422354832,MDEyOklzc3VlQ29tbWVudDQyMjM1NDgzMg==,6815844,2018-09-18T11:20:10Z,2018-09-18T11:20:10Z,MEMBER,"Thanks, @horta Your description looks much more exact than that we already have [in our doc](http://xarray.pydata.org/en/stable/data-structures.html). It would help readers when they want to know the data structure of xarray more deeply. I am a little wondering how we could balance the exactness and simplicity of the description. I don't think it's a good idea to simply replace this section by your more strict definition, as it would be hard for beginners to grasp the outline of this section. I think it would be nice if we can have both + a schematic illustration of our data structure that helps the readers understand the outline + a list of exact definitions that readers can refer if they want to know / understand xarraymore deeply. Any idea about how our docs should looks like?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,359240638 https://github.com/pydata/xarray/issues/2410#issuecomment-421998857,https://api.github.com/repos/pydata/xarray/issues/2410,421998857,MDEyOklzc3VlQ29tbWVudDQyMTk5ODg1Nw==,514522,2018-09-17T12:40:52Z,2018-09-17T12:40:52Z,CONTRIBUTOR,"I have updated mainly the _Indexing and selection data_ section. I'm proposing an indexing notation using `[]` operator vs `()` function call to differentiate between dimension lookup. But more importantly, I'm working out a precise definition of data array indexing in section _Formal indexing definition_. # Xarray definition A **data array** `a` has `D` dimensions, ordered from `0` to `D`. It contains an array of dimensionality `D`. The first dimension of that array is associated with the first dimension of the data array, and so forth. That array is returned by the data array attribute `values` . A **named data array** is a data array with the `name` attribute of string value: ```python >>> import xarray as xr >>> >>> a = xr.DataArray([[0, 1], [2, 3], [4, 5]]) >>> a.name = ""My name"" >>> a array([[0, 1], [2, 3], [4, 5]]) Dimensions without coordinates: dim_0, dim_1 ``` Each data array dimension has an unique `name` attribute of string type and can be accessed via data array `dims` attribute of tuple type. The name of the dimension `i` is `a.dims[i]` : ```python >>> a.dims[0] 'dim_0' ``` A data array can have zero or more coordinates, represented by a dict-like `coords` attribute. A coordinate is a named data array, referred also as **coordinate data array**. Coordinate data arrays have unique names among other coordinate data arrays. A coordinate data array of name `x` can be retrieved by `a.coords[x]` . A coordinate can have zero or more dimensions associated with. A **dimension data array** is a unidimensional coordinate data array associated with one, and only one, dimension having the same name as the coordinate data array itself. A dimension data array has always one, and only one, coordinate. That coordinate has again a dimension data array associated with: ```python >>> import numpy as np >>> >>> a = xr.DataArray(np.arange(6).reshape((3, 2)), dims=[""x"", ""y""], coords={""x"": list(""abc"")}) >>> a array([[0, 1], [2, 3], [4, 5]]) Coordinates: * x (x) >> a.coords[""x""] array(['a', 'b', 'c'], dtype='>> a.coords[""x""].coords[""x""] array(['a', 'b', 'c'], dtype='>> a.loc[""b"", :] array([2, 3]) Coordinates: x >> a = xr.DataArray(np.arange(6).reshape((3, 2)), dims=[""year"", ""country""], coords={""year"": [1990, 1994, 1998], ""country"": [""UK"", ""US""]}) >>> a array([[0, 1], [2, 3], [4, 5]]) Coordinates: * year (year) int64 1990 1994 1998 * country (country) >> a.loc[:, ""UK""] array([0, 2, 4]) Coordinates: * year (year) int64 1990 1994 1998 country >> i_0 array([['a'], ['c']], dtype='>> r_0 array(['a', 'b', 'c'], dtype='>> import numpy as np >>> import xarray as xr >>> >>> a = xr.DataArray(np.arange(6).reshape((3, 2)), dims=[""x"", ""y""], coords={""x"": list(""abc"")}) >>> a array([[0, 1], [2, 3], [4, 5]]) Coordinates: * x (x) >> a.coords[""x""] array(['a', 'b', 'c'], dtype='>> a.coords[""x""].coords[""x""] array(['a', 'b', 'c'], dtype='>> a = xr.DataArray(np.arange(6).reshape((3, 2)), dims=[""x"", ""y""], coords={""x"": list(""abc""), ""y"": [0, 1]}) >>> i0 = xr.DataArray(['a', 'c'], dims=[""x""]) >>> i0 array(['a', 'c'], dtype='>> i1 = xr.DataArray([0, 1], dims=[""y""]) >>> i1 array([0, 1]) Dimensions without coordinates: y >>> a.sel(x=i0, y=i1) array([[0, 1], [4, 5]]) Coordinates: * x (x) >> a = xr.DataArray([0, 1, 2], dims=[""x""], coords={""x"": list(""abc"")}) >>> a array([0, 1, 2]) Coordinates: * x (x) >> i0 = xr.DataArray([['a', 'c']], dims=[""x0"", ""x1""]) >>> i0 array([['a', 'c']], dtype='>> a.sel(x=i0) array([[0, 2]]) Coordinates: x (x0, x1) object 'a' 'c' Dimensions without coordinates: x0, x1 ``` The resulting data array have the same dimensions as the indexer, not as the original data array. Notice also that the resulting data array has no dimension data array as opposed to the previous example. Instead, it has a bi-dimensional coordinate data array: ```python >>> a.sel(x=i0).coords[""x""] array([['a', 'c']], dtype=object) Coordinates: x (x0, x1) object 'a' 'c' Dimensions without coordinates: x0, x1 ```","{""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,359240638