From 52643d2f91523d063e7f7e55b9cb0657f80ac33c Mon Sep 17 00:00:00 2001 From: David Hoese Date: Wed, 6 Sep 2023 13:34:40 -0500 Subject: [PATCH] Fix colormap-based tests with new version of trollimage --- .../enhancement_tests/test_enhancements.py | 20 +++++++------------ satpy/tests/test_composites.py | 14 ++++++------- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/satpy/tests/enhancement_tests/test_enhancements.py b/satpy/tests/enhancement_tests/test_enhancements.py index 4420f4ea9b..e95c55a362 100644 --- a/satpy/tests/enhancement_tests/test_enhancements.py +++ b/satpy/tests/enhancement_tests/test_enhancements.py @@ -149,19 +149,13 @@ def test_colorize(self): from trollimage.colormap import brbg from satpy.enhancements import colorize - expected = np.array([[ - [np.nan, 3.29409498e-01, 3.29409498e-01, - 4.35952940e-06, 4.35952940e-06], - [4.35952940e-06, 4.35952940e-06, 4.35952940e-06, - 4.35952940e-06, 4.35952940e-06]], - [[np.nan, 1.88249866e-01, 1.88249866e-01, - 2.35302110e-01, 2.35302110e-01], - [2.35302110e-01, 2.35302110e-01, 2.35302110e-01, - 2.35302110e-01, 2.35302110e-01]], - [[np.nan, 1.96102817e-02, 1.96102817e-02, - 1.88238767e-01, 1.88238767e-01], - [1.88238767e-01, 1.88238767e-01, 1.88238767e-01, - 1.88238767e-01, 1.88238767e-01]]]) + expected = np.array([ + [[np.nan, 3.29411723e-01, 3.29411723e-01, 3.21825881e-08, 3.21825881e-08], + [3.21825881e-08, 3.21825881e-08, 3.21825881e-08, 3.21825881e-08, 3.21825881e-08]], + [[np.nan, 1.88235327e-01, 1.88235327e-01, 2.35294109e-01, 2.35294109e-01], + [2.35294109e-01, 2.35294109e-01, 2.35294109e-01, 2.35294109e-01, 2.35294109e-01]], + [[np.nan, 1.96078164e-02, 1.96078164e-02, 1.88235281e-01, 1.88235281e-01], + [1.88235281e-01, 1.88235281e-01, 1.88235281e-01, 1.88235281e-01, 1.88235281e-01]]]) run_and_check_enhancement(colorize, self.ch1, expected, palettes=brbg) def test_palettize(self): diff --git a/satpy/tests/test_composites.py b/satpy/tests/test_composites.py index f27c73d849..f056d2fa93 100644 --- a/satpy/tests/test_composites.py +++ b/satpy/tests/test_composites.py @@ -773,13 +773,13 @@ def test_colorize_with_interpolation(self): dims=['y', 'x'], attrs={'valid_range': np.array([2, 4])}) res = colormap_composite([data, palette]) - exp = np.array([[[1.0000149, 0.49804664, 0.24907766], - [0., 0.59844028, 1.0000149]], - [[1.00005405, 0.49806613, 0.24902255], - [0., 0.59846373, 1.00005405]], - [[1.00001585, 0.49804711, 0.24896771], - [0., 0.59844073, 1.00001585]]]) - self.assertTrue(np.allclose(res, exp, atol=1e-4)) + exp = np.array([[[1.0, 0.498039, 0.246575], + [0., 0.59309977, 1.0]], + [[1.0, 0.49803924, 0.24657543], + [0., 0.59309983, 1.0]], + [[1.0, 0.4980392, 0.24657541], + [0., 0.59309978, 1.0]]]) + np.testing.assert_allclose(res, exp, atol=1e-4) class TestCloudCompositorWithoutCloudfree: