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/3894#issuecomment-1101553689,https://api.github.com/repos/pydata/xarray/issues/3894,1101553689,IC_kwDOAMm_X85BqGAZ,1386642,2022-04-18T16:41:39Z,2022-04-18T16:41:39Z,CONTRIBUTOR,"I think the issue is still valid, we just couldn't think of what to name the new API.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,588112617 https://github.com/pydata/xarray/issues/3894#issuecomment-1100666888,https://api.github.com/repos/pydata/xarray/issues/3894,1100666888,IC_kwDOAMm_X85BmtgI,26384082,2022-04-16T13:43:45Z,2022-04-16T13:43:45Z,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}",,588112617 https://github.com/pydata/xarray/issues/3894#issuecomment-676669386,https://api.github.com/repos/pydata/xarray/issues/3894,676669386,MDEyOklzc3VlQ29tbWVudDY3NjY2OTM4Ng==,1217238,2020-08-19T20:32:24Z,2020-08-19T20:32:24Z,MEMBER,"At most, I would require using the new method if you want your code to type-check properly.","{""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,588112617 https://github.com/pydata/xarray/issues/3894#issuecomment-676633628,https://api.github.com/repos/pydata/xarray/issues/3894,676633628,MDEyOklzc3VlQ29tbWVudDY3NjYzMzYyOA==,3460034,2020-08-19T20:04:10Z,2020-08-19T20:24:38Z,CONTRIBUTOR,"Would this proposal mean that subsetting variables with `__getitem__` would no longer work? If so, I'd make the humble request as a downstream user/library contributor for it to have a very generous deprecation period, since it is core functionality I rely on a lot (and include in many tutorials).","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,588112617 https://github.com/pydata/xarray/issues/3894#issuecomment-676656104,https://api.github.com/repos/pydata/xarray/issues/3894,676656104,MDEyOklzc3VlQ29tbWVudDY3NjY1NjEwNA==,14808389,2020-08-19T20:23:53Z,2020-08-19T20:23:53Z,MEMBER,"IIUC, what we're discussing here is *adding* a new method that treats all sequences the same (`__getitem__` won't be touched, except maybe the type hints).","{""total_count"": 2, ""+1"": 2, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,588112617 https://github.com/pydata/xarray/issues/3894#issuecomment-675125293,https://api.github.com/repos/pydata/xarray/issues/3894,675125293,MDEyOklzc3VlQ29tbWVudDY3NTEyNTI5Mw==,5635139,2020-08-17T21:29:22Z,2020-08-17T21:29:22Z,MEMBER,"A level down, re the name — I thought `.vars` might be decent — but potentially it's too similar to `.variables` — which is a mapping to the actual variables (and can't take multiple selections)","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,588112617 https://github.com/pydata/xarray/issues/3894#issuecomment-675124770,https://api.github.com/repos/pydata/xarray/issues/3894,675124770,MDEyOklzc3VlQ29tbWVudDY3NTEyNDc3MA==,5635139,2020-08-17T21:27:59Z,2020-08-17T21:27:59Z,MEMBER,"I do think having a `Dataset` behave similarly to a `dict` / `Mapping` is generally good, and allows new users to bring existing understandings around those data structures to the xarray data model. I recognize that a hashable iterable (e.g. `('a', 'b', 'c')` is an annoying corner case, though. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,588112617 https://github.com/pydata/xarray/issues/3894#issuecomment-675065140,https://api.github.com/repos/pydata/xarray/issues/3894,675065140,MDEyOklzc3VlQ29tbWVudDY3NTA2NTE0MA==,2448579,2020-08-17T19:20:24Z,2020-08-17T19:20:24Z,MEMBER,"I think avoiding `sel` is a good idea (but no strong thoughts here). how about `pick_vars` or `take_vars`?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,588112617 https://github.com/pydata/xarray/issues/3894#issuecomment-675058654,https://api.github.com/repos/pydata/xarray/issues/3894,675058654,MDEyOklzc3VlQ29tbWVudDY3NTA1ODY1NA==,1217238,2020-08-17T19:05:47Z,2020-08-17T19:05:47Z,MEMBER,"> > It would be better to have an explicit method for subsetting Dataset variables. > > I agree. `sel_vars` is more clear IMO since `subset` could apply to the coordinates too e.g. a spatial subset. We did a similar splitting of functionality recently with `drop`, into `drop_vars` and `drop_sel`. So this would leave us with: - `sel`/`drop_sel` for indices - `sel_vars`/`drop_vars` for variables The naming doesn't have an obvious pattern here, which seems non-ideal. I can't think of anything much better at the moment, but perhaps it would help to avoid reusing `sel`. Maybe `get_vars` or `subset_vars`?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,588112617 https://github.com/pydata/xarray/issues/3894#issuecomment-675057700,https://api.github.com/repos/pydata/xarray/issues/3894,675057700,MDEyOklzc3VlQ29tbWVudDY3NTA1NzcwMA==,1386642,2020-08-17T19:03:55Z,2020-08-17T19:03:55Z,CONTRIBUTOR,"NVM, `get` is already a method. Maybe we could overload it?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,588112617 https://github.com/pydata/xarray/issues/3894#issuecomment-675056880,https://api.github.com/repos/pydata/xarray/issues/3894,675056880,MDEyOklzc3VlQ29tbWVudDY3NTA1Njg4MA==,1386642,2020-08-17T19:02:24Z,2020-08-17T19:02:24Z,CONTRIBUTOR,"Or maybe ""get"" since it's a synonym of ""select"" that isn't overloaded with spatial indexing in the code base.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,588112617 https://github.com/pydata/xarray/issues/3894#issuecomment-675055276,https://api.github.com/repos/pydata/xarray/issues/3894,675055276,MDEyOklzc3VlQ29tbWVudDY3NTA1NTI3Ng==,1386642,2020-08-17T18:59:05Z,2020-08-17T18:59:05Z,CONTRIBUTOR,"> Is there a way in mypy we could use something like overload to specify the above contract here, as an alternative to another method? That is correct. The output type is predictable from the inputs types. With #4144, `mypy` may have a chance at detecting this kind of error. Still, I don't know how many users use type-checking. I expect most will only discover this problem at runtime. > It would be better to have an explicit method for subsetting Dataset variables. I agree. `sel_vars` is more clear IMO since `subset` could apply to the coordinates too e.g. a spatial subset.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,588112617 https://github.com/pydata/xarray/issues/3894#issuecomment-674440470,https://api.github.com/repos/pydata/xarray/issues/3894,674440470,MDEyOklzc3VlQ29tbWVudDY3NDQ0MDQ3MA==,1217238,2020-08-15T19:48:55Z,2020-08-15T19:48:55Z,MEMBER,"I agree, this API is too overloaded. It would be better to have an explicit method for subsetting `Dataset` variables. Maybe `subset` or `sel_vars`? In early versions of xarray (back when it was called xray), we actually had a `select` method but I was concerned it was too confusing with indexing: http://xarray.pydata.org/en/v0.1.1/generated/xray.Dataset.select.html#xray.Dataset.select > What's the reasoning for not returning a Dataset when `__getitem__` is passed an Iterable like `_copy_listed`? The current check uses hashability to determine whether to try to make a DataArray. In theory, you could put a variable with the name `('a', 'b', 'c')` into a Dataset.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,588112617 https://github.com/pydata/xarray/issues/3894#issuecomment-674422560,https://api.github.com/repos/pydata/xarray/issues/3894,674422560,MDEyOklzc3VlQ29tbWVudDY3NDQyMjU2MA==,2448579,2020-08-15T16:53:38Z,2020-08-15T16:53:38Z,MEMBER,What's the reasoning for not returning a Dataset when `__getitem__` is passed an Iterable like `_copy_listed`?,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,588112617 https://github.com/pydata/xarray/issues/3894#issuecomment-604506561,https://api.github.com/repos/pydata/xarray/issues/3894,604506561,MDEyOklzc3VlQ29tbWVudDYwNDUwNjU2MQ==,5635139,2020-03-26T15:46:05Z,2020-03-26T15:46:05Z,MEMBER,"Would that be different from ensuring the input is a list? > Moreover, because `Dataset__getitem__` is type unstable, I very much empathize with the pain from methods being type unstable; indeed I think that's one of the biggest benefits of xarray over pandas. Here, it's stable _over the same typed inputs_. i.e. if supplied with a list, it returns with a dataset, otherwise it returns a DataArray. (or am I missing something?) > it makes it hard to detect this kind of error using mypy Is there a way in mypy we could use something like `overload` to specify the above contract here, as an alternative to another method?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,588112617