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/5571#issuecomment-873461305,https://api.github.com/repos/pydata/xarray/issues/5571,873461305,MDEyOklzc3VlQ29tbWVudDg3MzQ2MTMwNQ==,41898282,2021-07-03T19:50:27Z,2021-09-30T22:13:25Z,CONTRIBUTOR,"## Unit Test Results          6 files  ±0           6 suites  ±0   56m 27s [:stopwatch:](https://github.com/EnricoMi/publish-unit-test-result-action/blob/v1.20/README.md#the-symbols ""duration of all tests"") ±0s 16 228 tests ±0  14 493 [:heavy_check_mark:](https://github.com/EnricoMi/publish-unit-test-result-action/blob/v1.20/README.md#the-symbols ""passed tests"") ±0  1 735 [:zzz:](https://github.com/EnricoMi/publish-unit-test-result-action/blob/v1.20/README.md#the-symbols ""skipped / disabled tests"") ±0  0 [:x:](https://github.com/EnricoMi/publish-unit-test-result-action/blob/v1.20/README.md#the-symbols ""failed tests"") ±0  90 564 runs  ±0  82 384 [:heavy_check_mark:](https://github.com/EnricoMi/publish-unit-test-result-action/blob/v1.20/README.md#the-symbols ""passed tests"") ±0  8 180 [:zzz:](https://github.com/EnricoMi/publish-unit-test-result-action/blob/v1.20/README.md#the-symbols ""skipped / disabled tests"") ±0  0 [:x:](https://github.com/EnricoMi/publish-unit-test-result-action/blob/v1.20/README.md#the-symbols ""failed tests"") ±0  Results for commit ebfc6a3d. ± Comparison against base commit ebfc6a3d. :recycle: This comment has been updated with latest results.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,936313924 https://github.com/pydata/xarray/pull/5571#issuecomment-931724589,https://api.github.com/repos/pydata/xarray/issues/5571,931724589,IC_kwDOAMm_X843iP0t,35968931,2021-09-30T21:39:32Z,2021-09-30T21:39:32Z,MEMBER,The what's new entry for this went in under the wrong edition - I fixed it in https://github.com/pydata/xarray/commit/ebfc6a3db0580cc11418e906766805ff4bf36455,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,936313924 https://github.com/pydata/xarray/pull/5571#issuecomment-930405466,https://api.github.com/repos/pydata/xarray/issues/5571,930405466,IC_kwDOAMm_X843dNxa,35968931,2021-09-29T17:48:31Z,2021-09-29T17:48:31Z,MEMBER,Thanks for the reminder @dcherian - I merged main and all the tests pass so I'll merge this PR now!,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,936313924 https://github.com/pydata/xarray/pull/5571#issuecomment-873458374,https://api.github.com/repos/pydata/xarray/issues/5571,873458374,MDEyOklzc3VlQ29tbWVudDg3MzQ1ODM3NA==,24736507,2021-07-03T19:24:40Z,2021-09-29T17:13:58Z,NONE,"Hello @TomNicholas! Thanks for updating this PR. We checked the lines you've touched for [PEP 8](https://www.python.org/dev/peps/pep-0008) issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! :beers: ##### Comment last updated at 2021-09-29 17:13:58 UTC","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,936313924 https://github.com/pydata/xarray/pull/5571#issuecomment-907489614,https://api.github.com/repos/pydata/xarray/issues/5571,907489614,IC_kwDOAMm_X842FzFO,35968931,2021-08-27T21:36:48Z,2021-08-27T21:36:48Z,MEMBER,Doctests passed! Thanks so much @Illviljan !,"{""total_count"": 1, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 1, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,936313924 https://github.com/pydata/xarray/pull/5571#issuecomment-907414746,https://api.github.com/repos/pydata/xarray/issues/5571,907414746,IC_kwDOAMm_X842Fgza,14371165,2021-08-27T19:08:38Z,2021-08-27T19:15:38Z,MEMBER,"I don't understand why doctests doesn't go through the if path, is it using tricks that can make `around.__doc__ == None`? Anyway I think just ignoring these typing errors might be easier. Readthedocs error: ``` -------- /home/docs/checkouts/readthedocs.org/user_builds/xray/checkouts/5571/xarray/core/_typed_ops.py:docstring of xarray.core._typed_ops.DataArrayOpsMixin.round:65: WARNING: Explicit markup ends without a blank line; unexpected unindent. /home/docs/checkouts/readthedocs.org/user_builds/xray/checkouts/5571/xarray/core/_typed_ops.py:docstring of xarray.core._typed_ops.DataArrayOpsMixin.round:65: WARNING: Unexpected section title or transition. ``` ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,936313924 https://github.com/pydata/xarray/pull/5571#issuecomment-907395913,https://api.github.com/repos/pydata/xarray/issues/5571,907395913,IC_kwDOAMm_X842FcNJ,14371165,2021-08-27T18:34:42Z,2021-08-27T18:34:42Z,MEMBER,I must say it gets kind of annoying having so pedantic doctests and doc generation when upstream modules aren't as picky.,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,936313924 https://github.com/pydata/xarray/pull/5571#issuecomment-907366817,https://api.github.com/repos/pydata/xarray/issues/5571,907366817,IC_kwDOAMm_X842FVGh,2448579,2021-08-27T17:42:32Z,2021-08-27T17:42:32Z,MEMBER,Thanks @Illviljan ,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,936313924 https://github.com/pydata/xarray/pull/5571#issuecomment-906634816,https://api.github.com/repos/pydata/xarray/issues/5571,906634816,IC_kwDOAMm_X842CiZA,14371165,2021-08-26T18:16:51Z,2021-08-27T16:56:35Z,MEMBER,"Seems to be a problem in numpy `np.around` fails the doctest, see https://github.com/numpy/numpy/issues/19759. I wonder if the docstring can be ignored if it is copied from somewhere else? I think an easy workaround is simply replacing the docstring: https://github.com/pydata/xarray/blob/4fd81b51101aceaad08570f1368ad4b50a946da5/xarray/core/duck_array_ops.py#L75
```python around = _dask_or_eager_func(""around"") # np.around has failing doctests, overwrite it so they pass: around.__doc__ = """""" Evenly round to the given number of decimals. Parameters ---------- a : array_like Input data. decimals : int, optional Number of decimal places to round to (default: 0). If decimals is negative, it specifies the number of positions to the left of the decimal point. out : ndarray, optional Alternative output array in which to place the result. It must have the same shape as the expected output, but the type of the output values will be cast if necessary. See :ref:`ufuncs-output-type` for more details. Returns ------- rounded_array : ndarray An array of the same type as `a`, containing the rounded values. Unless `out` was specified, a new array is created. A reference to the result is returned. The real and imaginary parts of complex numbers are rounded separately. The result of rounding a float is a float. See Also -------- ndarray.round : equivalent method ceil, fix, floor, rint, trunc Notes ----- For values exactly halfway between rounded decimal values, NumPy rounds to the nearest even value. Thus 1.5 and 2.5 round to 2.0, -0.5 and 0.5 round to 0.0, etc. ``np.around`` uses a fast but sometimes inexact algorithm to round floating-point datatypes. For positive `decimals` it is equivalent to ``np.true_divide(np.rint(a * 10**decimals), 10**decimals)``, which has error due to the inexact representation of decimal fractions in the IEEE floating point standard [1]_ and errors introduced when scaling by powers of ten. For instance, note the extra ""1"" in the following: >>> np.round(56294995342131.5, 3) 56294995342131.51 If your goal is to print such values with a fixed number of decimals, it is preferable to use numpy's float printing routines to limit the number of printed decimals: >>> np.format_float_positional(56294995342131.5, precision=3) '56294995342131.5' The float printing routines use an accurate but much more computationally demanding algorithm to compute the number of digits after the decimal point. Alternatively, Python's builtin `round` function uses a more accurate but slower algorithm for 64-bit floating point values: >>> round(56294995342131.5, 3) 56294995342131.5 >>> np.round(16.055, 2), round(16.055, 2) # equals 16.0549999999999997 (16.06, 16.05) References ---------- .. [1] ""Lecture Notes on the Status of IEEE 754"", William Kahan, https://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF .. [2] ""How Futile are Mindless Assessments of Roundoff in Floating-Point Computation?"", William Kahan, https://people.eecs.berkeley.edu/~wkahan/Mindless.pdf Examples -------- >>> np.around([0.37, 1.64]) array([0., 2.]) >>> np.around([0.37, 1.64], decimals=1) array([0.4, 1.6]) >>> np.around([.5, 1.5, 2.5, 3.5, 4.5]) # rounds to nearest even value array([0., 2., 2., 4., 4.]) >>> np.around([1,2,3,11], decimals=1) # ndarray of ints is returned array([ 1, 2, 3, 11]) >>> np.around([1,2,3,11], decimals=-1) array([ 0, 0, 0, 10]) """""" ```
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,936313924 https://github.com/pydata/xarray/pull/5571#issuecomment-907340223,https://api.github.com/repos/pydata/xarray/issues/5571,907340223,IC_kwDOAMm_X842FOm_,14371165,2021-08-27T16:55:12Z,2021-08-27T16:55:12Z,MEMBER,"Saw dask does similar fixes too: https://github.com/dask/dask/blob/85f0b14bd36a5135ce51aeee067b6207374b00c4/dask/array/wrap.py#L183 Here's a version inspired by that one: ```python around = _dask_or_eager_func(""around"") # np.around has failing doctests, overwrite it so they pass: # https://github.com/numpy/numpy/issues/19759 around.__doc__ = test.__doc__.replace( ""array([0., 2.])"", ""array([0., 2.])"", ) around.__doc__ = test.__doc__.replace( ""array([0.4, 1.6])"", ""array([0.4, 1.6])"", ) around.__doc__ = test.__doc__.replace( ""array([0., 2., 2., 4., 4.])"", ""array([0., 2., 2., 4., 4.])"", ) ```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,936313924 https://github.com/pydata/xarray/pull/5571#issuecomment-906092175,https://api.github.com/repos/pydata/xarray/issues/5571,906092175,IC_kwDOAMm_X842Ad6P,14371165,2021-08-26T04:50:04Z,2021-08-26T04:50:04Z,MEMBER,"```python ___________ [doctest] xarray.core._typed_ops.DataArrayOpsMixin.round ___________ EXAMPLE LOCATION UNKNOWN, not showing all tests of that example ??? >>> np.around([0.37, 1.64]) Expected: array([0., 2.]) Got: array([0., 2.]) /home/runner/work/xarray/xarray/xarray/core/_typed_ops.py:None: DocTestFailure ``` The expected had 2 spaces after the comma for some reason. I think the actual output makes more sense now so I think it's fine to just accept this difference and change the expected output.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,936313924 https://github.com/pydata/xarray/pull/5571#issuecomment-905980816,https://api.github.com/repos/pydata/xarray/issues/5571,905980816,IC_kwDOAMm_X842ACuQ,2448579,2021-08-26T01:07:39Z,2021-08-26T01:07:39Z,MEMBER,I think you just need to fix the spaces in the expected output,"{""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,936313924 https://github.com/pydata/xarray/pull/5571#issuecomment-905973029,https://api.github.com/repos/pydata/xarray/issues/5571,905973029,IC_kwDOAMm_X842AA0l,35968931,2021-08-26T00:46:35Z,2021-08-26T00:46:35Z,MEMBER,"@Illviljan that actually solved those padding errors! Awesome! The tests still fail because of something going on with `np.around` in the doctests though :confused: ","{""total_count"": 1, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 1, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,936313924 https://github.com/pydata/xarray/pull/5571#issuecomment-905947313,https://api.github.com/repos/pydata/xarray/issues/5571,905947313,IC_kwDOAMm_X841_6ix,14371165,2021-08-25T23:42:08Z,2021-08-25T23:42:08Z,MEMBER,@TomNicholas try merging main now. Let's see if there are any errors left.,"{""total_count"": 1, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 1}",,936313924 https://github.com/pydata/xarray/pull/5571#issuecomment-903140359,https://api.github.com/repos/pydata/xarray/issues/5571,903140359,IC_kwDOAMm_X8411NQH,14371165,2021-08-21T16:23:26Z,2021-08-21T16:23:26Z,MEMBER,"The issue mentioned in `dask_array_compat.pad` was closed around may 2020 (https://github.com/dask/dask/pull/6213). The min version of dask can be bumped to 2.24 tomorrow (from 2.15 and 2.9), maybe that's enough to fix the errors?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,936313924 https://github.com/pydata/xarray/pull/5571#issuecomment-885931906,https://api.github.com/repos/pydata/xarray/issues/5571,885931906,IC_kwDOAMm_X840zj-C,2448579,2021-07-23T21:51:46Z,2021-07-23T21:52:51Z,MEMBER,"> for padding fail with output that is 0.5 away from what's expected We work around some dask bugs with `dask_array_compat.pad` I think you'll need to revert to that and not use `np.pad` until we can bump dask. EDIT: though I don't see this kind of thing being fixed there.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,936313924 https://github.com/pydata/xarray/pull/5571#issuecomment-885213103,https://api.github.com/repos/pydata/xarray/issues/5571,885213103,IC_kwDOAMm_X840w0ev,35968931,2021-07-22T20:31:35Z,2021-07-22T20:31:35Z,MEMBER,"Now there is one more mystery: why do some of the tests for padding fail with output that is 0.5 away from what's expected??: ``` _____________ TestVariableWithDask.test_pad[xr_arg3-np_arg3-mean] ______________ [gw3] linux -- Python 3.7.10 /usr/share/miniconda/envs/xarray-tests/bin/python self = mode = 'mean', xr_arg = {'x': (3, 1), 'z': (2, 0)} np_arg = ((3, 1), (0, 0), (2, 0)) @pytest.mark.parametrize( ""mode"", [ ""mean"", pytest.param( ""median"", marks=pytest.mark.xfail(reason=""median is not implemented by Dask""), ), pytest.param( ""reflect"", marks=pytest.mark.xfail(reason=""dask.array.pad bug"") ), ""edge"", pytest.param( ""linear_ramp"", marks=pytest.mark.xfail( reason=""pint bug: https://github.com/hgrecco/pint/issues/1026"" ), ), ""maximum"", ""minimum"", ""symmetric"", ""wrap"", ], ) @pytest.mark.parametrize(""xr_arg, np_arg"", _PAD_XR_NP_ARGS) @pytest.mark.filterwarnings( r""ignore:dask.array.pad.+? converts integers to floats."" ) def test_pad(self, mode, xr_arg, np_arg): data = np.arange(4 * 3 * 2).reshape(4, 3, 2) v = self.cls([""x"", ""y"", ""z""], data) actual = v.pad(mode=mode, **xr_arg) expected = np.pad(data, np_arg, mode=mode) > assert_array_equal(actual, expected) E AssertionError: E Arrays are not equal E E Mismatched elements: 48 / 96 (50%) E Max absolute difference: 0.5 E Max relative difference: 0.25 E x: array([[[ 9.5, 9.5, 9. , 10. ], E [11.5, 11.5, 11. , 12. ], E [13.5, 13.5, 13. , 14. ]],... E y: array([[[10, 10, 9, 10], E [12, 12, 11, 12], E [14, 14, 13, 14]],... ```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,936313924 https://github.com/pydata/xarray/pull/5571#issuecomment-873471008,https://api.github.com/repos/pydata/xarray/issues/5571,873471008,MDEyOklzc3VlQ29tbWVudDg3MzQ3MTAwOA==,5635139,2021-07-03T21:11:46Z,2021-07-03T21:11:46Z,MEMBER,"Looks great! I don't know the details of this code well, but at the conceptual level it looks good! > A net-negative pull request 🤯 The best type!","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,936313924 https://github.com/pydata/xarray/pull/5571#issuecomment-873468285,https://api.github.com/repos/pydata/xarray/issues/5571,873468285,MDEyOklzc3VlQ29tbWVudDg3MzQ2ODI4NQ==,35968931,2021-07-03T20:49:50Z,2021-07-03T20:49:50Z,MEMBER,A net-negative pull request :exploding_head: ,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,936313924 https://github.com/pydata/xarray/pull/5571#issuecomment-873459181,https://api.github.com/repos/pydata/xarray/issues/5571,873459181,MDEyOklzc3VlQ29tbWVudDg3MzQ1OTE4MQ==,35968931,2021-07-03T19:31:44Z,2021-07-03T19:31:44Z,MEMBER,"Right I understand the failure now - everywhere where `_dask_or_eager_func` was dispatching numpy->dask is working fine via NEP-18, but my change made pandas.isnull no longer dispatch to dask.isnull, which then computes (and raises because we want it to be lazy). The solution is to special-case that one use of pandas (and perhaps any other uses of pandas?).","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,936313924