jcmgray / xyzpy

Efficiently generate and analyse high dimensional data.
http://xyzpy.readthedocs.io
MIT License
66 stars 11 forks source link

Failing tests related to netcdf #15

Closed adamcallison closed 1 year ago

adamcallison commented 1 year ago

Hi,

I recently reinstalled xyzpy (from my up-to-date fork of the develop branch) in to a fresh anaconda environment and ran the test suite to make sure I had things set up properly. After installing any missing libraries that had caused tests to fail, I ran the tests again and saw that two tests were still failing with the following error messages:

FAILED tests/test_manage.py::TestSaveAndLoad::test_io_complex_data[h5netcdf-h5netcdf] - h5netcdf.core.CompatibilityError: complex dtypes are not a supported NetCDF feature, and are not allowed by h5net...
FAILED tests/test_manage.py::TestSaveAndLoad::test_save_merge_ds - h5netcdf.core.CompatibilityError: complex dtypes are not a supported NetCDF feature, and are not allowed by h5net...

The actual tests in question look as follows:

    @mark.parametrize(("engine_save, engine_load"),
                      [('h5netcdf', 'h5netcdf'),
                       ('zarr', 'zarr'),
                       ('joblib', 'joblib'),
                       param('h5netcdf', 'netcdf4', marks=mark.xfail),
                       param('netcdf4', 'h5netcdf', marks=mark.xfail),
                       param('netcdf4', 'netcdf4', marks=mark.xfail)])
    def test_io_complex_data(self, ds1, engine_save, engine_load):
        with tempfile.TemporaryDirectory() as tmpdir:
            save_ds(ds1, os.path.join(tmpdir, "test.h5"), engine=engine_save)
            ds2 = load_ds(os.path.join(tmpdir, "test.h5"), engine=engine_load)
            assert ds1.identical(ds2)
    def test_save_merge_ds(self, ds1, ds2, ds3):
        with tempfile.TemporaryDirectory() as tmpdir:
            fname = os.path.join(tmpdir, "test.h5")
           save_merge_ds(ds1, fname)
            save_merge_ds(ds2, fname)
            with raises(xr.MergeError):
                save_merge_ds(ds3, fname)
            save_merge_ds(ds3, fname, overwrite=True)
            exp = ds3.combine_first(xr.merge([ds1, ds2]))
            assert load_ds(fname).identical(exp)

Is there perhaps a specific version requirement for netcdf that is not specified in the docs?

jcmgray commented 1 year ago

Hi @adamcallison, sorry to be slow getting to this! I have pushed a fix. xyzpy is due a been of infrastructure updates and a release soon to makes these things easier to catch..