pytroll / pyorbital

Orbital and astronomy computations in python
http://pyorbital.readthedocs.org/
GNU General Public License v3.0
220 stars 75 forks source link

Unittest failure with numpy 1.26.4 on i386 platforms #149

Open avalentino opened 3 months ago

avalentino commented 3 months ago

Code Sample, a minimal, complete, and verifiable piece of code

$ python3 -m pytest --pyargs pyorbital

Problem description

Unit test failure.

Expected Output

All tests pass successfully.

Actual Result, Traceback if applicable

Full log available at https://ci.debian.net/data/autopkgtest/testing/i386/p/pyorbital/45030100/log.gz

  127s =================================== FAILURES 
  ===================================
  127s _____________________ TestGetObserverLook.test_basic_dask ______________________
  127s
  127s self = <pyorbital.tests.test_orbital.TestGetObserverLook testMethod=test_basic_dask>
  127s
  127s     def test_basic_dask(self):
  127s         """Test with dask array inputs"""
  127s         from pyorbital import orbital
  127s         import dask.array as da
  127s         sat_lon = da.from_array(self.sat_lon, chunks=2)
  127s         sat_lat = da.from_array(self.sat_lat, chunks=2)
  127s         sat_alt = da.from_array(self.sat_alt, chunks=2)
  127s         lon = da.from_array(self.lon, chunks=2)
  127s         lat = da.from_array(self.lat, chunks=2)
  127s         alt = da.from_array(self.alt, chunks=2)
  127s         azi, elev = orbital.get_observer_look(sat_lon, sat_lat,
  127s                                               sat_alt, self.t,
  127s                                               lon, lat, alt)
  127s >       np.testing.assert_allclose(azi.compute(), self.exp_azi)
  127s
  127s /usr/lib/python3/dist-packages/pyorbital/tests/test_orbital.py:259:
  127s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  127s
  127s args = (<function assert_allclose.<locals>.compare at 0xf0c0cf28>, array([[331.00275902, 330.95954165, 180.        ,  86.4354...00275902, 330.95954165, 180.        ,  86.435411  ],
  127s        [330.91642994, 180.        ,   0.        , 273.232073  ]]))
  127s kwds = {'equal_nan': True, 'err_msg': '', 'header': 'Not equal to tolerance rtol=1e-07, atol=0', 'verbose': True}
  127s
  127s     @wraps(func)
  127s     def inner(*args, **kwds):
  127s         with self._recreate_cm():
  127s >           return func(*args, **kwds)
  127s E           AssertionError:
  127s E           Not equal to tolerance rtol=1e-07, atol=0
  127s E
  127s E           Mismatched elements: 1 / 8 (12.5%)
  127s E           Max absolute difference: 14.03624347
  127s E           Max relative difference: 0.07797913
  127s E            x: array([[331.002759, 330.959542, 180.      ,  86.435411],
  127s E                  [330.91643 , 165.963757,   0.      , 273.232073]])
  127s E            y: array([[331.002759, 330.959542, 180.      ,  86.435411],
  127s E                  [330.91643 , 180.      ,   0.      , 273.232073]])
  127s
  127s /usr/lib/python3.11/contextlib.py:81: AssertionError
  127s _____________________ TestGetObserverLook.test_basic_numpy _____________________
  127s
  127s self = <pyorbital.tests.test_orbital.TestGetObserverLook testMethod=test_basic_numpy>
  127s
  127s     def test_basic_numpy(self):
  127s         """Test with numpy array inputs"""
  127s         from pyorbital import orbital
  127s         azi, elev = orbital.get_observer_look(self.sat_lon, self.sat_lat,
  127s                                               self.sat_alt, self.t,
  127s                                               self.lon, self.lat, self.alt)
  127s >       np.testing.assert_allclose(azi, self.exp_azi)
  127s
  127s /usr/lib/python3/dist-packages/pyorbital/tests/test_orbital.py:243:
  127s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  127s
  127s args = (<function assert_allclose.<locals>.compare at 0xf0abaf28>, array([[331.00275902, 330.95954165, 180.        ,  86.4354...00275902, 330.95954165, 180.        ,  86.435411  ],
  127s        [330.91642994, 180.        ,   0.        , 273.232073  ]]))
  127s kwds = {'equal_nan': True, 'err_msg': '', 'header': 'Not equal to tolerance rtol=1e-07, atol=0', 'verbose': True}
  127s
  127s     @wraps(func)
  127s     def inner(*args, **kwds):
  127s         with self._recreate_cm():
  127s >           return func(*args, **kwds)
  127s E           AssertionError:
  127s E           Not equal to tolerance rtol=1e-07, atol=0
  127s E
  127s E           Mismatched elements: 1 / 8 (12.5%)
  127s E           Max absolute difference: 14.03624347
  127s E           Max relative difference: 0.07797913
  127s E            x: array([[331.002759, 330.959542, 180.      ,  86.435411],
  127s E                  [330.91643 , 165.963757,   0.      , 273.232073]])
  127s E            y: array([[331.002759, 330.959542, 180.      ,  86.435411],
  127s E                  [330.91643 , 180.      ,   0.      , 273.232073]])
  127s
  127s /usr/lib/python3.11/contextlib.py:81: AssertionError
  127s __________________ TestGetObserverLook.test_xarray_with_dask ___________________
  127s
  127s self = <pyorbital.tests.test_orbital.TestGetObserverLook testMethod=test_xarray_with_dask>
  127s
  127s     def test_xarray_with_dask(self):
  127s         """Test with xarray DataArray with dask array as inputs"""
  127s         from pyorbital import orbital
  127s         import dask.array as da
  127s         import xarray as xr
  127s
  127s         def _xarr_conv(input):
  127s             return xr.DataArray(da.from_array(input, chunks=2))
  127s         sat_lon = _xarr_conv(self.sat_lon)
  127s         sat_lat = _xarr_conv(self.sat_lat)
  127s         sat_alt = _xarr_conv(self.sat_alt)
  127s         lon = _xarr_conv(self.lon)
  127s         lat = _xarr_conv(self.lat)
  127s         alt = _xarr_conv(self.alt)
  127s         azi, elev = orbital.get_observer_look(sat_lon, sat_lat,
  127s                                               sat_alt, self.t,
  127s                                               lon, lat, alt)
  127s >       np.testing.assert_allclose(azi.data.compute(), self.exp_azi)
  127s
  127s /usr/lib/python3/dist-packages/pyorbital/tests/test_orbital.py:298:
  127s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  127s
  127s args = (<function assert_allclose.<locals>.compare at 0xf022cc58>, array([[331.00275902, 330.95954165, 180.        ,  86.4354...00275902, 330.95954165, 180.        ,  86.435411  ],
  127s        [330.91642994, 180.        ,   0.        , 273.232073  ]]))
  127s kwds = {'equal_nan': True, 'err_msg': '', 'header': 'Not equal to tolerance rtol=1e-07, atol=0', 'verbose': True}
  127s
  127s     @wraps(func)
  127s     def inner(*args, **kwds):
  127s         with self._recreate_cm():
  127s >           return func(*args, **kwds)
  127s E           AssertionError:
  127s E           Not equal to tolerance rtol=1e-07, atol=0
  127s E
  127s E           Mismatched elements: 1 / 8 (12.5%)
  127s E           Max absolute difference: 14.03624347
  127s E           Max relative difference: 0.07797913
  127s E            x: array([[331.002759, 330.959542, 180.      ,  86.435411],
  127s E                  [330.91643 , 165.963757,   0.      , 273.232073]])
  127s E            y: array([[331.002759, 330.959542, 180.      ,  86.435411],
  127s E                  [330.91643 , 180.      ,   0.      , 273.232073]])
  127s
  127s /usr/lib/python3.11/contextlib.py:81: AssertionError
  127s __________________ TestGetObserverLook.test_xarray_with_numpy __________________
  127s
  127s self = <pyorbital.tests.test_orbital.TestGetObserverLook testMethod=test_xarray_with_numpy>
  127s
  127s     def test_xarray_with_numpy(self):
  127s         """Test with xarray DataArray with numpy array as inputs"""
  127s         from pyorbital import orbital
  127s         import xarray as xr
  127s
  127s         def _xarr_conv(input):
  127s             return xr.DataArray(input)
  127s         sat_lon = _xarr_conv(self.sat_lon)
  127s         sat_lat = _xarr_conv(self.sat_lat)
  127s         sat_alt = _xarr_conv(self.sat_alt)
  127s         lon = _xarr_conv(self.lon)
  127s         lat = _xarr_conv(self.lat)
  127s         alt = _xarr_conv(self.alt)
  127s         azi, elev = orbital.get_observer_look(sat_lon, sat_lat,
  127s                                               sat_alt, self.t,
  127s                                               lon, lat, alt)
  127s >       np.testing.assert_allclose(azi.data, self.exp_azi)
  127s
  127s /usr/lib/python3/dist-packages/pyorbital/tests/test_orbital.py:278:
  127s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  127s
  127s args = (<function assert_allclose.<locals>.compare at 0xf0248e88>, array([[331.00275902, 330.95954165, 180.        ,  86.4354...00275902, 330.95954165, 180.        ,  86.435411  ],
  127s        [330.91642994, 180.        ,   0.        , 273.232073  ]]))
  127s kwds = {'equal_nan': True, 'err_msg': '', 'header': 'Not equal to tolerance rtol=1e-07, atol=0', 'verbose': True}
  127s
  127s     @wraps(func)
  127s     def inner(*args, **kwds):
  127s         with self._recreate_cm():
  127s >           return func(*args, **kwds)
  127s E           AssertionError:
  127s E           Not equal to tolerance rtol=1e-07, atol=0
  127s E
  127s E           Mismatched elements: 1 / 8 (12.5%)
  127s E           Max absolute difference: 14.03624347
  127s E           Max relative difference: 0.07797913
  127s E            x: array([[331.002759, 330.959542, 180.      ,  86.435411],
  127s E                  [330.91643 , 165.963757,   0.      , 273.232073]])
  127s E            y: array([[331.002759, 330.959542, 180.      ,  86.435411],
  127s E                  [330.91643 , 180.      ,   0.      , 273.232073]])
  127s
  127s /usr/lib/python3.11/contextlib.py:81: AssertionError
  127s =========================== short test summary info ============================
  127s FAILED tests/test_orbital.py::TestGetObserverLook::test_basic_dask - Assertio...
  127s FAILED tests/test_orbital.py::TestGetObserverLook::test_basic_numpy - Asserti...
  127s FAILED tests/test_orbital.py::TestGetObserverLook::test_xarray_with_dask - As...
  127s FAILED tests/test_orbital.py::TestGetObserverLook::test_xarray_with_numpy - A...
  127s =================== 4 failed, 60 passed, 1 skipped in 7.68s ====================

Versions of Python, package at hand and relevant dependencies

OS: GNU/Linux Linux distibution: debian sid Platform: i386 Python: 3.12 pyorbital: 1.8.2 numpy: 1.26.4

djhoese commented 3 months ago

To be clear, 64-bit is passing?

avalentino commented 3 months ago

To be clear, 64-bit is passing?

Yes, it is passing