@@ -235,6 +235,7 @@ def test_multiprocess_create(ms, tmp_path_factory):
235
235
@pytest .mark .skipif (xarray is None , reason = "depends on xarray" )
236
236
def test_xarray_to_zarr (ms , tmp_path_factory ):
237
237
store = tmp_path_factory .mktemp ("zarr_store" )
238
+
238
239
datasets = xds_from_ms (ms )
239
240
240
241
for i , ds in enumerate (datasets ):
@@ -407,3 +408,26 @@ def test_xds_from_zarr_assert_on_empty_store(tmp_path_factory, ms):
407
408
408
409
with pytest .raises (UnknownStoreTypeError , match = "Unable to infer table type" ):
409
410
xds_from_zarr (path )
411
+
412
+
413
+ @pytest .mark .skipif (xarray is None , reason = "depends on xarray" )
414
+ def test_xarray_reading_daskms_written_dataset (ms , tmp_path_factory ):
415
+ store = tmp_path_factory .mktemp ("zarr_store" )
416
+
417
+ datasets = xds_from_ms (ms )
418
+
419
+ for i , ds in enumerate (datasets ):
420
+ chunks = ds .chunks
421
+ row = sum (chunks ["row" ])
422
+ chan = sum (chunks ["chan" ])
423
+ corr = sum (chunks ["corr" ])
424
+
425
+ datasets [i ] = ds .assign_coords (
426
+ row = np .arange (row ), chan = np .arange (chan ), corr = np .arange (corr )
427
+ )
428
+
429
+ path = store / "test.zarr"
430
+ dask .compute (xds_to_zarr (datasets , path , consolidated = True ))
431
+
432
+ ds = xarray .open_zarr (path / "MAIN" / "MAIN_0" )
433
+ assert ds == datasets [0 ]
0 commit comments