pytroll / pyresample

Geospatial image resampling in Python
http://pyresample.readthedocs.org
GNU Lesser General Public License v3.0
344 stars 95 forks source link

Fix tests on i386 #540

Closed avalentino closed 11 months ago

avalentino commented 11 months ago
codecov[bot] commented 11 months ago

Codecov Report

Merging #540 (74bcc08) into main (04ea38d) will not change coverage. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #540   +/-   ##
=======================================
  Coverage   94.25%   94.25%           
=======================================
  Files          82       82           
  Lines       13077    13077           
=======================================
  Hits        12326    12326           
  Misses        751      751           
Flag Coverage Δ
unittests 94.25% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
pyresample/test/test_bilinear.py 100.00% <100.00%> (ø)
coveralls commented 11 months ago

Coverage Status

coverage: 93.833%. remained the same when pulling 74bcc08d0e2de73b5e5d6752bff5bd3c50f964d4 on avalentino:bugfix/floating-point-comparison into 04ea38d90a076a16be8ea89743c447f146fe4921 on pytroll:main.

djhoese commented 11 months ago

Thanks!

djhoese commented 11 months ago

Just curious, how close were the results on i386 to the expected/compared results?

avalentino commented 11 months ago

I think something very close to the epsilon of float64

python3.11 -m pytest -k "not test_compare_to_legacy and not legacy_dask_ewa and not test_def2yaml_converter" --pyargs pyresample
============================= test session starts ==============================
platform linux -- Python 3.11.5, pytest-7.4.1, pluggy-1.3.0
rootdir: /builds/debian-gis-team/pyresample/debian/output/source_dir
plugins: lazy-fixture-0.6.3
collected 1053 items / 41 deselected / 1012 selected

pyresample/test/test_area_config.py .........                            [  0%]
pyresample/test/test_bilinear.py ...........F...................F....... [  4%]
......                                                                   [  5%]
pyresample/test/test_boundary.py .....                                   [  5%]
pyresample/test/test_bucket.py ..................                        [  7%]
pyresample/test/test_dask_ewa.py ....................................... [ 11%]
......................                                                   [ 13%]
pyresample/test/test_data_reduce.py ......                               [ 14%]
pyresample/test/test_ewa_fornav.py ......                                [ 14%]
pyresample/test/test_ewa_ll2cr.py .......                                [ 15%]
pyresample/test/test_geometry_legacy.py .............................    [ 18%]
pyresample/test/test_gradient.py ....................................... [ 22%]
.......                                                                  [ 22%]
pyresample/test/test_grid.py ............                                [ 24%]
pyresample/test/test_image.py ..............                             [ 25%]
pyresample/test/test_kd_tree.py ........................................ [ 29%]
....s..                                                                  [ 30%]
pyresample/test/test_plot.py .ss.ss.                                     [ 30%]
pyresample/test/test_resample_blocks.py ........................         [ 33%]
pyresample/test/test_slicer.py ...............                           [ 34%]
pyresample/test/test_spatial_mp.py ..                                    [ 34%]
pyresample/test/test_spherical.py ................................       [ 38%]
pyresample/test/test_spherical_geometry.py .....                         [ 38%]
pyresample/test/test_spherical_utils.py ..........................       [ 41%]
pyresample/test/test_swath.py ..                                         [ 41%]
pyresample/test/test_utils.py ......................................     [ 45%]
pyresample/test/test_geometry/test_area.py ............................. [ 47%]
........................................................................ [ 55%]
........................................................................ [ 62%]
.................                                                        [ 63%]
pyresample/test/test_geometry/test_swath.py ............................ [ 66%]
........................................................................ [ 73%]
........................................................................ [ 80%]
........................................................................ [ 87%]
................................................................         [ 94%]
pyresample/test/test_resamplers/test_nearest.py ..................       [ 96%]
pyresample/test/test_resamplers/test_resampler.py ..............         [ 97%]
pyresample/test/test_resamplers/test_resampler_registry.py .....         [ 97%]
pyresample/test/test_sgeom/test_point.py .....................           [100%]

=================================== FAILURES ===================================
_______________ TestNumpyBilinear.test_get_sample_from_bil_info ________________

self = <pyresample.test.test_bilinear.TestNumpyBilinear testMethod=test_get_sample_from_bil_info>

    def test_get_sample_from_bil_info(self):
        """Test resampling using resampling indices."""
        from pyresample.bilinear import get_bil_info, get_sample_from_bil_info

        t__, s__, input_idxs, idx_arr = get_bil_info(self.source_def,
                                                     self.target_def,
                                                     50e5, neighbours=32,
                                                     nprocs=1)
        # Sample from data1
        res = get_sample_from_bil_info(self.data1.ravel(), t__, s__,
                                       input_idxs, idx_arr)
>       self.assertEqual(res.ravel()[5], 1.)
E       AssertionError: 0.9999999999999999 != 1.0

pyresample/test/test_bilinear.py:311: AssertionError
_______________ TestXarrayBilinear.test_get_sample_from_bil_info _______________

self = <pyresample.test.test_bilinear.TestXarrayBilinear testMethod=test_get_sample_from_bil_info>

    def test_get_sample_from_bil_info(self):
        """Test bilinear interpolation as a whole."""
        import dask.array as da
        from xarray import DataArray

        from pyresample.bilinear import XArrayBilinearResampler

        resampler = XArrayBilinearResampler(self.source_def, self.target_def,
                                            self.radius)
        resampler.get_bil_info()

        # Sample from data1
        res = resampler.get_sample_from_bil_info(self.data1)
        res = res.compute()
        # Check couple of values
>       self.assertEqual(res.values[1, 1], 1.)
E       AssertionError: 0.9999999999999999 != 1.0

pyresample/test/test_bilinear.py:650: AssertionError
=============================== warnings summary ===============================
pyresample/test/test_spherical_geometry.py:25
  /builds/debian-gis-team/pyresample/debian/output/source_dir/.pybuild/cpython3_3.11_pyresample/build/pyresample/test/test_spherical_geometry.py:25: DeprecationWarning: This module will be removed in pyresample 2.0, please use the `pyresample.spherical` module functions and class instead.
    from pyresample.spherical_geometry import Arc, Coordinate

.pybuild/cpython3_3.11_pyresample/build/pyresample/test/test_area_config.py: 4 warnings
.pybuild/cpython3_3.11_pyresample/build/pyresample/test/test_bilinear.py: 27 warnings
.pybuild/cpython3_3.11_pyresample/build/pyresample/test/test_bucket.py: 20 warnings
.pybuild/cpython3_3.11_pyresample/build/pyresample/test/test_data_reduce.py: 2 warnings
.pybuild/cpython3_3.11_pyresample/build/pyresample/test/test_ewa_ll2cr.py: 1 warning
.pybuild/cpython3_3.11_pyresample/build/pyresample/test/test_geometry_legacy.py: 10 warnings
.pybuild/cpython3_3.11_pyresample/build/pyresample/test/test_grid.py: 9 warnings
.pybuild/cpython3_3.11_pyresample/build/pyresample/test/test_image.py: 15 warnings
.pybuild/cpython3_3.11_pyresample/build/pyresample/test/test_utils.py: 25 warnings
.pybuild/cpython3_3.11_pyresample/build/pyresample/test/test_geometry/test_area.py: 2 warnings

[...]

=========================== short test summary info ============================
FAILED pyresample/test/test_bilinear.py::TestNumpyBilinear::test_get_sample_from_bil_info - AssertionError: 0.9999999999999999 != 1.0
FAILED pyresample/test/test_bilinear.py::TestXarrayBilinear::test_get_sample_from_bil_info - AssertionError: 0.9999999999999999 != 1.0
= 2 failed, 1005 passed, 5 skipped, 41 deselected, 239 warnings in 295.54s (0:04:55) =