rio-tiler 7.9.0__py3-none-any.whl → 7.9.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__ = "7.9.0"
3
+ __version__ = "7.9.1"
4
4
 
5
5
  from . import ( # noqa
6
6
  colormap,
rio_tiler/io/xarray.py CHANGED
@@ -377,22 +377,12 @@ class XarrayReader(BaseReader):
377
377
  src_height = round(w.height)
378
378
  src_width = round(w.width)
379
379
 
380
- # Specific FIX when bounds and transform are inverted
381
- # See: https://github.com/US-GHG-Center/veda-config-ghg/pull/333
382
- elif (
383
- self.crs == WGS84_CRS
384
- and dst_crs == WEB_MERCATOR_CRS
385
- and (src_bounds[1] > 85.06 or src_bounds[3] < -85.06)
386
- ):
387
- warnings.warn(
388
- "Adjusting dataset latitudes to avoid re-projection overflow",
389
- UserWarning,
390
- )
391
- src_bounds[1] = min(src_bounds[1], 85.06)
392
- src_bounds[3] = max(src_bounds[3], -85.06)
393
- w = windows.from_bounds(*src_bounds, transform=src_transform)
394
- src_height = round(w.height)
395
- src_width = round(w.width)
380
+ # South->North
381
+ if src_transform.e > 0:
382
+ src_bounds = [src_bounds[0], src_bounds[3], src_bounds[2], src_bounds[1]]
383
+ # West->East
384
+ if src_transform.a < 0:
385
+ src_bounds = [src_bounds[2], src_bounds[1], src_bounds[1], src_bounds[3]]
396
386
 
397
387
  if dst_crs != self.crs:
398
388
  # transform of the reprojected dataset
@@ -503,12 +493,55 @@ class XarrayReader(BaseReader):
503
493
  da = da.rio.write_nodata(nodata)
504
494
 
505
495
  if dst_crs and dst_crs != self.crs:
496
+ src_width = da.rio.width
497
+ src_height = da.rio.height
498
+ src_bounds = list(da.rio.bounds())
499
+ src_transform = da.rio.transform()
500
+
501
+ # Fix for https://github.com/cogeotiff/rio-tiler/issues/654
502
+ #
503
+ # When using `calculate_default_transform` with dataset
504
+ # which span at high/low latitude outside the area_of_use
505
+ # of the WebMercator projection, we `crop` the dataset
506
+ # to get the transform (resolution).
507
+ #
508
+ # Note: Should be handled in gdal 3.8 directly
509
+ # https://github.com/OSGeo/gdal/pull/8775
510
+ if (
511
+ self.crs == WGS84_CRS
512
+ and dst_crs == WEB_MERCATOR_CRS
513
+ and (src_bounds[1] < -85.06 or src_bounds[3] > 85.06)
514
+ ):
515
+ warnings.warn(
516
+ "Adjusting dataset latitudes to avoid re-projection overflow",
517
+ UserWarning,
518
+ )
519
+ src_bounds[1] = max(src_bounds[1], -85.06)
520
+ src_bounds[3] = min(src_bounds[3], 85.06)
521
+
522
+ # North->South
523
+ if src_transform.e > 0:
524
+ src_bounds = [
525
+ src_bounds[0],
526
+ src_bounds[3],
527
+ src_bounds[2],
528
+ src_bounds[1],
529
+ ]
530
+ # West->East
531
+ if src_transform.a < 0:
532
+ src_bounds = [
533
+ src_bounds[2],
534
+ src_bounds[1],
535
+ src_bounds[1],
536
+ src_bounds[3],
537
+ ]
538
+
539
+ w = windows.from_bounds(*src_bounds, transform=src_transform)
540
+ src_height = round(w.height)
541
+ src_width = round(w.width)
542
+
506
543
  dst_transform, w, h = calculate_default_transform(
507
- self.crs,
508
- dst_crs,
509
- da.rio.width,
510
- da.rio.height,
511
- *da.rio.bounds(),
544
+ self.crs, dst_crs, src_width, src_height, *src_bounds
512
545
  )
513
546
  da = da.rio.reproject(
514
547
  dst_crs,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rio-tiler
3
- Version: 7.9.0
3
+ Version: 7.9.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=OrclbvOrb3mpW7AwcUiQg8wbF9_hhUt2f5LbaJzsUG8,192
1
+ rio_tiler/__init__.py,sha256=YThzVeYCnRjWaIFIecxo-nASIfT35DphbGriDl1EOWQ,192
2
2
  rio_tiler/colormap.py,sha256=E2FYp6AysmnSAhj2901XUrgB2q-8OvO8zoe_hmM_UZU,11186
3
3
  rio_tiler/constants.py,sha256=55i-7JZDupTXZdLgxL03KsgM4lAzuGuIVP1zZKktzp0,426
4
4
  rio_tiler/errors.py,sha256=dnaAHPc5VL7SNKXm00gzlrU_4XIuw5rwzD-9Q2kFJsc,2018
@@ -229,14 +229,14 @@ rio_tiler/io/__init__.py,sha256=_L4iILm6vSiJ14GEDDOvkuUHRtbWC9oqx6Bu8PxHhvA,270
229
229
  rio_tiler/io/base.py,sha256=nyaAtfodM-5fXd1WsGG5Qh544PNv9Hy4FLQ_nPj8hw8,52154
230
230
  rio_tiler/io/rasterio.py,sha256=4j4ffxsBHD7wg2R1p6x6JE_7UZjMZQGx29qtO6JEs8U,29636
231
231
  rio_tiler/io/stac.py,sha256=kIEW4F71PouXF-Ubpz-VVXujnp8LqftptPKDo_J3BTw,12831
232
- rio_tiler/io/xarray.py,sha256=Ueln1KHiVVlCE5aXYn8RTrO2r8AS3e0NG_jNJFfq7zU,25046
232
+ rio_tiler/io/xarray.py,sha256=Xo1sh9Z8VVhgZE7P2RI5xlt85lxnOrd6eJIPOU58rSc,26400
233
233
  rio_tiler/mosaic/__init__.py,sha256=Yj6CKpnFl8PJhLSp-a55wo33hKZ8-6OOBJtWA1HZVy8,118
234
234
  rio_tiler/mosaic/reader.py,sha256=KSk6DaUJRN4Ye8lJ-V12sl5i2FN6y9o4wS1GzVSmtgU,10694
235
235
  rio_tiler/mosaic/methods/__init__.py,sha256=tgkXM9skaTLXIm5QFoheOEznQXM97KGflcAWHfkrt1g,612
236
236
  rio_tiler/mosaic/methods/base.py,sha256=9YZJWVRwH5Fk9KO9q5CW52Q8Mf60tAJ21oM4ixEDXBo,1424
237
237
  rio_tiler/mosaic/methods/defaults.py,sha256=P-zSVVgvQ2oRiMchC3bMqIYLTX7H3743jsD_VmqStxM,7642
238
- rio_tiler-7.9.0.dist-info/METADATA,sha256=YTwbXXq0DRb-54pMilhpO-GvvJZGhzCjK-CWGZN2BMY,12233
239
- rio_tiler-7.9.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
240
- rio_tiler-7.9.0.dist-info/licenses/AUTHORS.txt,sha256=FCVd4Tjg-8syl0ZugCunpXER8X2-XonW2ZfllyTnRvE,158
241
- rio_tiler-7.9.0.dist-info/licenses/LICENSE,sha256=vq8Tt4KoYQT9JxAjQ4yXMmmhFYRTsBRgrOj-ao-bC5o,1517
242
- rio_tiler-7.9.0.dist-info/RECORD,,
238
+ rio_tiler-7.9.1.dist-info/METADATA,sha256=xdQNle1Y87PL7xkgEGe0nV3iPt-Oxgrmo8Y6DzQT9kE,12233
239
+ rio_tiler-7.9.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
240
+ rio_tiler-7.9.1.dist-info/licenses/AUTHORS.txt,sha256=FCVd4Tjg-8syl0ZugCunpXER8X2-XonW2ZfllyTnRvE,158
241
+ rio_tiler-7.9.1.dist-info/licenses/LICENSE,sha256=vq8Tt4KoYQT9JxAjQ4yXMmmhFYRTsBRgrOj-ao-bC5o,1517
242
+ rio_tiler-7.9.1.dist-info/RECORD,,