bcdev / nc2zarr

A Python tool that converts NetCDF files to Zarr format
MIT License
9 stars 3 forks source link

Append tests failing with xarray 0.19.0 #47

Closed pont-us closed 3 years ago

pont-us commented 3 years ago

With xarray 0.19.0, the following two tests are failing:

DatasetWriterTest.test_append_overlapping_append_newer 
>       np.testing.assert_equal(expected, ds3.t.data)
E       AssertionError: 
E       Arrays are not equal
E       
E       (shapes (5,), (3,) mismatch)
E        x: array(['2001-01-01T00:00:00.000000000', '2001-01-02T00:00:00.000000000',
E              '2001-01-03T00:00:00.000000000', '2001-01-04T00:00:00.000000000',
E              '2001-02-05T00:00:00.000000000'], dtype='datetime64[ns]')
E        y: array(['2001-01-01T00:00:00.000000000', '2001-01-02T00:00:00.000000000',
E              '2001-01-03T00:00:00.000000000'], dtype='datetime64[ns]')

DatasetWriterTest.test_append_overlapping_retain 
E       AssertionError: 
E       Arrays are not equal
E       
E       (shapes (6,), (7,) mismatch)
E        x: array(['2001-01-01T00:00:00.000000000', '2001-01-02T00:00:00.000000000',
E              '2001-01-03T00:00:00.000000000', '2001-01-04T00:00:00.000000000',
E              '2001-01-05T00:00:00.000000000', '2001-01-06T00:00:00.000000000'],
E             dtype='datetime64[ns]')
E        y: array(['2001-01-01T00:00:00.000000000', '2001-01-02T00:00:00.000000000',
E              '2001-01-03T00:00:00.000000000', '2001-01-04T00:00:00.000000000',
E              '2001-01-05T00:00:00.000000000', '2001-01-05T00:00:00.000000000',
E              '2001-01-06T00:00:00.000000000'], dtype='datetime64[ns]')

The failures seem to be connected with the introduction of consolidated=True as the default for xarray.open_zarr.

pont-us commented 3 years ago

Analysis: for test_append_overlapping_append_newer, the test just needs to be adapted, since it was relying on the old default when creating the initial zarr, resulting in mixed consolidated / unconsolidated access.

For test_append_overlapping_retain, there seems to be a bug in the way the append code handles consolidated zarrs, which had previously gone undetected since the test only made use of unconsolidated zarrs.