Antonio Valentino pushed to branch upstream at Debian GIS Project / trollimage
Commits: d0f61d39 by Antonio Valentino at 2023-02-04T08:19:44+00:00 New upstream version 1.20.1 - - - - - 5 changed files: - CHANGELOG.md - rtd_requirements.txt - trollimage/colormap.py - trollimage/tests/test_colormap.py - trollimage/version.py Changes: ===================================== CHANGELOG.md ===================================== @@ -1,3 +1,19 @@ +## Version 1.20.1 (2023/02/03) + + +### Pull Requests Merged + +#### Bugs fixed + +* [PR 123](https://github.com/pytroll/trollimage/pull/123) - Don't scale colormap values if they're ints ([2376](https://github.com/pytroll/satpy/issues/2376)) + +#### Features added + +* [PR 120](https://github.com/pytroll/trollimage/pull/120) - [Snyk] Security upgrade setuptools from 39.0.1 to 65.5.1 + +In this release 2 pull requests were closed. + + ## Version 1.20.0 (2023/01/11) ===================================== rtd_requirements.txt ===================================== @@ -6,3 +6,4 @@ docutils<0.18 sphinx>=5,<6 sphinx-rtd-theme>=1.1.0,<2.0 +setuptools>=65.5.1 # not directly required, pinned by Snyk to avoid a vulnerability ===================================== trollimage/colormap.py ===================================== @@ -681,16 +681,18 @@ class Colormap(object): color_array, "VRGB" if color_array.shape[1] == 4 else "VRGBA", color_scale=color_scale) + if dtype == np.dtype("uint8"): + return colormap + if valid_range is not None: if set_range: colormap.set_range( *(np.array(valid_range) * scale_factor + add_offset)) - else: - if dtype != np.dtype("uint8"): - raise AttributeError("Data need to have either a valid_range or be of type uint8" + - " in order to be displayable with an attached color-palette!") - return colormap + return colormap + + raise AttributeError("Data need to have either a valid_range or be of type uint8" + + " in order to be displayable with an attached color-palette!") def _is_actually_a_csv_string(string): ===================================== trollimage/tests/test_colormap.py ===================================== @@ -684,11 +684,23 @@ def test_cmap_from_sequence_of_colors(): def test_build_colormap_with_int_data_and_without_meanings(): - """Test colormap building.""" + """Test colormap building from uint8 array with metadata.""" palette = np.array([[0, 0, 0], [127, 127, 127], [255, 255, 255]]) cmap = colormap.Colormap.from_array_with_metadata(palette, np.uint8) np.testing.assert_array_equal(cmap.values, [0, 1]) + # test that values are respected even if valid_range is passed + # see https://github.com/pytroll/satpy/issues/2376 + cmap = colormap.Colormap.from_array_with_metadata( + palette, np.uint8, valid_range=[0, 100]) + + np.testing.assert_array_equal(cmap.values, [0, 1]) + + +def test_build_colormap_with_float_data(): + """Test colormap building for float data""" + palette = np.array([[0, 0, 0], [127, 127, 127], [255, 255, 255]]) + with pytest.raises(AttributeError): colormap.Colormap.from_array_with_metadata(palette/100, np.float32) ===================================== trollimage/version.py ===================================== @@ -23,9 +23,9 @@ def get_keywords(): # setup.py/versioneer.py will grep for the variable names, so they must # each be defined on a line of their own. _version.py will just call # get_keywords(). - git_refnames = " (tag: v1.20.0)" - git_full = "d87d61cdc9f29998fb26af354fa7e6a897760103" - git_date = "2023-01-11 12:33:44 +0100" + git_refnames = " (HEAD -> main, tag: v1.20.1)" + git_full = "02b8330165815649e3570b03d5e8b07d2dbd7fca" + git_date = "2023-02-03 15:09:25 +0100" keywords = {"refnames": git_refnames, "full": git_full, "date": git_date} return keywords View it on GitLab: https://salsa.debian.org/debian-gis-team/trollimage/-/commit/d0f61d399f9c39a75739c7e54d2604d50fe32bd9 -- View it on GitLab: https://salsa.debian.org/debian-gis-team/trollimage/-/commit/d0f61d399f9c39a75739c7e54d2604d50fe32bd9 You're receiving this email because of your account on salsa.debian.org.
_______________________________________________ Pkg-grass-devel mailing list [email protected] https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-grass-devel
