diff --git a/.pylintrc b/.pylintrc index f7feea52..4f267721 100644 --- a/.pylintrc +++ b/.pylintrc @@ -1,5 +1,5 @@ [MASTER] -extension-pkg-whitelist=rasterio.crs +extension-pkg-whitelist=rasterio.crs,pyproj.database [MESSAGES CONTROL] disable=logging-fstring-interpolation, diff --git a/rioxarray/rioxarray.py b/rioxarray/rioxarray.py index 0cdb5211..e8b23ede 100644 --- a/rioxarray/rioxarray.py +++ b/rioxarray/rioxarray.py @@ -14,6 +14,8 @@ import rasterio.windows import xarray from affine import Affine +from pyproj.aoi import AreaOfInterest +from pyproj.database import query_utm_crs_info from rasterio.control import GroundControlPoint from rasterio.crs import CRS @@ -531,13 +533,6 @@ def estimate_utm_crs(self, datum_name: str = "WGS 84") -> rasterio.crs.CRS: ------- rasterio.crs.CRS """ - # pylint: disable=import-outside-toplevel - try: - from pyproj.aoi import AreaOfInterest - from pyproj.database import query_utm_crs_info - except ImportError: - raise RuntimeError("pyproj 3+ required for estimate_utm_crs.") from None - if self.crs is None: raise RuntimeError("crs must be set to estimate UTM CRS.") diff --git a/setup.cfg b/setup.cfg index 9e4541f5..9fcc82e8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -35,7 +35,7 @@ install_requires = packaging rasterio>=1.3 xarray>=0.17 - pyproj>=2.2 + pyproj>=3.3 numpy>=1.21 [options.package_data] diff --git a/test/integration/test_integration_rioxarray.py b/test/integration/test_integration_rioxarray.py index c869cf00..52b1bcf2 100644 --- a/test/integration/test_integration_rioxarray.py +++ b/test/integration/test_integration_rioxarray.py @@ -31,7 +31,6 @@ from rioxarray.rioxarray import _make_coords from test.conftest import ( GDAL_GE_361, - PYPROJ_LT_3, TEST_COMPARE_DATA_DIR, TEST_INPUT_DATA_DIR, _assert_xarrays_equal, @@ -2852,18 +2851,13 @@ def test_estimate_utm_crs(): with rioxarray.open_rasterio( os.path.join(TEST_INPUT_DATA_DIR, "cog.tif"), ) as xds: - if PYPROJ_LT_3: - with pytest.raises(RuntimeError, match=r"pyproj 3\+ required"): - xds.rio.estimate_utm_crs() - else: - assert xds.rio.estimate_utm_crs().to_epsg() in (32618, 32655) - assert xds.rio.reproject( - "EPSG:4326" - ).rio.estimate_utm_crs() == CRS.from_epsg(32618) - assert xds.rio.estimate_utm_crs("WGS 72") in (32218, 32255) + assert xds.rio.estimate_utm_crs().to_epsg() in (32618, 32655) + assert xds.rio.reproject("EPSG:4326").rio.estimate_utm_crs() == CRS.from_epsg( + 32618 + ) + assert xds.rio.estimate_utm_crs("WGS 72") in (32218, 32255) -@pytest.mark.skipif(PYPROJ_LT_3, reason="pyproj 3+ required") def test_estimate_utm_crs__missing_crs(): with pytest.raises(RuntimeError, match=r"crs must be set to estimate UTM CRS"): xarray.Dataset().rio.estimate_utm_crs("NAD83") @@ -2879,12 +2873,8 @@ def test_estimate_utm_crs__out_of_bounds(): }, ) xds.rio.write_crs("EPSG:4326", inplace=True) - if PYPROJ_LT_3: - with pytest.raises(RuntimeError, match=r"pyproj 3\+ required"): - xds.rio.estimate_utm_crs() - else: - with pytest.raises(RuntimeError, match=r"Unable to determine UTM CRS"): - xds.rio.estimate_utm_crs() + with pytest.raises(RuntimeError, match=r"Unable to determine UTM CRS"): + xds.rio.estimate_utm_crs() def test_interpolate_na_missing_nodata():