Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEP: pin rasterio>=1.2 #642

Merged
merged 1 commit into from
Mar 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@ jobs:
xarray-version: '==0.17'
run-with-scipy: 'YES'
gdal-version: '3.4.3'
- python-version: '3.9'
rasterio-version: '==1.1'
xarray-version: ''
run-with-scipy: 'YES'
gdal-version: '3.4.3'
- python-version: '3.9'
rasterio-version: '==1.2.1'
xarray-version: ''
Expand Down
1 change: 1 addition & 0 deletions docs/history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ History
Latest
------
- DEP: Drop Python 3.8 support (issue #582)
- DEP: pin rasterio>=1.2 (pull #642)

0.13.4
------
Expand Down
17 changes: 2 additions & 15 deletions rioxarray/raster_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

"""
import copy
import importlib.metadata
import os
from pathlib import Path
from typing import (
Expand All @@ -32,7 +31,6 @@
import rasterio.warp
import xarray
from affine import Affine
from packaging import version
from rasterio.dtypes import dtype_rev
from rasterio.enums import Resampling
from rasterio.features import geometry_mask
Expand All @@ -59,10 +57,6 @@
_order_bounds,
)

_RASTERIO_GTE_12 = version.parse(
importlib.metadata.version("rasterio")
) >= version.parse("1.2")

# DTYPE TO NODATA MAP
# Based on: https://github.com/OSGeo/gdal/blob/
# dee861e7c91c2da7ef8ff849947713e4d9bd115c/
Expand Down Expand Up @@ -911,13 +905,7 @@ def clip(
)
crs = crs_from_user_input(crs) if crs is not None else self.crs
if self.crs != crs:
if _RASTERIO_GTE_12:
geometries = rasterio.warp.transform_geom(crs, self.crs, geometries)
else:
geometries = [
rasterio.warp.transform_geom(crs, self.crs, geometry)
for geometry in geometries
]
geometries = rasterio.warp.transform_geom(crs, self.crs, geometries)
cropped_ds = None
if from_disk:
cropped_ds = _clip_from_disk(
Expand Down Expand Up @@ -1110,9 +1098,8 @@ def to_raster(
"""
if driver is None:
extension = Path(raster_path).suffix
# https://github.com/rasterio/rasterio/pull/2634
# https://github.com/rasterio/rasterio/pull/2008
if not _RASTERIO_GTE_12 or extension in (".tif", ".tiff"):
if extension in (".tif", ".tiff"):
driver = "GTiff"

# get the output profile from the rasterio object
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ include_package_data = True
python_requires = >=3.9
install_requires =
packaging
rasterio>=1.1.1
rasterio>=1.2
xarray>=0.17
pyproj>=2.2
numpy>=1.21
Expand Down
4 changes: 0 additions & 4 deletions test/integration/test_integration__io.py
Original file line number Diff line number Diff line change
Expand Up @@ -866,10 +866,6 @@ def test_rasterio_environment():
assert_allclose(actual, expected)


@pytest.mark.xfail(
RASTERIO_VERSION == version.parse("1.1.1"),
reason="https://github.com/mapbox/rasterio/issues/1833",
)
def test_rasterio_vrt():
# tmp_file default crs is UTM: CRS({'init': 'epsg:32618'}
with create_tmp_geotiff() as (tmp_file, expected):
Expand Down