rio-tiler 8.0.0__py3-none-any.whl → 8.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
rio_tiler/__init__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  """rio-tiler."""
2
2
 
3
- __version__ = "8.0.0"
3
+ __version__ = "8.0.1"
4
4
 
5
5
  from . import ( # noqa
6
6
  colormap,
rio_tiler/utils.py CHANGED
@@ -22,7 +22,7 @@ from affine import Affine
22
22
  from numpy.typing import NDArray
23
23
  from rasterio import windows
24
24
  from rasterio.crs import CRS
25
- from rasterio.dtypes import _gdal_typename
25
+ from rasterio.dtypes import _gdal_typename, dtype_ranges
26
26
  from rasterio.enums import ColorInterp, MaskFlags, Resampling
27
27
  from rasterio.errors import NotGeoreferencedWarning
28
28
  from rasterio.features import is_valid_geom
@@ -583,13 +583,18 @@ def render(
583
583
  if len(data.shape) < 3:
584
584
  data = numpy.expand_dims(data, axis=0)
585
585
 
586
+ input_range = dtype_ranges[str(data.dtype)]
586
587
  if colormap:
587
588
  data, alpha = apply_cmap(data, colormap)
589
+
588
590
  # We take both the input mask and the alpha from the colormap
589
591
  # if input mask is not provided then we assume output is wanted without alpha band
590
592
  # this can be seen as a bug but at the time of writing we assume it's a feature.
591
593
  if mask is not None:
592
- mask = numpy.bitwise_and(alpha, mask)
594
+ output_range = dtype_ranges[str(data.dtype)]
595
+ mask = numpy.where(mask != input_range[0], alpha, output_range[0]).astype(
596
+ data.dtype
597
+ )
593
598
 
594
599
  # WEBP doesn't support 1band dataset so we must hack to create a RGB dataset
595
600
  if img_format == "WEBP" and data.shape[0] == 1:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rio-tiler
3
- Version: 8.0.0
3
+ Version: 8.0.1
4
4
  Summary: User friendly Rasterio plugin to read raster datasets.
5
5
  Project-URL: Homepage, https://cogeotiff.github.io/rio-tiler/
6
6
  Project-URL: Documentation, https://cogeotiff.github.io/rio-tiler/
@@ -1,4 +1,4 @@
1
- rio_tiler/__init__.py,sha256=lKZDEOYy6ewX4dX9hskgOUWtXPSxhBHJ4fzw3Yvf6Zc,192
1
+ rio_tiler/__init__.py,sha256=77LzwC1fxfWc1U7s3fn_IozatWK_bVwuwhHX3mpkrog,192
2
2
  rio_tiler/colormap.py,sha256=4sG9VIfDAHI-ckQgmci0-U-wL9ZU9exZJszgsrt8wBA,11310
3
3
  rio_tiler/constants.py,sha256=55i-7JZDupTXZdLgxL03KsgM4lAzuGuIVP1zZKktzp0,426
4
4
  rio_tiler/errors.py,sha256=GFAuE1AaSvx6dd0z5um9n3y1wVzUyQ5S8qY7_tXdrR8,2178
@@ -10,7 +10,7 @@ rio_tiler/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  rio_tiler/reader.py,sha256=5JVlhJS8Ra8jPPVkjkRw2UuXOnG7mPtKxYlDC9vF6qI,25047
11
11
  rio_tiler/tasks.py,sha256=7MwIicDMSCScsbds6crWRa7lRwvvt2cbGQAxybkrRvk,3613
12
12
  rio_tiler/types.py,sha256=R9XOL-EEb_cwbD4SFNVmViXC84D2p4BEVNCXg0nlh7I,1684
13
- rio_tiler/utils.py,sha256=BwTHM_qmwRl0QEHwf7qQa22zdQPWeuhUHzCDqlUDkU8,32156
13
+ rio_tiler/utils.py,sha256=2c3XHEcKcRsOuXlbQT6SF7WjI_3U0kVo1LF-NYT0gY8,32354
14
14
  rio_tiler/cmap_data/__init__.py,sha256=8FtVmfpTjXlvhxQ5QesN0UC1m_B3MuF3LbGbhMC5Rw4,1039
15
15
  rio_tiler/cmap_data/accent.npy,sha256=Qde1ldOoXghe4L05v1QbVvnMA1ldwNjKWPf5xCBbmI4,1152
16
16
  rio_tiler/cmap_data/accent_r.npy,sha256=ba-GWSMSPRAcm9CGzlXJeNG4ABbBHDCV602hAWV2idc,1152
@@ -237,8 +237,8 @@ rio_tiler/mosaic/reader.py,sha256=4sgl8IlV7zOtcfCt6XWw5UZLMCP0EgNbR2vRXObEGDA,11
237
237
  rio_tiler/mosaic/methods/__init__.py,sha256=tgkXM9skaTLXIm5QFoheOEznQXM97KGflcAWHfkrt1g,612
238
238
  rio_tiler/mosaic/methods/base.py,sha256=9YZJWVRwH5Fk9KO9q5CW52Q8Mf60tAJ21oM4ixEDXBo,1424
239
239
  rio_tiler/mosaic/methods/defaults.py,sha256=P-zSVVgvQ2oRiMchC3bMqIYLTX7H3743jsD_VmqStxM,7642
240
- rio_tiler-8.0.0.dist-info/METADATA,sha256=wIZwjY9mXGOW3o3KvcLq-UreK9LX433GBkdvbhFv6yM,11159
241
- rio_tiler-8.0.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
242
- rio_tiler-8.0.0.dist-info/licenses/AUTHORS.txt,sha256=FCVd4Tjg-8syl0ZugCunpXER8X2-XonW2ZfllyTnRvE,158
243
- rio_tiler-8.0.0.dist-info/licenses/LICENSE,sha256=vq8Tt4KoYQT9JxAjQ4yXMmmhFYRTsBRgrOj-ao-bC5o,1517
244
- rio_tiler-8.0.0.dist-info/RECORD,,
240
+ rio_tiler-8.0.1.dist-info/METADATA,sha256=nFJH0CPiXGm4DABE5b6Kp6pljLgBjQIMRYkGYrfwhX4,11159
241
+ rio_tiler-8.0.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
242
+ rio_tiler-8.0.1.dist-info/licenses/AUTHORS.txt,sha256=FCVd4Tjg-8syl0ZugCunpXER8X2-XonW2ZfllyTnRvE,158
243
+ rio_tiler-8.0.1.dist-info/licenses/LICENSE,sha256=vq8Tt4KoYQT9JxAjQ4yXMmmhFYRTsBRgrOj-ao-bC5o,1517
244
+ rio_tiler-8.0.1.dist-info/RECORD,,