Skip to content

Commit

Permalink
Fix colormap-based tests with new version of trollimage
Browse files Browse the repository at this point in the history
  • Loading branch information
djhoese committed Sep 21, 2023
1 parent 0266878 commit 52643d2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 20 deletions.
20 changes: 7 additions & 13 deletions satpy/tests/enhancement_tests/test_enhancements.py
Expand Up @@ -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):
Expand Down
14 changes: 7 additions & 7 deletions satpy/tests/test_composites.py
Expand Up @@ -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:
Expand Down

0 comments on commit 52643d2

Please sign in to comment.