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

Fix tests on i386 #540

Merged
merged 1 commit into from
Sep 9, 2023

Conversation

avalentino
Copy link
Contributor

  • Closes #xxxx
  • Tests added
  • Tests passed
  • Passes git diff origin/main **/*py | flake8 --diff
  • Fully documented

@codecov
Copy link

codecov bot commented Sep 9, 2023

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

Coverage Status

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

@djhoese djhoese merged commit efa0469 into pytroll:main Sep 9, 2023
30 checks passed
@djhoese
Copy link
Member

djhoese commented Sep 9, 2023

Thanks!

@djhoese
Copy link
Member

djhoese commented Sep 9, 2023

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

@avalentino avalentino deleted the bugfix/floating-point-comparison branch September 9, 2023 16:42
@avalentino
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants