rioxarray
rioxarray copied to clipboard
Test failures with rasterio 1.4
Problem description
The Debian package CI shows test failures with rasterio 1.4:
103s =================================== FAILURES ===================================
103s _______________________ test_merge__different_crs[True] ________________________
103s
103s dataset = True
103s
103s @pytest.mark.parametrize("dataset", [True, False])
103s def test_merge__different_crs(dataset):
103s dem_test = os.path.join(TEST_INPUT_DATA_DIR, "MODIS_ARRAY.nc")
103s with open_rasterio(dem_test) as rds:
103s crs = rds.rio.crs
103s if dataset:
103s rds = rds.to_dataset()
103s arrays = [
103s rds.isel(x=slice(100), y=slice(100)).rio.reproject("EPSG:3857"),
103s rds.isel(x=slice(100, 200), y=slice(100, 200)),
103s rds.isel(x=slice(100), y=slice(100, 200)),
103s rds.isel(x=slice(100, 200), y=slice(100)),
103s ]
103s if dataset:
103s merged = merge_datasets(arrays, crs=crs)
103s else:
103s merged = merge_arrays(arrays, crs=crs)
103s
103s if dataset:
103s test_sum = merged[merged.rio.vars[0]].sum()
103s else:
103s test_sum = merged.sum()
103s assert_almost_equal(
103s merged.rio.bounds(),
103s (-7300984.0238134, 5003618.5908794, -7224054.1109682, 5050108.6101528),
103s )
103s assert merged.rio.shape == (84, 139)
103s > assert_almost_equal(test_sum, -131734881)
103s
103s test/integration/test_integration_merge.py:85:
103s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
103s
103s args = (<xarray.DataArray '__xarray_dataarray_variable__' ()> Size: 8B
103s array(-126821853)
103s Coordinates:
103s spatial_ref int64 8B 0, -131734881)
103s kwds = {}
103s
103s @wraps(func)
103s def inner(*args, **kwds):
103s with self._recreate_cm():
103s > return func(*args, **kwds)
103s E AssertionError:
103s E Arrays are not almost equal to 7 decimals
103s E ACTUAL: <xarray.DataArray '__xarray_dataarray_variable__' ()> Size: 8B
103s E array(-126821853)
103s E Coordinates:
103s E spatial_ref int64 8B 0
103s E DESIRED: -131734881
103s
103s /usr/lib/python3.12/contextlib.py:81: AssertionError
103s _______________________ test_merge__different_crs[False] _______________________
103s
103s dataset = False
103s
103s @pytest.mark.parametrize("dataset", [True, False])
103s def test_merge__different_crs(dataset):
103s dem_test = os.path.join(TEST_INPUT_DATA_DIR, "MODIS_ARRAY.nc")
103s with open_rasterio(dem_test) as rds:
103s crs = rds.rio.crs
103s if dataset:
103s rds = rds.to_dataset()
103s arrays = [
103s rds.isel(x=slice(100), y=slice(100)).rio.reproject("EPSG:3857"),
103s rds.isel(x=slice(100, 200), y=slice(100, 200)),
103s rds.isel(x=slice(100), y=slice(100, 200)),
103s rds.isel(x=slice(100, 200), y=slice(100)),
103s ]
103s if dataset:
103s merged = merge_datasets(arrays, crs=crs)
103s else:
103s merged = merge_arrays(arrays, crs=crs)
103s
103s if dataset:
103s test_sum = merged[merged.rio.vars[0]].sum()
103s else:
103s test_sum = merged.sum()
103s assert_almost_equal(
103s merged.rio.bounds(),
103s (-7300984.0238134, 5003618.5908794, -7224054.1109682, 5050108.6101528),
103s )
103s assert merged.rio.shape == (84, 139)
103s > assert_almost_equal(test_sum, -131734881)
103s
103s test/integration/test_integration_merge.py:85:
103s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
103s
103s args = (<xarray.DataArray '__xarray_dataarray_variable__' ()> Size: 8B
103s array(-126821853)
103s Coordinates:
103s spatial_ref int64 8B 0, -131734881)
103s kwds = {}
103s
103s @wraps(func)
103s def inner(*args, **kwds):
103s with self._recreate_cm():
103s > return func(*args, **kwds)
103s E AssertionError:
103s E Arrays are not almost equal to 7 decimals
103s E ACTUAL: <xarray.DataArray '__xarray_dataarray_variable__' ()> Size: 8B
103s E array(-126821853)
103s E Coordinates:
103s E spatial_ref int64 8B 0
103s E DESIRED: -131734881
103s
103s /usr/lib/python3.12/contextlib.py:81: AssertionError
https://ci.debian.net/packages/p/python-rioxarray/unstable/amd64/51302837/
See also: https://github.com/rasterio/rasterio/blob/main/CHANGES.txt