rio-tiler 7.9.0__py3-none-any.whl → 7.9.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.9.0"
3
+ __version__ = "7.9.2"
4
4
 
5
5
  from . import ( # noqa
6
6
  colormap,
rio_tiler/io/xarray.py CHANGED
@@ -373,23 +373,14 @@ class XarrayReader(BaseReader):
373
373
  )
374
374
  src_bounds[1] = max(src_bounds[1], -85.06)
375
375
  src_bounds[3] = min(src_bounds[3], 85.06)
376
- w = windows.from_bounds(*src_bounds, transform=src_transform)
377
- src_height = round(w.height)
378
- src_width = round(w.width)
379
376
 
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)
377
+ # South->North
378
+ if src_transform.e > 0:
379
+ src_bounds = [src_bounds[0], src_bounds[3], src_bounds[2], src_bounds[1]]
380
+ # West->East
381
+ if src_transform.a < 0:
382
+ src_bounds = [src_bounds[2], src_bounds[1], src_bounds[1], src_bounds[3]]
383
+
393
384
  w = windows.from_bounds(*src_bounds, transform=src_transform)
394
385
  src_height = round(w.height)
395
386
  src_width = round(w.width)
@@ -503,12 +494,55 @@ class XarrayReader(BaseReader):
503
494
  da = da.rio.write_nodata(nodata)
504
495
 
505
496
  if dst_crs and dst_crs != self.crs:
497
+ src_width = da.rio.width
498
+ src_height = da.rio.height
499
+ src_bounds = list(da.rio.bounds())
500
+ src_transform = da.rio.transform()
501
+
502
+ # Fix for https://github.com/cogeotiff/rio-tiler/issues/654
503
+ #
504
+ # When using `calculate_default_transform` with dataset
505
+ # which span at high/low latitude outside the area_of_use
506
+ # of the WebMercator projection, we `crop` the dataset
507
+ # to get the transform (resolution).
508
+ #
509
+ # Note: Should be handled in gdal 3.8 directly
510
+ # https://github.com/OSGeo/gdal/pull/8775
511
+ if (
512
+ self.crs == WGS84_CRS
513
+ and dst_crs == WEB_MERCATOR_CRS
514
+ and (src_bounds[1] < -85.06 or src_bounds[3] > 85.06)
515
+ ):
516
+ warnings.warn(
517
+ "Adjusting dataset latitudes to avoid re-projection overflow",
518
+ UserWarning,
519
+ )
520
+ src_bounds[1] = max(src_bounds[1], -85.06)
521
+ src_bounds[3] = min(src_bounds[3], 85.06)
522
+
523
+ # North->South
524
+ if src_transform.e > 0:
525
+ src_bounds = [
526
+ src_bounds[0],
527
+ src_bounds[3],
528
+ src_bounds[2],
529
+ src_bounds[1],
530
+ ]
531
+ # West->East
532
+ if src_transform.a < 0:
533
+ src_bounds = [
534
+ src_bounds[2],
535
+ src_bounds[1],
536
+ src_bounds[1],
537
+ src_bounds[3],
538
+ ]
539
+
540
+ w = windows.from_bounds(*src_bounds, transform=src_transform)
541
+ src_height = round(w.height)
542
+ src_width = round(w.width)
543
+
506
544
  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(),
545
+ self.crs, dst_crs, src_width, src_height, *src_bounds
512
546
  )
513
547
  da = da.rio.reproject(
514
548
  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.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=OrclbvOrb3mpW7AwcUiQg8wbF9_hhUt2f5LbaJzsUG8,192
1
+ rio_tiler/__init__.py,sha256=cZthX4uSnrRjzSzlllIPZcsJZZDBznuvk3N6NP7saaU,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=geOGIyhwlKdG4jguuW5AQl657sPmNGRrSJFSk5UEs-Q,26401
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.2.dist-info/METADATA,sha256=h03DPeFZMtPvtd3etzxHFLhm2XeRShbk8eTCK9MWD9k,12233
239
+ rio_tiler-7.9.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
240
+ rio_tiler-7.9.2.dist-info/licenses/AUTHORS.txt,sha256=FCVd4Tjg-8syl0ZugCunpXER8X2-XonW2ZfllyTnRvE,158
241
+ rio_tiler-7.9.2.dist-info/licenses/LICENSE,sha256=vq8Tt4KoYQT9JxAjQ4yXMmmhFYRTsBRgrOj-ao-bC5o,1517
242
+ rio_tiler-7.9.2.dist-info/RECORD,,