Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve warnings issued in the xarray test suite #1652

Closed
shoyer opened this issue Oct 24, 2017 · 10 comments · Fixed by #1657
Closed

Resolve warnings issued in the xarray test suite #1652

shoyer opened this issue Oct 24, 2017 · 10 comments · Fixed by #1657

Comments

@shoyer
Copy link
Member

shoyer commented Oct 24, 2017

82 warnings are currently issued in the process of running our test suite:
https://gist.github.com/shoyer/db0b2c82efd76b254453216e957c4345

Some of can probably be safely ignored, but others are likely noticed by users, e.g.,
https://stackoverflow.com/questions/41130138/why-is-invalid-value-encountered-in-greater-warning-thrown-in-python-xarray-fo/41147570#41147570

It would be nice to clean up all of these, either by catching the appropriate upstream warning (if irrelevant) or changing our usage to avoid the warning. There may very well be a lurking FutureWarning in there somewhere that could cause issues when another library updates.

Probably the easiest way to get started here is to get the test suite running locally, and use py.test -W error to turn all warnings into errors.

@fmaussion
Copy link
Member

Do I understand right that you'd like to silence the warnings in the xr.DataArray([1, 2, np.NaN]) > 0 case?

@shoyer
Copy link
Member Author

shoyer commented Oct 24, 2017

Do I understand right that you'd like to silence the warnings in the xr.DataArray([1, 2, np.NaN]) > 0 case?

Yes, I don't think this warning is very useful -- pandas doesn't show it.

@fmaussion
Copy link
Member

pandas doesn't show it.

Right, I misunderstood that part.

@jhamman
Copy link
Member

jhamman commented Oct 25, 2017

$ py.test -W error xarray/tests 
===== 372 failed, 2141 passed, 89 skipped, 10 xfailed in 148.41 seconds =====

👍 on squashing as many of these as possible.

@jhamman
Copy link
Member

jhamman commented Oct 25, 2017

I'll take this one on unless someone else really wants it.

@jhamman
Copy link
Member

jhamman commented Oct 30, 2017

reopening since #1657 only took care of a subset of the current warnings.

@jhamman jhamman reopened this Oct 30, 2017
@max-sixty
Copy link
Collaborator

max-sixty commented Feb 19, 2018

Here's the latest output (excluding test_backends.py, which separately isn't working locally):

EDIT: put this into a details dropdown


====================================================================== warnings summary ======================================================================
xarray/tests/test_dataarray.py::TestDataArray::test_groupby_math
  /Users/maximilian/drive/workspace/xarray/xarray/tests/test_dataarray.py:2019: FutureWarning: the order of the arguments on DataArray.to_dataset has changed; you now need to supply ``name`` as a keyword argument
    ds = array.coords['x'].to_dataset('X')

xarray/tests/test_dataarray.py::TestDataArray::test_reindex_regressions
  /Users/maximilian/drive/workspace/xarray/xarray/core/dataarray.py:889: FutureWarning: Indexer has dimensions ('time2',) that are different from that to be indexed along time. This will behave differently in the future.
    method=method, tolerance=tolerance, copy=copy, **indexers)

xarray/tests/test_dataarray.py::test_rolling_reduce[mean-1-None-True-2]
  /Users/maximilian/drive/workspace/xarray/xarray/core/variable.py:1224: RuntimeWarning: Mean of empty slice
    axis=axis, **kwargs)

xarray/tests/test_dataarray.py::test_rolling_reduce[mean-1-None-False-2]
  /Users/maximilian/drive/workspace/xarray/xarray/core/variable.py:1224: RuntimeWarning: Mean of empty slice
    axis=axis, **kwargs)

xarray/tests/test_dataarray.py::test_rolling_reduce[mean-1-1-True-2]
  /Users/maximilian/drive/workspace/xarray/xarray/core/variable.py:1224: RuntimeWarning: Mean of empty slice
    axis=axis, **kwargs)

xarray/tests/test_dataarray.py::test_rolling_reduce[mean-1-1-False-2]
  /Users/maximilian/drive/workspace/xarray/xarray/core/variable.py:1224: RuntimeWarning: Mean of empty slice
    axis=axis, **kwargs)

xarray/tests/test_dataarray.py::test_rolling_reduce[mean-1-2-True-2]
  /Users/maximilian/drive/workspace/xarray/xarray/core/variable.py:1224: RuntimeWarning: Mean of empty slice
    axis=axis, **kwargs)

xarray/tests/test_dataarray.py::test_rolling_reduce[mean-1-2-False-2]
  /Users/maximilian/drive/workspace/xarray/xarray/core/variable.py:1224: RuntimeWarning: Mean of empty slice
    axis=axis, **kwargs)

xarray/tests/test_dataarray.py::test_rolling_reduce[mean-1-3-True-2]
  /Users/maximilian/drive/workspace/xarray/xarray/core/variable.py:1224: RuntimeWarning: Mean of empty slice
    axis=axis, **kwargs)

xarray/tests/test_dataarray.py::test_rolling_reduce[mean-1-3-False-2]
  /Users/maximilian/drive/workspace/xarray/xarray/core/variable.py:1224: RuntimeWarning: Mean of empty slice
    axis=axis, **kwargs)

xarray/tests/test_dataarray.py::test_rolling_reduce[std-1-None-True-2]
  /usr/local/lib/python3.6/site-packages/numpy/lib/nanfunctions.py:1434: RuntimeWarning: Degrees of freedom <= 0 for slice.
    keepdims=keepdims)

xarray/tests/test_dataarray.py::test_rolling_reduce[std-1-None-False-2]
  /usr/local/lib/python3.6/site-packages/numpy/lib/nanfunctions.py:1434: RuntimeWarning: Degrees of freedom <= 0 for slice.
    keepdims=keepdims)

xarray/tests/test_dataarray.py::test_rolling_reduce[std-1-1-True-2]
  /usr/local/lib/python3.6/site-packages/numpy/lib/nanfunctions.py:1434: RuntimeWarning: Degrees of freedom <= 0 for slice.
    keepdims=keepdims)

xarray/tests/test_dataarray.py::test_rolling_reduce[std-1-1-False-2]
  /usr/local/lib/python3.6/site-packages/numpy/lib/nanfunctions.py:1434: RuntimeWarning: Degrees of freedom <= 0 for slice.
    keepdims=keepdims)

xarray/tests/test_dataarray.py::test_rolling_reduce[std-1-2-True-2]
  /usr/local/lib/python3.6/site-packages/numpy/lib/nanfunctions.py:1434: RuntimeWarning: Degrees of freedom <= 0 for slice.
    keepdims=keepdims)

xarray/tests/test_dataarray.py::test_rolling_reduce[std-1-2-False-2]
  /usr/local/lib/python3.6/site-packages/numpy/lib/nanfunctions.py:1434: RuntimeWarning: Degrees of freedom <= 0 for slice.
    keepdims=keepdims)

xarray/tests/test_dataarray.py::test_rolling_reduce[std-1-3-True-2]
  /usr/local/lib/python3.6/site-packages/numpy/lib/nanfunctions.py:1434: RuntimeWarning: Degrees of freedom <= 0 for slice.
    keepdims=keepdims)

xarray/tests/test_dataarray.py::test_rolling_reduce[std-1-3-False-2]
  /usr/local/lib/python3.6/site-packages/numpy/lib/nanfunctions.py:1434: RuntimeWarning: Degrees of freedom <= 0 for slice.
    keepdims=keepdims)

xarray/tests/test_dataarray.py::test_rolling_reduce[max-1-None-True-2]
  /Users/maximilian/drive/workspace/xarray/xarray/core/variable.py:1224: RuntimeWarning: All-NaN slice encountered
    axis=axis, **kwargs)

xarray/tests/test_dataarray.py::test_rolling_reduce[max-1-None-False-2]
  /Users/maximilian/drive/workspace/xarray/xarray/core/variable.py:1224: RuntimeWarning: All-NaN slice encountered
    axis=axis, **kwargs)

xarray/tests/test_dataarray.py::test_rolling_reduce[max-1-1-True-2]
  /Users/maximilian/drive/workspace/xarray/xarray/core/variable.py:1224: RuntimeWarning: All-NaN slice encountered
    axis=axis, **kwargs)

xarray/tests/test_dataarray.py::test_rolling_reduce[max-1-1-False-2]
  /Users/maximilian/drive/workspace/xarray/xarray/core/variable.py:1224: RuntimeWarning: All-NaN slice encountered
    axis=axis, **kwargs)

xarray/tests/test_dataarray.py::test_rolling_reduce[max-1-2-True-2]
  /Users/maximilian/drive/workspace/xarray/xarray/core/variable.py:1224: RuntimeWarning: All-NaN slice encountered
    axis=axis, **kwargs)

xarray/tests/test_dataarray.py::test_rolling_reduce[max-1-2-False-2]
  /Users/maximilian/drive/workspace/xarray/xarray/core/variable.py:1224: RuntimeWarning: All-NaN slice encountered
    axis=axis, **kwargs)

xarray/tests/test_dataarray.py::test_rolling_reduce[max-1-3-True-2]
  /Users/maximilian/drive/workspace/xarray/xarray/core/variable.py:1224: RuntimeWarning: All-NaN slice encountered
    axis=axis, **kwargs)

xarray/tests/test_dataarray.py::test_rolling_reduce[max-1-3-False-2]
  /Users/maximilian/drive/workspace/xarray/xarray/core/variable.py:1224: RuntimeWarning: All-NaN slice encountered
    axis=axis, **kwargs)

xarray/tests/test_duck_array_ops.py::test_reduce[None-False-min-False-float-1]
  /usr/local/lib/python3.6/site-packages/numpy/core/_methods.py:29: RuntimeWarning: invalid value encountered in reduce
    return umr_minimum(a, axis, None, out, keepdims)

xarray/tests/test_duck_array_ops.py::test_reduce[None-False-min-False-float-2]
  /usr/local/lib/python3.6/site-packages/numpy/core/_methods.py:29: RuntimeWarning: invalid value encountered in reduce
    return umr_minimum(a, axis, None, out, keepdims)

xarray/tests/test_duck_array_ops.py::test_reduce[None-False-min-False-int-1]
  /usr/local/lib/python3.6/site-packages/numpy/core/_methods.py:29: RuntimeWarning: invalid value encountered in reduce
    return umr_minimum(a, axis, None, out, keepdims)

xarray/tests/test_duck_array_ops.py::test_reduce[None-False-min-False-int-2]
  /usr/local/lib/python3.6/site-packages/numpy/core/_methods.py:29: RuntimeWarning: invalid value encountered in reduce
    return umr_minimum(a, axis, None, out, keepdims)

xarray/tests/test_duck_array_ops.py::test_reduce[None-False-min-False-float32-1]
  /usr/local/lib/python3.6/site-packages/numpy/core/_methods.py:29: RuntimeWarning: invalid value encountered in reduce
    return umr_minimum(a, axis, None, out, keepdims)

xarray/tests/test_duck_array_ops.py::test_reduce[None-False-min-False-float32-2]
  /usr/local/lib/python3.6/site-packages/numpy/core/_methods.py:29: RuntimeWarning: invalid value encountered in reduce
    return umr_minimum(a, axis, None, out, keepdims)

xarray/tests/test_duck_array_ops.py::test_reduce[None-False-min-False-bool_-1]
  /usr/local/lib/python3.6/site-packages/numpy/core/_methods.py:29: RuntimeWarning: invalid value encountered in reduce
    return umr_minimum(a, axis, None, out, keepdims)

xarray/tests/test_duck_array_ops.py::test_reduce[None-False-min-False-bool_-2]
  /usr/local/lib/python3.6/site-packages/numpy/core/_methods.py:29: RuntimeWarning: invalid value encountered in reduce
    return umr_minimum(a, axis, None, out, keepdims)

xarray/tests/test_duck_array_ops.py::test_reduce[None-False-max-False-float-1]
  /usr/local/lib/python3.6/site-packages/numpy/core/_methods.py:26: RuntimeWarning: invalid value encountered in reduce
    return umr_maximum(a, axis, None, out, keepdims)

xarray/tests/test_duck_array_ops.py::test_reduce[None-False-max-False-float-2]
  /usr/local/lib/python3.6/site-packages/numpy/core/_methods.py:26: RuntimeWarning: invalid value encountered in reduce
    return umr_maximum(a, axis, None, out, keepdims)

xarray/tests/test_duck_array_ops.py::test_reduce[None-False-max-False-int-1]
  /usr/local/lib/python3.6/site-packages/numpy/core/_methods.py:26: RuntimeWarning: invalid value encountered in reduce
    return umr_maximum(a, axis, None, out, keepdims)

xarray/tests/test_duck_array_ops.py::test_reduce[None-False-max-False-int-2]
  /usr/local/lib/python3.6/site-packages/numpy/core/_methods.py:26: RuntimeWarning: invalid value encountered in reduce
    return umr_maximum(a, axis, None, out, keepdims)

xarray/tests/test_duck_array_ops.py::test_reduce[None-False-max-False-float32-1]
  /usr/local/lib/python3.6/site-packages/numpy/core/_methods.py:26: RuntimeWarning: invalid value encountered in reduce
    return umr_maximum(a, axis, None, out, keepdims)

xarray/tests/test_duck_array_ops.py::test_reduce[None-False-max-False-float32-2]
  /usr/local/lib/python3.6/site-packages/numpy/core/_methods.py:26: RuntimeWarning: invalid value encountered in reduce
    return umr_maximum(a, axis, None, out, keepdims)

xarray/tests/test_duck_array_ops.py::test_reduce[None-False-max-False-bool_-1]
  /usr/local/lib/python3.6/site-packages/numpy/core/_methods.py:26: RuntimeWarning: invalid value encountered in reduce
    return umr_maximum(a, axis, None, out, keepdims)

xarray/tests/test_duck_array_ops.py::test_reduce[None-False-max-False-bool_-2]
  /usr/local/lib/python3.6/site-packages/numpy/core/_methods.py:26: RuntimeWarning: invalid value encountered in reduce
    return umr_maximum(a, axis, None, out, keepdims)

xarray/tests/test_duck_array_ops.py::test_reduce[x-False-min-False-float-1]
  /usr/local/lib/python3.6/site-packages/numpy/core/_methods.py:29: RuntimeWarning: invalid value encountered in reduce
    return umr_minimum(a, axis, None, out, keepdims)

xarray/tests/test_duck_array_ops.py::test_reduce[x-False-min-False-int-1]
  /usr/local/lib/python3.6/site-packages/numpy/core/_methods.py:29: RuntimeWarning: invalid value encountered in reduce
    return umr_minimum(a, axis, None, out, keepdims)

xarray/tests/test_duck_array_ops.py::test_reduce[x-False-min-False-float32-1]
  /usr/local/lib/python3.6/site-packages/numpy/core/_methods.py:29: RuntimeWarning: invalid value encountered in reduce
    return umr_minimum(a, axis, None, out, keepdims)

xarray/tests/test_duck_array_ops.py::test_reduce[x-False-min-False-bool_-1]
  /usr/local/lib/python3.6/site-packages/numpy/core/_methods.py:29: RuntimeWarning: invalid value encountered in reduce
    return umr_minimum(a, axis, None, out, keepdims)

xarray/tests/test_duck_array_ops.py::test_reduce[x-False-max-False-float-1]
  /usr/local/lib/python3.6/site-packages/numpy/core/_methods.py:26: RuntimeWarning: invalid value encountered in reduce
    return umr_maximum(a, axis, None, out, keepdims)

xarray/tests/test_duck_array_ops.py::test_reduce[x-False-max-False-int-1]
  /usr/local/lib/python3.6/site-packages/numpy/core/_methods.py:26: RuntimeWarning: invalid value encountered in reduce
    return umr_maximum(a, axis, None, out, keepdims)

xarray/tests/test_duck_array_ops.py::test_reduce[x-False-max-False-float32-1]
  /usr/local/lib/python3.6/site-packages/numpy/core/_methods.py:26: RuntimeWarning: invalid value encountered in reduce
    return umr_maximum(a, axis, None, out, keepdims)

xarray/tests/test_duck_array_ops.py::test_reduce[x-False-max-False-bool_-1]
  /usr/local/lib/python3.6/site-packages/numpy/core/_methods.py:26: RuntimeWarning: invalid value encountered in reduce
    return umr_maximum(a, axis, None, out, keepdims)

xarray/tests/test_missing.py::test_scipy_methods_function
  /usr/local/lib/python3.6/site-packages/scipy/interpolate/polyint.py:511: RuntimeWarning: overflow encountered in multiply
    self.wi[:j] *= (self.xi[j]-self.xi[:j])
  /usr/local/lib/python3.6/site-packages/scipy/interpolate/polyint.py:512: RuntimeWarning: overflow encountered in reduce
    self.wi[j] = np.multiply.reduce(self.xi[:j]-self.xi[j])
  /usr/local/lib/python3.6/site-packages/scipy/interpolate/polyint.py:609: RuntimeWarning: invalid value encountered in true_divide
    p = np.dot(c,self.yi)/np.sum(c,axis=-1)[...,np.newaxis]
  /usr/local/lib/python3.6/site-packages/scipy/interpolate/polyint.py:324: RuntimeWarning: overflow encountered in multiply
    pi = w*pi
  /usr/local/lib/python3.6/site-packages/scipy/interpolate/polyint.py:325: RuntimeWarning: invalid value encountered in multiply
    p += pi[:,np.newaxis] * self.c[k]
  /usr/local/lib/python3.6/site-packages/scipy/interpolate/polyint.py:325: RuntimeWarning: invalid value encountered in add
    p += pi[:,np.newaxis] * self.c[k]

xarray/tests/test_plot.py::TestContourf::test_can_plot_all_nans
  /usr/local/lib/python3.6/site-packages/matplotlib/contour.py:1534: UserWarning: Warning: converting a masked element to nan.
    self.zmax = float(z.max())
  /usr/local/lib/python3.6/site-packages/matplotlib/contour.py:1535: UserWarning: Warning: converting a masked element to nan.
    self.zmin = float(z.min())

xarray/tests/test_plot.py::TestContour::test_can_plot_all_nans
  /usr/local/lib/python3.6/site-packages/matplotlib/contour.py:1534: UserWarning: Warning: converting a masked element to nan.
    self.zmax = float(z.max())
  /usr/local/lib/python3.6/site-packages/matplotlib/contour.py:1535: UserWarning: Warning: converting a masked element to nan.
    self.zmin = float(z.min())
  /usr/local/lib/python3.6/site-packages/matplotlib/contour.py:1176: RuntimeWarning: invalid value encountered in greater
    inside = (self.levels > self.zmin) & (self.levels < self.zmax)
  /usr/local/lib/python3.6/site-packages/matplotlib/contour.py:1176: RuntimeWarning: invalid value encountered in less
    inside = (self.levels > self.zmin) & (self.levels < self.zmax)
  /usr/local/lib/python3.6/site-packages/matplotlib/contour.py:1180: UserWarning: No contour levels were found within the data range.
    warnings.warn("No contour levels were found"

xarray/tests/test_plot.py::TestContour::test_single_level
  /usr/local/lib/python3.6/site-packages/matplotlib/contour.py:1180: UserWarning: No contour levels were found within the data range.
    warnings.warn("No contour levels were found"

xarray/tests/test_plot.py::TestPcolormesh::test_can_plot_axis_size_one
  /usr/local/lib/python3.6/site-packages/matplotlib/axes/_base.py:2961: UserWarning: Attempting to set identical left==right results
  in singular transformations; automatically expanding.
  left=0.0, right=0.0
    'left=%s, right=%s') % (left, right))
  /usr/local/lib/python3.6/site-packages/matplotlib/axes/_base.py:3285: UserWarning: Attempting to set identical bottom==top results
  in singular transformations; automatically expanding.
  bottom=0.0, top=0.0
    'bottom=%s, top=%s') % (bottom, top))

xarray/tests/test_variable.py::TestVariable::test_index_0d_not_a_time
  /Users/maximilian/drive/workspace/xarray/xarray/core/duck_array_ops.py:138: FutureWarning: In the future, 'NAT == x' and 'x == NAT' will always be False.
    flag_array = (arr1 == arr2)
  /Users/maximilian/drive/workspace/xarray/xarray/tests/test_variable.py:144: FutureWarning: In the future, 'NAT == x' and 'x == NAT' will always be False.
    assert variable.values[0] == expected_value0
  /Users/maximilian/drive/workspace/xarray/xarray/tests/test_variable.py:145: FutureWarning: In the future, 'NAT == x' and 'x == NAT' will always be False.
    assert variable[0].values == expected_value0

xarray/tests/test_variable.py::TestIndexVariable::test_index_0d_not_a_time
  /Users/maximilian/drive/workspace/xarray/xarray/tests/test_variable.py:144: FutureWarning: In the future, 'NAT == x' and 'x == NAT' will always be False.
    assert variable.values[0] == expected_value0
  /Users/maximilian/drive/workspace/xarray/xarray/tests/test_variable.py:145: FutureWarning: In the future, 'NAT == x' and 'x == NAT' will always be False.
    assert variable[0].values == expected_value0

-- Docs: http://doc.pytest.org/en/latest/warnings.html
============================================= 2475 passed, 205 skipped, 4 xfailed, 71 warnings in 127.39 seconds =============================================

@stale
Copy link

stale bot commented Jan 28, 2020

In order to maintain a list of currently relevant issues, we mark issues as stale after a period of inactivity

If this issue remains relevant, please comment here or remove the stale label; otherwise it will be marked as closed automatically

@stale stale bot added the stale label Jan 28, 2020
@dcherian dcherian removed the stale label Jan 28, 2020
@keewis
Copy link
Collaborator

keewis commented Jan 28, 2020

this may be related to (or superseded by) #3266

@keewis
Copy link
Collaborator

keewis commented Feb 21, 2021

closing in favor of #3266

@keewis keewis closed this as completed Feb 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants