rio-tiler 8.0.0__py3-none-any.whl → 8.0.2__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.2"
4
4
 
5
5
  from . import ( # noqa
6
6
  colormap,
@@ -14,7 +14,7 @@ from rasterio.features import geometry_mask
14
14
  from rio_tiler.constants import WEB_MERCATOR_TMS, WGS84_CRS
15
15
  from rio_tiler.errors import NoAssetFoundError, PointOutsideBounds
16
16
  from rio_tiler.io import BaseReader, MultiBandReader, MultiBaseReader, Reader
17
- from rio_tiler.models import ImageData, PointData
17
+ from rio_tiler.models import BandStatistics, ImageData, PointData
18
18
  from rio_tiler.mosaic import mosaic_reader
19
19
  from rio_tiler.tasks import multi_values_list
20
20
  from rio_tiler.types import BBox
@@ -233,10 +233,18 @@ class BaseBackend(BaseReader):
233
233
  ############################################################################
234
234
  # Not Implemented methods
235
235
  # BaseReader required those method to be implemented
236
- def statistics(self):
236
+ def statistics(
237
+ self,
238
+ search_options: dict | None = None,
239
+ **kwargs: Any,
240
+ ) -> dict[str, BandStatistics]:
237
241
  """PlaceHolder for statistics."""
238
242
  raise NotImplementedError
239
243
 
240
- def preview(self):
244
+ def preview( # type: ignore
245
+ self,
246
+ search_options: dict | None = None,
247
+ **kwargs: Any,
248
+ ) -> tuple[ImageData, list[str]]:
241
249
  """PlaceHolder for preview."""
242
250
  raise NotImplementedError
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.2
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=JQfYgVZSL_AJE1aRh8pcruMxVtxqG5V-yWsHkeYh82E,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
@@ -232,13 +232,13 @@ rio_tiler/io/rasterio.py,sha256=JcjHJYmntBx4yyLOnTOJsZ3631TNsXFHbVGwK2MPnS8,2919
232
232
  rio_tiler/io/stac.py,sha256=kIEW4F71PouXF-Ubpz-VVXujnp8LqftptPKDo_J3BTw,12831
233
233
  rio_tiler/io/xarray.py,sha256=jISNXCV2lBjs5qOYSLvSfrD7v6fO69sdsb7KC3fatUQ,26915
234
234
  rio_tiler/mosaic/__init__.py,sha256=Yj6CKpnFl8PJhLSp-a55wo33hKZ8-6OOBJtWA1HZVy8,118
235
- rio_tiler/mosaic/backend.py,sha256=OI4hOM2No30gQVSIyAAwgx6ntEvw0Rk9neTeOmwstrw,8200
235
+ rio_tiler/mosaic/backend.py,sha256=CtWoIPdLX3kF7FBxgac-HSUXXo3DD2xd0zKjnoOTbSY,8456
236
236
  rio_tiler/mosaic/reader.py,sha256=4sgl8IlV7zOtcfCt6XWw5UZLMCP0EgNbR2vRXObEGDA,11029
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.2.dist-info/METADATA,sha256=QyDLOAzojKcTtAAiUfXVPOAUj7KETUA5ltKGd-05bxc,11159
241
+ rio_tiler-8.0.2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
242
+ rio_tiler-8.0.2.dist-info/licenses/AUTHORS.txt,sha256=FCVd4Tjg-8syl0ZugCunpXER8X2-XonW2ZfllyTnRvE,158
243
+ rio_tiler-8.0.2.dist-info/licenses/LICENSE,sha256=vq8Tt4KoYQT9JxAjQ4yXMmmhFYRTsBRgrOj-ao-bC5o,1517
244
+ rio_tiler-8.0.2.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.27.0
2
+ Generator: hatchling 1.28.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any