|
3 | 3 | import xarray.testing as xrt |
4 | 4 |
|
5 | 5 | import virtualizarr |
6 | | -from virtualizarr.backend import FileType |
7 | 6 | from virtualizarr.readers.hdf import HDFVirtualBackend |
8 | 7 | from virtualizarr.tests import requires_kerchunk |
9 | 8 |
|
10 | 9 |
|
11 | 10 | @requires_kerchunk |
12 | | -@pytest.mark.parametrize("hdf_backend", [None, HDFVirtualBackend]) |
13 | 11 | class TestIntegration: |
14 | | - @pytest.mark.xfail(reason="0 time start is being interpreted as fillvalue") |
| 12 | + @pytest.mark.xfail( |
| 13 | + reason="0 time start is being interpreted as fillvalue see issues/280" |
| 14 | + ) |
15 | 15 | def test_filters_h5netcdf_roundtrip( |
16 | | - self, tmpdir, filter_encoded_roundtrip_hdf5_file, hdf_backend |
| 16 | + self, tmpdir, filter_encoded_roundtrip_hdf5_file, backend=HDFVirtualBackend |
17 | 17 | ): |
18 | 18 | ds = xr.open_dataset(filter_encoded_roundtrip_hdf5_file, decode_times=True) |
19 | 19 | vds = virtualizarr.open_virtual_dataset( |
20 | 20 | filter_encoded_roundtrip_hdf5_file, |
21 | 21 | loadable_variables=["time"], |
22 | 22 | cftime_variables=["time"], |
23 | | - backend=hdf_backend, |
| 23 | + backend=HDFVirtualBackend, |
24 | 24 | ) |
25 | 25 | kerchunk_file = f"{tmpdir}/kerchunk.json" |
26 | 26 | vds.virtualize.to_kerchunk(kerchunk_file, format="json") |
27 | 27 | roundtrip = xr.open_dataset(kerchunk_file, engine="kerchunk", decode_times=True) |
28 | 28 | xrt.assert_allclose(ds, roundtrip) |
29 | 29 |
|
30 | | - @pytest.mark.xfail(reason="Coordinate issue affecting kerchunk and HDF reader.") |
| 30 | + @pytest.mark.xfail( |
| 31 | + reason="Coordinate issue affecting only hdf reader see pull/#260" |
| 32 | + ) |
31 | 33 | def test_filters_netcdf4_roundtrip( |
32 | | - self, tmpdir, filter_encoded_roundtrip_netcdf4_file, hdf_backend |
| 34 | + self, tmpdir, filter_encoded_roundtrip_netcdf4_file |
33 | 35 | ): |
34 | 36 | filepath = filter_encoded_roundtrip_netcdf4_file["filepath"] |
35 | 37 | ds = xr.open_dataset(filepath) |
36 | | - vds = virtualizarr.open_virtual_dataset( |
37 | | - filepath, filetype=FileType("netcdf4"), backend=hdf_backend |
38 | | - ) |
| 38 | + vds = virtualizarr.open_virtual_dataset(filepath, backend=HDFVirtualBackend) |
39 | 39 | kerchunk_file = f"{tmpdir}/kerchunk.json" |
40 | 40 | vds.virtualize.to_kerchunk(kerchunk_file, format="json") |
41 | 41 | roundtrip = xr.open_dataset(kerchunk_file, engine="kerchunk") |
42 | 42 | xrt.assert_equal(ds, roundtrip) |
43 | 43 |
|
44 | | - def test_filter_and_cf_roundtrip( |
45 | | - self, tmpdir, filter_and_cf_roundtrip_hdf5_file, hdf_backend |
46 | | - ): |
| 44 | + def test_filter_and_cf_roundtrip(self, tmpdir, filter_and_cf_roundtrip_hdf5_file): |
47 | 45 | ds = xr.open_dataset(filter_and_cf_roundtrip_hdf5_file) |
48 | 46 | vds = virtualizarr.open_virtual_dataset( |
49 | | - filter_and_cf_roundtrip_hdf5_file, backend=hdf_backend |
| 47 | + filter_and_cf_roundtrip_hdf5_file, backend=HDFVirtualBackend |
50 | 48 | ) |
51 | 49 | kerchunk_file = f"{tmpdir}/filter_cf_kerchunk.json" |
52 | 50 | vds.virtualize.to_kerchunk(kerchunk_file, format="json") |
|
0 commit comments