|
17 | 17 | from distributed.client import futures_of
|
18 | 18 |
|
19 | 19 | import xarray as xr
|
20 |
| -from xarray.tests.test_backends import ON_WINDOWS, create_tmp_file |
| 20 | +from xarray.tests.test_backends import (ON_WINDOWS, create_tmp_file, |
| 21 | + create_tmp_geotiff) |
21 | 22 | from xarray.tests.test_dataset import create_test_data
|
22 | 23 | from xarray.backends.common import HDF5_LOCK, CombinedLock
|
23 | 24 |
|
24 | 25 | from . import (
|
25 |
| - assert_allclose, has_h5netcdf, has_netCDF4, has_scipy, requires_zarr, |
26 |
| - raises_regex) |
| 26 | + assert_allclose, has_h5netcdf, has_netCDF4, requires_rasterio, has_scipy, |
| 27 | + requires_zarr, raises_regex) |
27 | 28 |
|
28 | 29 | # this is to stop isort throwing errors. May have been easier to just use
|
29 | 30 | # `isort:skip` in retrospect
|
@@ -136,6 +137,17 @@ def test_dask_distributed_zarr_integration_test(loop):
|
136 | 137 | assert_allclose(original, computed)
|
137 | 138 |
|
138 | 139 |
|
| 140 | +@requires_rasterio |
| 141 | +def test_dask_distributed_rasterio_integration_test(loop): |
| 142 | + with create_tmp_geotiff() as (tmp_file, expected): |
| 143 | + with cluster() as (s, [a, b]): |
| 144 | + with Client(s['address'], loop=loop) as c: |
| 145 | + da_tiff = xr.open_rasterio(tmp_file, chunks={'band': 1}) |
| 146 | + assert isinstance(da_tiff.data, da.Array) |
| 147 | + actual = da_tiff.compute() |
| 148 | + assert_allclose(actual, expected) |
| 149 | + |
| 150 | + |
139 | 151 | @pytest.mark.skipif(distributed.__version__ <= '1.19.3',
|
140 | 152 | reason='Need recent distributed version to clean up get')
|
141 | 153 | @gen_cluster(client=True, timeout=None)
|
|
0 commit comments