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/3706#issuecomment-590105084,https://api.github.com/repos/pydata/xarray/issues/3706,590105084,MDEyOklzc3VlQ29tbWVudDU5MDEwNTA4NA==,2448579,2020-02-23T19:13:03Z,2020-02-23T19:13:03Z,MEMBER,Test failures look unrelated. Thanks @keewis ,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,551680561
https://github.com/pydata/xarray/pull/3706#issuecomment-590083269,https://api.github.com/repos/pydata/xarray/issues/3706,590083269,MDEyOklzc3VlQ29tbWVudDU5MDA4MzI2OQ==,14808389,2020-02-23T15:55:31Z,2020-02-23T15:55:31Z,MEMBER,"@shoyer, I added the notes
@max-sixty, @jthielen: the `identical` tests will be skipped for now. At the moment that does not make any difference since `identical` is the same as `equals` with additionally checking the attributes (any changes to it are not limited to `pint`, so I guess we should open a new issue for discussion).","{""total_count"": 2, ""+1"": 2, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,551680561
https://github.com/pydata/xarray/pull/3706#issuecomment-589874060,https://api.github.com/repos/pydata/xarray/issues/3706,589874060,MDEyOklzc3VlQ29tbWVudDU4OTg3NDA2MA==,5635139,2020-02-21T23:05:37Z,2020-02-21T23:05:37Z,MEMBER,"> Although, I had interpreted @max-sixty's comment [#3238 (comment)](https://github.com/pydata/xarray/pull/3238#issuecomment-533181017) to mean that dtypes are compared, it appears from @shoyer's comment [#3706 (comment)](https://github.com/pydata/xarray/pull/3706#issuecomment-583259053) that this not the case.
I was wrong; I should have at least realized I didn't know. Apologies if that caused wasted time @jthielen
Separately: should `assert_identical` assert that the dtypes are the same? I'd have thought there should be some way of testing whether dtypes are consistent with expectations, and I'd have thought `assert_identical` would be it? ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,551680561
https://github.com/pydata/xarray/pull/3706#issuecomment-589862431,https://api.github.com/repos/pydata/xarray/issues/3706,589862431,MDEyOklzc3VlQ29tbWVudDU4OTg2MjQzMQ==,1217238,2020-02-21T22:23:31Z,2020-02-21T22:23:31Z,MEMBER,"> Also, concerning the commutative operations: should we wait for [hgrecco/pint#1019](https://github.com/hgrecco/pint/issues/1019) and remove the flipped parameters or should we merge as is and possibly revert once `pint` implements a type casting hierarchy?
I don't anticipate any performance cost to this, just a small decrease in readability. So I think this is fine to merge for now with comments in the relevant sections and we can revert it later. My only suggestion is to add a note like `TODO: revert after https://github.com/hgrecco/pint/issues/1019 is fixed` to each comment.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,551680561
https://github.com/pydata/xarray/pull/3706#issuecomment-588356641,https://api.github.com/repos/pydata/xarray/issues/3706,588356641,MDEyOklzc3VlQ29tbWVudDU4ODM1NjY0MQ==,14808389,2020-02-19T17:56:09Z,2020-02-19T17:56:09Z,MEMBER,"> If strict unit checking is required, I think that may be better served by an additional `assert unit == ""meter""` type statement.
which is what I've been doing with `assert_units_equal`. I'll change the tests for `identical`, then.
Also, concerning the commutative operations: should we wait for hgrecco/pint#1019 and remove the flipped parameters or should we merge as is and possibly revert once `pint` implements a type casting hierarchy?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,551680561
https://github.com/pydata/xarray/pull/3706#issuecomment-583349241,https://api.github.com/repos/pydata/xarray/issues/3706,583349241,MDEyOklzc3VlQ29tbWVudDU4MzM0OTI0MQ==,14808389,2020-02-07T11:21:55Z,2020-02-07T11:21:55Z,MEMBER,"when writing the unit tests, we decided the definition of `equals` to be different from `identical` (see https://github.com/pydata/xarray/pull/3238#issuecomment-533145925 and https://github.com/pydata/xarray/pull/3238#issuecomment-533181017) which would be consistent with the behaviour of `identical` when a `""units""` attribute is set.
As far as I know there was no real use case (except from being able to use `assert_identical` in the unit tests), so we can change that.
cc @jthielen","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,551680561
https://github.com/pydata/xarray/pull/3706#issuecomment-583259053,https://api.github.com/repos/pydata/xarray/issues/3706,583259053,MDEyOklzc3VlQ29tbWVudDU4MzI1OTA1Mw==,1217238,2020-02-07T06:52:26Z,2020-02-07T06:52:26Z,MEMBER,"Thanks for pinging me again here (I get a lot of GitHub notifications). `identical` is an interesting case!
I think the current behavior (1 meter is identical to 100 centimeters) is arguably consistent with how `identical` currently works, which only check equality between array elements.
Right now, `identical` considers numbers of different data types equal, e.g., int `1` is identical to float 1.0``. I think units arguably have a similar to role to data types -- hopefully eventually libraries like `pint` could be implemented via custom NumPy dtypes, rather than needing to reimplement all of NumPy.
Did this come up in the context of some other downstream use-case, or is this just something that occurred to you for the sake of consistency?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,551680561
https://github.com/pydata/xarray/pull/3706#issuecomment-582530089,https://api.github.com/repos/pydata/xarray/issues/3706,582530089,MDEyOklzc3VlQ29tbWVudDU4MjUzMDA4OQ==,14808389,2020-02-05T17:51:03Z,2020-02-05T23:39:46Z,MEMBER,"it should be ready now
Edit: the failures are unrelated (#3751)
Edit2: the documentation of this change does not exist, yet. It will be added in a new PR and is a task in #3594","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,551680561
https://github.com/pydata/xarray/pull/3706#issuecomment-582492045,https://api.github.com/repos/pydata/xarray/issues/3706,582492045,MDEyOklzc3VlQ29tbWVudDU4MjQ5MjA0NQ==,14808389,2020-02-05T16:29:32Z,2020-02-05T16:29:32Z,MEMBER,this should be ready for review and merge once the tests pass.,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,551680561
https://github.com/pydata/xarray/pull/3706#issuecomment-582476396,https://api.github.com/repos/pydata/xarray/issues/3706,582476396,MDEyOklzc3VlQ29tbWVudDU4MjQ3NjM5Ng==,2448579,2020-02-05T15:57:10Z,2020-02-05T15:57:10Z,MEMBER,"> let's mark these tests as xfail and discuss this in their own issues / PRs.
:+1: to smaller PRs!","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,551680561
https://github.com/pydata/xarray/pull/3706#issuecomment-582444857,https://api.github.com/repos/pydata/xarray/issues/3706,582444857,MDEyOklzc3VlQ29tbWVudDU4MjQ0NDg1Nw==,14808389,2020-02-05T14:53:09Z,2020-02-05T14:53:09Z,MEMBER,"these issues (`rolling_window` and `identical`) seem too big to discuss here, so in order to keep moving forward let's mark these tests as xfail and discuss this in their own issues / PRs.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,551680561
https://github.com/pydata/xarray/pull/3706#issuecomment-581160780,https://api.github.com/repos/pydata/xarray/issues/3706,581160780,MDEyOklzc3VlQ29tbWVudDU4MTE2MDc4MA==,14808389,2020-02-02T18:03:50Z,2020-02-02T18:03:50Z,MEMBER,"gentle ping, @shoyer","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,551680561
https://github.com/pydata/xarray/pull/3706#issuecomment-578178685,https://api.github.com/repos/pydata/xarray/issues/3706,578178685,MDEyOklzc3VlQ29tbWVudDU3ODE3ODY4NQ==,2448579,2020-01-24T15:31:32Z,2020-01-24T15:31:32Z,MEMBER,OK let's see what @shoyer thinks,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,551680561
https://github.com/pydata/xarray/pull/3706#issuecomment-578143916,https://api.github.com/repos/pydata/xarray/issues/3706,578143916,MDEyOklzc3VlQ29tbWVudDU3ODE0MzkxNg==,14808389,2020-01-24T14:07:08Z,2020-01-24T14:07:08Z,MEMBER,"> I think a separate `units_equiv` function may be cleaner?
I agree. However, I'm reluctant to add that function since that would be the first `pint` dependent code we have except from the unit tests (but do tell me if that's not an issue).
I'm inclined to provide some kind of hook for wrapped libraries instead (allow them to define a method like `metadata_identical` or something that does the check for us) so the code in `identical` would become something like
```python
def metadata_identical(arr1, arr2):
if hasattr(arr1, ""metadata_identical""):
return arr1.metadata_identical(arr2)
elif hasattr(arr2, ""metadata_identical""):
return arr2.metadata_identical(arr1)
else:
return True
return (
self.dims == other.dims
and (self._data is other._data or equiv(self.data, other.data))
and metadata_identical(self.data, other.data)
)
```
> Note that we explicitly use `lazy_array_equiv` in `concat` so it'd be nice to have something that could be easily used there too
I don't think that's a problem since what calls `lazy_array_equiv` is `Variable.identical` and if `identical` works correctly this should, too.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,551680561
https://github.com/pydata/xarray/pull/3706#issuecomment-577977929,https://api.github.com/repos/pydata/xarray/issues/3706,577977929,MDEyOklzc3VlQ29tbWVudDU3Nzk3NzkyOQ==,2448579,2020-01-24T03:34:04Z,2020-01-24T03:34:04Z,MEMBER,"I guess we need to either pass a kwarg regarding checking units/dimensionality down to `lazy_array_equiv` or add a `units_equiv(only_dimensionality=True/False)` check to https://github.com/pydata/xarray/blob/6d1434e9b9e9766d6fcafceb05e81734b29994ea/xarray/core/variable.py#L1645-L1648
I think a separate `units_equiv` function may be cleaner?
Note that we explicitly use `lazy_array_equiv` in `concat` so it'd be nice to have something that could be easily used there too:
https://github.com/pydata/xarray/blob/6d1434e9b9e9766d6fcafceb05e81734b29994ea/xarray/core/concat.py#L194-L208","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,551680561
https://github.com/pydata/xarray/pull/3706#issuecomment-577922953,https://api.github.com/repos/pydata/xarray/issues/3706,577922953,MDEyOklzc3VlQ29tbWVudDU3NzkyMjk1Mw==,14808389,2020-01-23T23:19:20Z,2020-01-23T23:19:20Z,MEMBER,"hrmm... I had investigated this before and thought I remembered correctly. I can't put it in `lazy_array_equiv`, though, since `array_equiv` is also used by `equals` (which should not check the units, only the dimensionality)","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,551680561
https://github.com/pydata/xarray/pull/3706#issuecomment-577894139,https://api.github.com/repos/pydata/xarray/issues/3706,577894139,MDEyOklzc3VlQ29tbWVudDU3Nzg5NDEzOQ==,2448579,2020-01-23T21:51:52Z,2020-01-23T21:51:52Z,MEMBER,"> re rolling_window: should I leave it as xfail for now?
Fine by me. :)","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,551680561
https://github.com/pydata/xarray/pull/3706#issuecomment-577894064,https://api.github.com/repos/pydata/xarray/issues/3706,577894064,MDEyOklzc3VlQ29tbWVudDU3Nzg5NDA2NA==,2448579,2020-01-23T21:51:39Z,2020-01-23T21:51:39Z,MEMBER,"`array_equiv` calls `lazy_array_equiv` before doing much else:
https://github.com/pydata/xarray/blob/6d1434e9b9e9766d6fcafceb05e81734b29994ea/xarray/core/duck_array_ops.py#L215-L227","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,551680561
https://github.com/pydata/xarray/pull/3706#issuecomment-577890246,https://api.github.com/repos/pydata/xarray/issues/3706,577890246,MDEyOklzc3VlQ29tbWVudDU3Nzg5MDI0Ng==,14808389,2020-01-23T21:41:50Z,2020-01-23T21:41:50Z,MEMBER,"> I think your `units_equiv` thing could go in `duck_array_ops.lazy_array_equiv`
that could work for `Dataset.identical` but not `Variable.identical`, which I believe by default directly calls `array_equiv`
re `rolling_window`: should I leave it as `xfail` for now?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,551680561
https://github.com/pydata/xarray/pull/3706#issuecomment-577885631,https://api.github.com/repos/pydata/xarray/issues/3706,577885631,MDEyOklzc3VlQ29tbWVudDU3Nzg4NTYzMQ==,2448579,2020-01-23T21:29:14Z,2020-01-23T21:29:14Z,MEMBER,"I think your `units_equiv` thing could go in `duck_array_ops.lazy_array_equiv` which tries to check everything but the actual values themselves.
> but I don't know how to fix that unless we rewrite _rolling_window or dispatch differently in rolling_window.
This may be necessary but perhaps not the most important thing right now?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,551680561
https://github.com/pydata/xarray/pull/3706#issuecomment-577832822,https://api.github.com/repos/pydata/xarray/issues/3706,577832822,MDEyOklzc3VlQ29tbWVudDU3NzgzMjgyMg==,14808389,2020-01-23T19:18:38Z,2020-01-23T19:18:38Z,MEMBER,"the easiest way to fix `identical` would be to pass a `equiv` function that forwards to `duck_array_ops.array_equiv` but also checks the units:
```python
def units_equiv(a, b):
if hasattr(a, ""units"") or hasattr(b, ""units""):
units_a = getattr(a, ""units"", None)
units_b = getattr(b, ""units"", None)
registry = getattr(units_a, ""_REGISTRY"", None) or getattr(b, ""_REGISTRY"", None)
units_a = units_a or registry.dimensionless
units_b = units_b or registry.dimensionless
return units_a == units_b
else:
# no units at all
return True
def equiv_with_units(a, b):
return duck_array_ops.array_equiv(a, b) and units_equiv(a, b)
```
However, I'm out of ideas on how to automatically use that (I'd like to avoid having to call `a.identical(b, equiv=equiv_with_units)`).
---
There is also `rolling_window` that strips the units due to calling `numpy.lib.stride_tricks.as_strided`, but I don't know how to fix that unless we rewrite `_rolling_window` or dispatch differently in `rolling_window`.
There seems to have been some work to add a function named `numpy.rolling_window` or `numpy.sliding_window` that could then be overridden by `pint`, but I think that effort has stalled?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,551680561
https://github.com/pydata/xarray/pull/3706#issuecomment-576078008,https://api.github.com/repos/pydata/xarray/issues/3706,576078008,MDEyOklzc3VlQ29tbWVudDU3NjA3ODAwOA==,14808389,2020-01-20T02:05:56Z,2020-01-20T17:12:38Z,MEMBER,"I'm not sure why, but `dask==1.2` fails where later versions work:
```pytb
ValueError: operands could not be broadcast together with shapes (2,0) (2,2)
```
Edit: Seems we can just bump `dask` to `dask==2.1` or `dask==2.2` and not worry about this. I'd wait on #3660 with this.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,551680561
https://github.com/pydata/xarray/pull/3706#issuecomment-576057519,https://api.github.com/repos/pydata/xarray/issues/3706,576057519,MDEyOklzc3VlQ29tbWVudDU3NjA1NzUxOQ==,14808389,2020-01-19T23:02:40Z,2020-01-20T00:41:37Z,MEMBER,"I fixed the tests that were easier, but I have no idea about `rolling_window` / `as_strided` because I don't understand how it works, and `identical` would be easy to fix if we special-cased `pint`, but I'd like to avoid that
Edit: seems there are some issues with `np.pad` support in `dask==1.2`: `__array_function__` support is probably only in later versions so we'd need to use `da.pad` instead, but that raises an error, too.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,551680561