rio-tiler 7.2.1__py3-none-any.whl → 7.2.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__ = "7.2.1"
3
+ __version__ = "7.2.2"
4
4
 
5
5
  from . import ( # noqa
6
6
  colormap,
rio_tiler/utils.py CHANGED
@@ -33,7 +33,7 @@ from rasterio.warp import calculate_default_transform, transform_geom
33
33
 
34
34
  from rio_tiler.colormap import apply_cmap
35
35
  from rio_tiler.constants import WEB_MERCATOR_CRS, WGS84_CRS
36
- from rio_tiler.errors import RioTilerError
36
+ from rio_tiler.errors import InvalidFormat, RioTilerError
37
37
  from rio_tiler.types import BBox, ColorMapType, IntervalTuple, RIOResampling
38
38
 
39
39
 
@@ -588,24 +588,30 @@ def render(
588
588
  }
589
589
  output_profile.update(creation_options)
590
590
 
591
- with warnings.catch_warnings():
592
- warnings.filterwarnings(
593
- "ignore",
594
- category=NotGeoreferencedWarning,
595
- module="rasterio",
596
- )
597
- with MemoryFile() as memfile:
598
- with memfile.open(**output_profile) as dst:
599
- dst.write(data, indexes=list(range(1, count + 1)))
591
+ try:
592
+ with warnings.catch_warnings():
593
+ warnings.filterwarnings(
594
+ "ignore",
595
+ category=NotGeoreferencedWarning,
596
+ module="rasterio",
597
+ )
598
+ with MemoryFile() as memfile:
599
+ with memfile.open(**output_profile) as dst:
600
+ dst.write(data, indexes=list(range(1, count + 1)))
601
+
602
+ # Use Mask as an alpha band
603
+ if mask is not None:
604
+ if ColorInterp.alpha not in dst.colorinterp:
605
+ dst.colorinterp = *dst.colorinterp[:-1], ColorInterp.alpha
600
606
 
601
- # Use Mask as an alpha band
602
- if mask is not None:
603
- if ColorInterp.alpha not in dst.colorinterp:
604
- dst.colorinterp = *dst.colorinterp[:-1], ColorInterp.alpha
607
+ dst.write(mask.astype(data.dtype), indexes=count + 1)
605
608
 
606
- dst.write(mask.astype(data.dtype), indexes=count + 1)
609
+ return memfile.read()
607
610
 
608
- return memfile.read()
611
+ except Exception as e:
612
+ raise InvalidFormat(
613
+ f"Could not encode array of shape ({count},{height},{width}) and of datatype `{data.dtype}` using {img_format} driver"
614
+ ) from e
609
615
 
610
616
 
611
617
  def mapzen_elevation_rgb(data: numpy.ndarray) -> numpy.ndarray:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: rio-tiler
3
- Version: 7.2.1
3
+ Version: 7.2.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=OB3FKef6gLmJCPcAVLXOm65pGXyYbM3Woy6hlUUTb7o,192
1
+ rio_tiler/__init__.py,sha256=dShDwRuOOASdRz5UvqGC61lqPzE1q00kVIkNIEJK6m0,192
2
2
  rio_tiler/colormap.py,sha256=Ale0ToTrEKwP3JOhrySYKuQsfeeTgJT1YGBcmdssJ0k,11411
3
3
  rio_tiler/constants.py,sha256=55i-7JZDupTXZdLgxL03KsgM4lAzuGuIVP1zZKktzp0,426
4
4
  rio_tiler/errors.py,sha256=4I3i0e1FtkLX5sIX6dfhUMUj3SWWoKqkjCkSG7k5i2M,1901
@@ -10,7 +10,7 @@ rio_tiler/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  rio_tiler/reader.py,sha256=FiDQQU_v8mDk2JTxBpLmsTqaCQFOsjOw0LocasLeXjk,22721
11
11
  rio_tiler/tasks.py,sha256=tiQo24rZHBVxids40QkNInuMzDFEei08zYW3I_pkSVE,3157
12
12
  rio_tiler/types.py,sha256=wrGiiGBQ-WdzHf-lEypiH3cub7Knu_rXJw7EWZ2FAS8,1632
13
- rio_tiler/utils.py,sha256=_msIyfmDtvNnk3MGIENfGurTs2_Fb-hJ-YughEi82Rc,29507
13
+ rio_tiler/utils.py,sha256=X3gV8UJGP1LNvFbmFvuNjqeGVV0Iwsgw7-zbCPJwXec,29796
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
@@ -233,8 +233,8 @@ rio_tiler/mosaic/reader.py,sha256=_YBwTJwHvXOzKwpNpOmmh0F4yicyxgWo9vHyof3w_Do,96
233
233
  rio_tiler/mosaic/methods/__init__.py,sha256=tgkXM9skaTLXIm5QFoheOEznQXM97KGflcAWHfkrt1g,612
234
234
  rio_tiler/mosaic/methods/base.py,sha256=9YZJWVRwH5Fk9KO9q5CW52Q8Mf60tAJ21oM4ixEDXBo,1424
235
235
  rio_tiler/mosaic/methods/defaults.py,sha256=z34lna2wGXnAPwculjk_6hDrloqS8wzer68FFoIo7pg,6744
236
- rio_tiler-7.2.1.dist-info/METADATA,sha256=9zT-xK6xrp_qJGaYX_kweOSXuP31RpDbYomHceUfSPc,12202
237
- rio_tiler-7.2.1.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
238
- rio_tiler-7.2.1.dist-info/licenses/AUTHORS.txt,sha256=FCVd4Tjg-8syl0ZugCunpXER8X2-XonW2ZfllyTnRvE,158
239
- rio_tiler-7.2.1.dist-info/licenses/LICENSE,sha256=vq8Tt4KoYQT9JxAjQ4yXMmmhFYRTsBRgrOj-ao-bC5o,1517
240
- rio_tiler-7.2.1.dist-info/RECORD,,
236
+ rio_tiler-7.2.2.dist-info/METADATA,sha256=jbfLAj3UTICL7Kr3ax_ow29V_5z_rtMwmW1b6iZ4xnw,12202
237
+ rio_tiler-7.2.2.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
238
+ rio_tiler-7.2.2.dist-info/licenses/AUTHORS.txt,sha256=FCVd4Tjg-8syl0ZugCunpXER8X2-XonW2ZfllyTnRvE,158
239
+ rio_tiler-7.2.2.dist-info/licenses/LICENSE,sha256=vq8Tt4KoYQT9JxAjQ4yXMmmhFYRTsBRgrOj-ao-bC5o,1517
240
+ rio_tiler-7.2.2.dist-info/RECORD,,