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-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-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-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