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/3298#issuecomment-531540757,https://api.github.com/repos/pydata/xarray/issues/3298,531540757,MDEyOklzc3VlQ29tbWVudDUzMTU0MDc1Nw==,2443309,2019-09-15T07:05:58Z,2019-09-15T07:05:58Z,MEMBER,@DangoMelon - thanks for your contribution. This will get used a lot! ,"{""total_count"": 2, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 2, ""rocket"": 0, ""eyes"": 0}",,491324262 https://github.com/pydata/xarray/pull/3298#issuecomment-531516313,https://api.github.com/repos/pydata/xarray/issues/3298,531516313,MDEyOklzc3VlQ29tbWVudDUzMTUxNjMxMw==,1217238,2019-09-14T21:46:22Z,2019-09-14T21:46:22Z,MEMBER,thanks @DangoMelon !,"{""total_count"": 2, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 2, ""rocket"": 0, ""eyes"": 0}",,491324262 https://github.com/pydata/xarray/pull/3298#issuecomment-531514808,https://api.github.com/repos/pydata/xarray/issues/3298,531514808,MDEyOklzc3VlQ29tbWVudDUzMTUxNDgwOA==,23618263,2019-09-14T21:18:35Z,2019-09-14T21:18:35Z,CONTRIBUTOR,"@shoyer I hope it's much clear now, I tried to phrase what you suggested. @max-sixty That did the trick! Thank you both for your suggestions.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,491324262 https://github.com/pydata/xarray/pull/3298#issuecomment-531478548,https://api.github.com/repos/pydata/xarray/issues/3298,531478548,MDEyOklzc3VlQ29tbWVudDUzMTQ3ODU0OA==,5635139,2019-09-14T13:08:45Z,2019-09-14T13:08:45Z,MEMBER,"Here's a solution to the mypy issue: ```diff diff --git a/xarray/core/dataset.py b/xarray/core/dataset.py index 1d762114..ee4ebf4d 100644 --- a/xarray/core/dataset.py +++ b/xarray/core/dataset.py @@ -2046,8 +2046,8 @@ class Dataset(Mapping, ImplementsDatasetReduce, DataWithCoords): raise TypeError(""indexer value must be an integer"") elif v < 0: raise ValueError(""indexer value must be positive"") - indexers = {k: slice(val) for k, val in indexers.items()} - return self.isel(indexers) + indexers_slices = {k: slice(val) for k, val in indexers.items()} + return self.isel(indexers_slices) def tail( self, @@ -2087,11 +2087,11 @@ class Dataset(Mapping, ImplementsDatasetReduce, DataWithCoords): raise TypeError(""indexer value must be an integer"") elif v < 0: raise ValueError(""indexer value must be positive"") - indexers = { + indexers_slices = { k: slice(-val, None) if val != 0 else slice(val) for k, val in indexers.items() } - return self.isel(indexers) + return self.isel(indexers_slices) def thin( self, @@ -2134,8 +2134,8 @@ class Dataset(Mapping, ImplementsDatasetReduce, DataWithCoords): raise ValueError(""indexer value must be positive"") elif v == 0: raise ValueError(""step cannot be zero"") - indexers = {k: slice(None, None, val) for k, val in indexers.items()} - return self.isel(indexers) + indexers_slices = {k: slice(None, None, val) for k, val in indexers.items()} + return self.isel(indexers_slices) def broadcast_like( self, other: Union[""Dataset"", ""DataArray""], exclude: Iterable[Hashable] = None ```","{""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,491324262 https://github.com/pydata/xarray/pull/3298#issuecomment-531452036,https://api.github.com/repos/pydata/xarray/issues/3298,531452036,MDEyOklzc3VlQ29tbWVudDUzMTQ1MjAzNg==,1217238,2019-09-14T05:46:45Z,2019-09-14T05:46:45Z,MEMBER,"I would try to include value in the message, too, which can often be a useful hint about what went wrong, e.g., “expected positive integer for dimension ‘x’, got -1” On Fri, Sep 13, 2019 at 8:56 PM Gerardo Rivera wrote: > *@DangoMelon* commented on this pull request. > ------------------------------ > > In xarray/core/dataset.py > : > > > indexers = either_dict_or_kwargs(indexers, indexers_kwargs, ""head"") > + for v in indexers.values(): > + if not isinstance(v, int): > + raise TypeError(""indexer value must be an integer"") > + elif v < 0: > + raise ValueError(""indexer value must be positive"") > > Hmmm, Something along these lines maybe? > > ""expected integer as indexer value, found type %r for dim %r"" % (type(v), k) > > and > > ""expected positive integer as indexer value for dim %r"" % k > > The k and v come from iterating over indexers.items() > > — > You are receiving this because you commented. > Reply to this email directly, view it on GitHub > , > or mute the thread > > . > ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,491324262 https://github.com/pydata/xarray/pull/3298#issuecomment-531445217,https://api.github.com/repos/pydata/xarray/issues/3298,531445217,MDEyOklzc3VlQ29tbWVudDUzMTQ0NTIxNw==,23618263,2019-09-14T03:44:34Z,2019-09-14T03:44:34Z,CONTRIBUTOR,"> > > Any other feedback before we merge? (Errors are unrelated) @max-sixty I think the typing errors are due to changing the `Any` to `int` and actually finding `slice`.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,491324262 https://github.com/pydata/xarray/pull/3298#issuecomment-531036946,https://api.github.com/repos/pydata/xarray/issues/3298,531036946,MDEyOklzc3VlQ29tbWVudDUzMTAzNjk0Ng==,5635139,2019-09-12T22:53:36Z,2019-09-12T22:53:36Z,MEMBER,Any other feedback before we merge? (Errors are unrelated),"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,491324262