From 7f94df0c061ea6b7cccf7064b866297ebdfd0647 Mon Sep 17 00:00:00 2001 From: "Alan D. Snow" Date: Thu, 31 Oct 2024 13:54:17 -0500 Subject: [PATCH] TST:merge: Handle rasterio 1.4 merge test differences (#818) --- test/conftest.py | 1 + test/integration/test_integration_merge.py | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/test/conftest.py b/test/conftest.py index f09928d9..46b8ad47 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -15,6 +15,7 @@ TEST_DATA_DIR = os.path.join(os.path.dirname(__file__), "test_data") TEST_INPUT_DATA_DIR = os.path.join(TEST_DATA_DIR, "input") TEST_COMPARE_DATA_DIR = os.path.join(TEST_DATA_DIR, "compare") +RASTERIO_GE_14 = version.parse(rasterio.__version__) >= version.parse("1.4.0") GDAL_GE_36 = version.parse(rasterio.__gdal_version__) >= version.parse("3.6.0") GDAL_GE_361 = version.parse(rasterio.__gdal_version__) >= version.parse("3.6.1") GDAL_GE_364 = version.parse(rasterio.__gdal_version__) >= version.parse("3.6.4") diff --git a/test/integration/test_integration_merge.py b/test/integration/test_integration_merge.py index 2ee2a48e..faf29f6f 100644 --- a/test/integration/test_integration_merge.py +++ b/test/integration/test_integration_merge.py @@ -6,7 +6,7 @@ from rioxarray import open_rasterio from rioxarray.merge import merge_arrays, merge_datasets -from test.conftest import TEST_INPUT_DATA_DIR +from test.conftest import RASTERIO_GE_14, TEST_INPUT_DATA_DIR @pytest.mark.parametrize("squeeze", [True, False]) @@ -82,7 +82,10 @@ def test_merge__different_crs(dataset): (-7300984.0238134, 5003618.5908794, -7224054.1109682, 5050108.6101528), ) assert merged.rio.shape == (84, 139) - assert_almost_equal(test_sum, -131734881) + if RASTERIO_GE_14: + assert_almost_equal(test_sum, -126821853) + else: + assert_almost_equal(test_sum, -131734881) assert_almost_equal( tuple(merged.rio.transform()),