[Git][debian-gis-team/pyresample][master] Improve 0006-Floating-point-comparison.patch

Antonio Valentino (@antonio.valentino) gitlab at salsa.debian.org
Sat Sep 9 12:23:08 BST 2023



Antonio Valentino pushed to branch master at Debian GIS Project / pyresample


Commits:
d52e2d54 by Antonio Valentino at 2023-09-09T11:22:55+00:00
Improve 0006-Floating-point-comparison.patch

- - - - -


1 changed file:

- debian/patches/0006-Floating-point-comparison.patch


Changes:

=====================================
debian/patches/0006-Floating-point-comparison.patch
=====================================
@@ -3,11 +3,11 @@ Date: Sat, 9 Sep 2023 10:52:32 +0000
 Subject: Floating point comparison
 
 ---
- pyresample/test/test_bilinear.py | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
+ pyresample/test/test_bilinear.py | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
 
 diff --git a/pyresample/test/test_bilinear.py b/pyresample/test/test_bilinear.py
-index d3168dd..e95d81c 100644
+index d3168dd..7c008c4 100644
 --- a/pyresample/test/test_bilinear.py
 +++ b/pyresample/test/test_bilinear.py
 @@ -308,11 +308,11 @@ class TestNumpyBilinear(unittest.TestCase):
@@ -15,12 +15,48 @@ index d3168dd..e95d81c 100644
          res = get_sample_from_bil_info(self.data1.ravel(), t__, s__,
                                         input_idxs, idx_arr)
 -        self.assertEqual(res.ravel()[5], 1.)
-+        np.testing.assert_allclose(res.ravel()[5], 1.)
++        self.assertAlmostEqual(res.ravel()[5], 1.)
          # Sample from data2
          res = get_sample_from_bil_info(self.data2.ravel(), t__, s__,
                                         input_idxs, idx_arr)
 -        self.assertEqual(res.ravel()[5], 2.)
-+        np.testing.assert_allclose(res.ravel()[5], 2.)
++        self.assertAlmostEqual(res.ravel()[5], 2.)
          # Reshaping
          res = get_sample_from_bil_info(self.data2.ravel(), t__, s__,
                                         input_idxs, idx_arr,
+@@ -326,7 +326,7 @@ class TestNumpyBilinear(unittest.TestCase):
+                                        input_idxs, idx_arr,
+                                        output_shape=self.target_def.shape)
+         # Four pixels are outside of the data
+-        self.assertEqual(np.isnan(res).sum(), 4)
++        self.assertAlmostEqual(np.isnan(res).sum(), 4)
+ 
+         # Masked array as input, result should be plain Numpy array
+         data = np.ma.masked_all(self.data1.shape)
+@@ -647,7 +647,7 @@ class TestXarrayBilinear(unittest.TestCase):
+         res = resampler.get_sample_from_bil_info(self.data1)
+         res = res.compute()
+         # Check couple of values
+-        self.assertEqual(res.values[1, 1], 1.)
++        self.assertAlmostEqual(res.values[1, 1], 1.)
+         self.assertTrue(np.isnan(res.values[0, 3]))
+         # Check that the values haven't gone down or up a lot
+         self.assertAlmostEqual(np.nanmin(res.values), 1.)
+@@ -658,7 +658,7 @@ class TestXarrayBilinear(unittest.TestCase):
+         # Sample from data1, custom fill value
+         res = resampler.get_sample_from_bil_info(self.data1, fill_value=-1.0)
+         res = res.compute()
+-        self.assertEqual(np.nanmin(res.values), -1.)
++        self.assertAlmostEqual(np.nanmin(res.values), -1.)
+ 
+         # Sample from integer data
+         res = resampler.get_sample_from_bil_info(self.data1.astype(np.uint8),
+@@ -666,7 +666,7 @@ class TestXarrayBilinear(unittest.TestCase):
+         res = res.compute()
+         # Five values should be filled with zeros, which is the
+         # default fill_value for integer data
+-        self.assertEqual(np.sum(res == 0), 6)
++        self.assertAlmostEqual(np.sum(res == 0), 6)
+ 
+         # Output coordinates should have been set
+         self.assertTrue(isinstance(resampler._out_coords, dict))



View it on GitLab: https://salsa.debian.org/debian-gis-team/pyresample/-/commit/d52e2d545f2fc3d60a5fa86ac61f4b3c5507b917

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/pyresample/-/commit/d52e2d545f2fc3d60a5fa86ac61f4b3c5507b917
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20230909/730b5815/attachment-0001.htm>


More information about the Pkg-grass-devel mailing list