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/5365#issuecomment-1002535641,https://api.github.com/repos/pydata/xarray/issues/5365,1002535641,IC_kwDOAMm_X847wXrZ,5635139,2021-12-29T10:55:46Z,2021-12-29T10:55:46Z,MEMBER,Congrats @Illviljan ! ,"{""total_count"": 1, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 1, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,899015876 https://github.com/pydata/xarray/pull/5365#issuecomment-1001267972,https://api.github.com/repos/pydata/xarray/issues/5365,1001267972,IC_kwDOAMm_X847riME,5635139,2021-12-27T00:48:40Z,2021-12-27T00:48:40Z,MEMBER,@Illviljan I hadn't seen this is still open! Definitely merge!,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,899015876 https://github.com/pydata/xarray/pull/5365#issuecomment-886241990,https://api.github.com/repos/pydata/xarray/issues/5365,886241990,IC_kwDOAMm_X8400vrG,5635139,2021-07-25T18:44:38Z,2021-07-25T18:44:38Z,MEMBER,"@Illviljan if you can resolve the merge conflict, we can merge this!","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,899015876 https://github.com/pydata/xarray/pull/5365#issuecomment-875727181,https://api.github.com/repos/pydata/xarray/issues/5365,875727181,MDEyOklzc3VlQ29tbWVudDg3NTcyNzE4MQ==,5635139,2021-07-07T16:00:46Z,2021-07-07T16:01:08Z,MEMBER,"As discussed with @keewis and the team, we'll merge this after the next point release which fixes a small pandas compatibility issue.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,899015876 https://github.com/pydata/xarray/pull/5365#issuecomment-873293132,https://api.github.com/repos/pydata/xarray/issues/5365,873293132,MDEyOklzc3VlQ29tbWVudDg3MzI5MzEzMg==,5635139,2021-07-02T22:56:11Z,2021-07-02T22:56:11Z,MEMBER,"I've been following this and think it looks good. There's some complication because of the need to handle different dims, but holding the requirements constant I think this is great. Any thoughts from others?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,899015876 https://github.com/pydata/xarray/pull/5365#issuecomment-864599902,https://api.github.com/repos/pydata/xarray/issues/5365,864599902,MDEyOklzc3VlQ29tbWVudDg2NDU5OTkwMg==,5635139,2021-06-20T19:19:30Z,2021-06-20T19:19:30Z,MEMBER,"> So why not force integers to begin with? I agree! Good change!","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,899015876 https://github.com/pydata/xarray/pull/5365#issuecomment-864596132,https://api.github.com/repos/pydata/xarray/issues/5365,864596132,MDEyOklzc3VlQ29tbWVudDg2NDU5NjEzMg==,5635139,2021-06-20T18:48:21Z,2021-06-20T18:48:21Z,MEMBER," > Empty coords is False as well, that's the trick here: Ah good point. I guess we could either unroll that into two `or` checks so mypy understands, or give mypy a hint, or add ignores to the typing ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,899015876 https://github.com/pydata/xarray/pull/5365#issuecomment-864465814,https://api.github.com/repos/pydata/xarray/issues/5365,864465814,MDEyOklzc3VlQ29tbWVudDg2NDQ2NTgxNA==,5635139,2021-06-19T21:26:50Z,2021-06-19T21:26:50Z,MEMBER,"> > > It's true that Variable doesn't have it. But a Variable can't use that code path since we check `getattr(array_large, ""coords"", False)`. > > > > > > Ah, then we can tell mypy this, I think just by switching to `isinstance(array_large, Variable)` > > (and in case it wasn't clear, it's also OK to skip some of these or leave them to another PR. They can be useful checks for things we miss, but we shouldn't be beholden to the linting) > > The check can't be that simple though because DataArrays doesn't always include `coords` and then it doesn't make sense to use `reindex_like`. I suppose adding a `hasattr(array_large, ""reindex_like"")` is an option, but it feels redundant to me. `getattr(array_large, ""coords"", False)` will always pass for DataArrays — even if there are no coords, it's checking whether there's a coords method on the class — which in the case of a DataArray with no coords, would return empty (but still return). Or am I misunderstanding?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,899015876 https://github.com/pydata/xarray/pull/5365#issuecomment-864436695,https://api.github.com/repos/pydata/xarray/issues/5365,864436695,MDEyOklzc3VlQ29tbWVudDg2NDQzNjY5NQ==,5635139,2021-06-19T17:02:44Z,2021-06-19T17:02:44Z,MEMBER,"> It's true that Variable doesn't have it. But a Variable can't use that code path since we check `getattr(array_large, ""coords"", False)`. Ah, then we can tell mypy this, I think just by switching to `isinstance(array_large, Variable)` (and in case it wasn't clear, it's also OK to skip some of these or leave them to another PR. They can be useful checks for things we miss, but we shouldn't be beholden to the linting)","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,899015876 https://github.com/pydata/xarray/pull/5365#issuecomment-864218801,https://api.github.com/repos/pydata/xarray/issues/5365,864218801,MDEyOklzc3VlQ29tbWVudDg2NDIxODgwMQ==,5635139,2021-06-18T18:53:08Z,2021-06-18T18:53:40Z,MEMBER,"Sorry, I've been away for a bit. Hmmm, I'm not sure. One is simple: ```diff diff --git a/xarray/core/computation.py b/xarray/core/computation.py index af2c37db..5a839c19 100644 --- a/xarray/core/computation.py +++ b/xarray/core/computation.py @@ -1400,7 +1400,7 @@ def _get_valid_values(da, other): def cross( a: ""T_DSorDAorVar"", b: ""T_DSorDAorVar"", - dim: str, + dim: Hashable, ) -> ""T_DSorDAorVar"": """""" Return the cross product of two (arrays of) vectors. ``` But that leaves lots of others! I'll have to come back to this, or if others have ideas, gratefully received. Some quick thoughts of mediocre helpfulness: ``` xarray/core/computation.py:1576: error: Dict entry 0 has incompatible type ""Hashable"": ""int""; expected ""Hashable"": ""Union[None, Number, str, Tuple[Number, ...]]"" [dict-item] xarray/core/computation.py:1576: error: Dict entry 0 has incompatible type ""Hashable"": ""int""; expected ""Hashable"": ""Union[None, Number, Tuple[Number, ...]]"" [dict-item] xarray/core/computation.py:1536: error: Dict entry 0 has incompatible type ""Hashable"": ""int""; expected ""Hashable"": ""Union[None, Number, str, Tuple[Number, ...]]"" [dict-item] ``` I don't get how `Hashable: int` isn't compatible with `Hashable: Number`?? ``` xarray/core/computation.py:1533: error: Argument ""sample_dims"" to ""to_stacked_array"" of ""Dataset"" has incompatible type ""Mapping[Hashable, int]""; expected ""Mapping[Hashable, Sequence[Hashable]]"" [arg-type] ``` Does this refer to Dataset.dims and DataArray.dims having different types, and that we may want to use `sizes` or coerce the `.dims` to a list? ``` xarray/core/computation.py:1570: error: ""Variable"" has no attribute ""reindex_like"" [attr-defined] ``` Is this legit — does it work with Variables? ``` xarray/core/computation.py:1532: error: No overload variant of ""__setitem__"" of ""list"" matches argument types ""int"", ""DataArray"" [call-overload] xarray/core/computation.py:1532: note: Possible overload variants: xarray/core/computation.py:1532: note: def __setitem__(self, int, Dataset) -> None xarray/core/computation.py:1532: note: def __setitem__(self, slice, Iterable[Dataset]) -> None xarray/core/computation.py:1532: error: Incompatible types in assignment (expression has type ""DataArray"", variable has type ""Dataset"") [assignment] ``` I'm not even sure where are these variants are? Is it referring to the `Dataset.__setitem__`? Surely that accepts `DataArrays`? --- ...and ironically these show up in the simpler area of the code rather than the complicated part that allows for passing 2 or 3 sized dims! Found 7 errors in 1 file (checked 142 source files)","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,899015876 https://github.com/pydata/xarray/pull/5365#issuecomment-855425484,https://api.github.com/repos/pydata/xarray/issues/5365,855425484,MDEyOklzc3VlQ29tbWVudDg1NTQyNTQ4NA==,5635139,2021-06-06T16:32:07Z,2021-06-06T16:32:07Z,MEMBER,"That's annoying, sorry @Illviljan . Re the failure, issue added here: https://github.com/pydata/xarray/issues/5444. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,899015876 https://github.com/pydata/xarray/pull/5365#issuecomment-854992489,https://api.github.com/repos/pydata/xarray/issues/5365,854992489,MDEyOklzc3VlQ29tbWVudDg1NDk5MjQ4OQ==,5635139,2021-06-04T20:54:11Z,2021-06-04T20:54:11Z,MEMBER,This is looking excellent @Illviljan ! Let us know when it's ready for a final review / merge,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,899015876 https://github.com/pydata/xarray/pull/5365#issuecomment-850577500,https://api.github.com/repos/pydata/xarray/issues/5365,850577500,MDEyOklzc3VlQ29tbWVudDg1MDU3NzUwMA==,5635139,2021-05-28T17:53:50Z,2021-05-28T17:53:50Z,MEMBER,"This looks really good, very nice code @Illviljan . I admittedly haven't thought exhaustively through whether we're missing anything. But the tests are great. FWIW the numpy API is not simple — the ""length 2 or 3"" seems to contribute more complication than value. If anyone thinks that we should instead enforce length 3, I would support that; but otherwise defaulting to the numpy API is good.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,899015876