corteva / rioxarray

geospatial xarray extension powered by rasterio
https://corteva.github.io/rioxarray
Other
502 stars 80 forks source link

TST: Several `AssertionError`s in tests on `aarch64-linux` #780

Open GaetanLepage opened 2 weeks ago

GaetanLepage commented 2 weeks ago

Code Sample, a copy-pastable example if possible

Context: maintaining the python311Packages.rioxarray package on nixpkgs: https://github.com/NixOS/nixpkgs/pull/320524

A few tests fail on aarch64-linux with AssertionError. No issue was found on x86_64-linux.

pytest

Problem description

Excerpt of the log:

args = (<function assert_array_almost_equal.<locals>.compare at 0xffff5d6b7f60>, array([[[30692, 30696, 30699, 30702, 30704, ..., 30617, 30619, 30621],
        [30611, 30610, 30610, 30610, 30610, 30611, 30612, 30614, 30616]]],
      dtype=uint16))
kwds = {'err_msg': '', 'header': 'Arrays are not almost equal to 7 decimals', 'precision': 7, 'verbose': True}

    @wraps(func)
    def inner(*args, **kwds):
        with self._recreate_cm():
>           return func(*args, **kwds)
E           AssertionError: 
E           Arrays are not almost equal to 7 decimals
E           
E           Mismatched elements: 375 / 441 (85%)
E           Max absolute difference: 7
E           Max relative difference: 0.00022836
E            x: array([[[30692, 30696, 30699, 30702, 30704, 30705, 30705, 30704, 30703],
E                   [30690, 30694, 30697, 30700, 30703, 30705, 30704, 30704, 30703],
E                   [30687, 30692, 30695, 30699, 30703, 30704, 30703, 30702, 30701],...
E            y: array([[[30696, 30699, 30702, 30704, 30705, 30705, 30704, 30703, 30701],
E                   [30694, 30697, 30700, 30703, 30705, 30704, 30704, 30703, 30700],
E                   [30692, 30695, 30699, 30703, 30704, 30703, 30702, 30701, 30698],...

/nix/store/q3x28mimkawkdjlvd78jxv3s0fk25vz8-python3-3.11.9/lib/python3.11/contextlib.py:81: AssertionError

Full log: https://pastebin.com/HaYxS5ZV

Expected Output

Tests are all successful.

Environment Information

rioxarray (0.15.5) deps:
  rasterio: 1.3.10
    xarray: 2024.2.0
      GDAL: 3.8.5
      GEOS: 3.12.1
      PROJ: 9.4.1
 PROJ DATA: /tmp/proj:/nix/store/ba589n2q0hqwgv1xcksvrmaw92cx0ara-proj-9.4.1/share/proj:/nix/store/ba589n2q0hqwgv1xcksvrmaw92cx0ara-proj-9.4.1/share/proj
 GDAL DATA: None

Other python deps:
     scipy: None
    pyproj: 3.6.1

System:
    python: 3.11.9 (main, Apr  2 2024, 08:25:04) [GCC 13.3.0]
executable: /nix/store/q3x28mimkawkdjlvd78jxv3s0fk25vz8-python3-3.11.9/bin/python
   machine: Linux-5.15.158-aarch64-with-glibc2.39
GaetanLepage commented 2 weeks ago

Maybe slightly relaxing the expected precision of those checks could be relevant.

snowman2 commented 2 weeks ago

Looks like the data is shifted one cell over.