[Git][debian-gis-team/trollimage][upstream] New upstream version 1.25.0
Antonio Valentino (@antonio.valentino)
gitlab at salsa.debian.org
Thu Aug 15 16:15:05 BST 2024
Antonio Valentino pushed to branch upstream at Debian GIS Project / trollimage
Commits:
40ed993b by Antonio Valentino at 2024-08-15T14:39:52+00:00
New upstream version 1.25.0
- - - - -
7 changed files:
- .github/workflows/deploy.yaml
- CHANGELOG.md
- trollimage/colormap.py
- trollimage/tests/test_colormap.py
- trollimage/tests/test_image.py
- trollimage/version.py
- trollimage/xrimage.py
Changes:
=====================================
.github/workflows/deploy.yaml
=====================================
@@ -37,7 +37,7 @@ jobs:
- os: windows-2019
cibw_archs: "AMD64 ARM64"
artifact_name: "win"
- - os: macos-11
+ - os: macos-12
cibw_archs: "x86_64 arm64"
artifact_name: "mac"
- os: "ubuntu-20.04"
@@ -59,7 +59,7 @@ jobs:
platforms: all
- name: Build wheels
- uses: pypa/cibuildwheel at v2.18.1
+ uses: pypa/cibuildwheel at v2.19.2
env:
CIBW_SKIP: "cp36-* cp37-* cp38-* pp* *-manylinux_i686 *-musllinux_i686 *-musllinux_aarch64 *-win32"
CIBW_ARCHS: "${{ matrix.cibw_archs }}"
@@ -101,14 +101,14 @@ jobs:
path: dist
- name: Publish package to Test PyPI
if: github.event.action != 'published' && github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
- uses: pypa/gh-action-pypi-publish at v1.8.14
+ uses: pypa/gh-action-pypi-publish at v1.9.0
with:
user: __token__
password: ${{ secrets.test_pypi_password }}
repository_url: https://test.pypi.org/legacy/
- name: Publish package to PyPI
if: github.event.action == 'published'
- uses: pypa/gh-action-pypi-publish at v1.8.14
+ uses: pypa/gh-action-pypi-publish at v1.9.0
with:
user: __token__
password: ${{ secrets.pypi_password }}
=====================================
CHANGELOG.md
=====================================
@@ -1,3 +1,24 @@
+## Version 1.25.0 (2024/08/15)
+
+### Issues Closed
+
+* [Issue 175](https://github.com/pytroll/trollimage/issues/175) - palettize fails in numpy2 ([PR 176](https://github.com/pytroll/trollimage/pull/176) by [@gerritholl](https://github.com/gerritholl))
+
+In this release 1 issue was closed.
+
+### Pull Requests Merged
+
+#### Bugs fixed
+
+* [PR 176](https://github.com/pytroll/trollimage/pull/176) - Make palettize work on numpy 2.0. ([175](https://github.com/pytroll/trollimage/issues/175))
+
+#### Features added
+
+* [PR 177](https://github.com/pytroll/trollimage/pull/177) - Allow overriding scale and offset values ([2869](https://github.com/pytroll/satpy/issues/2869))
+
+In this release 2 pull requests were closed.
+
+
## Version 1.24.0 (2024/06/20)
=====================================
trollimage/colormap.py
=====================================
@@ -179,11 +179,11 @@ def _palettize(arr, values):
def _digitize_array(arr, values):
if values[0] <= values[-1]:
# monotonic increasing values
- outside_range_bin = max(np.nanmax(arr), values.max()) + 1
+ outside_range_bin = max(np.nanmax(arr), values.max()) + np.int64(1)
right = False
else:
# monotonic decreasing values
- outside_range_bin = min(np.nanmin(arr), values.min()) - 1
+ outside_range_bin = min(np.nanmin(arr), values.min()) - np.int64(1)
right = True
bins = np.concatenate((values, [outside_range_bin]))
=====================================
trollimage/tests/test_colormap.py
=====================================
@@ -414,6 +414,15 @@ class TestColormap:
[0, 1, 2, 3]])
assert channels.dtype == int
+ def test_palettize_edge_of_dtype_range(self):
+ """Test palettize when bins span the entire dtype range."""
+ from trollimage.colormap import palettize
+
+ arr = np.linspace(0, 255, 100, dtype=np.uint8).reshape(10, 10)
+ colors = np.linspace(0, 255, 768).reshape(256, 3)
+ values = np.arange(0, 256, dtype=np.uint8)
+ palettize(arr, colors, values)
+
@pytest.mark.parametrize(
("input_cmap_func", "expected_result"),
[
=====================================
trollimage/tests/test_image.py
=====================================
@@ -2676,6 +2676,15 @@ class TestXRImageSaveScaleOffset:
expected_tags,
scale_offset_tags=("gradient", "axis_intercept"))
+ @pytest.mark.skipif(sys.platform.startswith('win'), reason="'NamedTemporaryFile' not supported on Windows")
+ def test_save_scale_offset_custom_values(self):
+ """Test saving GeoTIFF overriding the scale/offset values."""
+ expected_tags = {"gradient": 1, "axis_intercept": 0}
+ self.img.stretch()
+ self._save_and_check_tags(
+ expected_tags,
+ scale_offset_tags={"gradient": 1, "axis_intercept": 0})
+
def _get_tags_after_writing_to_geotiff(data):
import rasterio as rio
=====================================
trollimage/version.py
=====================================
@@ -26,9 +26,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 = " (HEAD -> main, tag: v1.24.0)"
- git_full = "5de5037532e3433a2122c57a173c984e76c8a1fb"
- git_date = "2024-06-20 10:24:19 +0200"
+ git_refnames = " (HEAD -> main, tag: v1.25.0)"
+ git_full = "f3eae46c604e8964fadf2c1056d74d6c5cb10a3f"
+ git_date = "2024-08-15 15:12:05 +0200"
keywords = {"refnames": git_refnames, "full": git_full, "date": git_date}
return keywords
=====================================
trollimage/xrimage.py
=====================================
@@ -305,7 +305,7 @@ class XRImage:
provided. Common values include `nearest` (default),
`bilinear`, `average`, and many others. See the rasterio
documentation for more information.
- scale_offset_tags (Tuple[str, str] or None):
+ scale_offset_tags (Tuple[str, str] or Dict[str, number] or None):
If set to a ``(str, str)`` tuple, scale and offset will be
stored in GDALMetaData tags. Those can then be used to
retrieve the original data values from pixel values.
@@ -314,7 +314,9 @@ class XRImage:
represented by a simple scale and offset. Scale and offset
are also saved as (NaN, NaN) for multi-band images (ex. RGB)
as storing multiple values in a single GDALMetaData tag is not
- currently supported.
+ currently supported. If set to a dictionary, automatically
+ determined scale/offset values are overruled by the values
+ provided in the keys.
colormap_tag (str or None):
If set and the image was colorized or palettized, a tag will
be added with this name with the value of a comma-separated
@@ -471,7 +473,11 @@ class XRImage:
def _add_scale_offset_to_tags(self, scale_offset_tags, data_arr, tags):
scale_label, offset_label = scale_offset_tags
- scale, offset = self.get_scaling_from_history(data_arr.attrs.get('enhancement_history', []))
+ try:
+ scale = scale_offset_tags[scale_label]
+ offset = scale_offset_tags[offset_label]
+ except TypeError:
+ scale, offset = self.get_scaling_from_history(data_arr.attrs.get('enhancement_history', []))
tags[scale_label], tags[offset_label] = invert_scale_offset(scale, offset)
def get_scaling_from_history(self, history=None):
View it on GitLab: https://salsa.debian.org/debian-gis-team/trollimage/-/commit/40ed993b60d7255b14a90cbc208df7c01a5763c2
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/trollimage/-/commit/40ed993b60d7255b14a90cbc208df7c01a5763c2
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/20240815/b31b9b84/attachment-0001.htm>
More information about the Pkg-grass-devel
mailing list