(self)
| 5971 | assert not actual.foo.variable._in_memory |
| 5972 | |
| 5973 | def test_open_mfdataset(self) -> None: |
| 5974 | original = Dataset({"foo": ("x", np.random.randn(10))}) |
| 5975 | with create_tmp_file() as tmp1: |
| 5976 | with create_tmp_file() as tmp2: |
| 5977 | original.isel(x=slice(5)).to_netcdf(tmp1) |
| 5978 | original.isel(x=slice(5, 10)).to_netcdf(tmp2) |
| 5979 | with open_mfdataset( |
| 5980 | [tmp1, tmp2], concat_dim="x", combine="nested" |
| 5981 | ) as actual: |
| 5982 | assert isinstance(actual.foo.variable.data, da.Array) |
| 5983 | assert actual.foo.variable.data.chunks == ((5, 5),) |
| 5984 | assert_identical(original, actual) |
| 5985 | with open_mfdataset( |
| 5986 | [tmp1, tmp2], concat_dim="x", combine="nested", chunks={"x": 3} |
| 5987 | ) as actual: |
| 5988 | assert actual.foo.variable.data.chunks == ((3, 2, 3, 2),) |
| 5989 | |
| 5990 | with pytest.raises(OSError, match=r"no files to open"): |
| 5991 | open_mfdataset("foo-bar-baz-*.nc") |
| 5992 | with pytest.raises(ValueError, match=r"wild-card"): |
| 5993 | open_mfdataset("http://some/remote/uri") |
| 5994 | |
| 5995 | @requires_fsspec |
| 5996 | def test_open_mfdataset_no_files(self) -> None: |
nothing calls this directly
no test coverage detected