diff --git a/tests/io/test_miniseed.py b/tests/io/test_miniseed.py index 46ce055..9da16d2 100644 --- a/tests/io/test_miniseed.py +++ b/tests/io/test_miniseed.py @@ -65,3 +65,17 @@ def test_miniseed(): assert da.coords["network"].values == "DX" assert da.coords["location"].values == "00" assert da.coords["channel"].values.tolist() == ["HHZ", "HHN", "HHE"] + + # automatically open multiple files + da = xd.open_mfdataarray(f"{dirpath}/*.mseed", dim="station", engine="miniseed") + assert da.shape == (10, 3, 100) + assert da.dims == ("station", "channel", "time") + assert da.coords["station"].values.tolist() == [ + f"CH{i:03d}" for i in range(1, 11) + ] + assert da.coords["time"].isinterp() + assert da.coords["time"][0].values == np.datetime64("1970-01-01T00:00:00") + assert da.coords["time"][-1].values == np.datetime64("1970-01-01T00:00:00.990") + assert da.coords["network"].values == "DX" + assert da.coords["location"].values == "00" + assert da.coords["channel"].values.tolist() == ["HHZ", "HHN", "HHE"] diff --git a/tests/test_routines.py b/tests/test_routines.py index a5a5dd1..a7ff99c 100644 --- a/tests/test_routines.py +++ b/tests/test_routines.py @@ -161,7 +161,7 @@ def test_incompatible_coords(self): assert len(dc) == 2 assert dc[0].equals(da1) assert dc[1].equals(da2) - + def test_incompatible_sampling_interval(self): da1 = DataArray( np.random.rand(10, 5), @@ -192,4 +192,4 @@ def test_expand_scalar_coordinate(self): dc = combine_by_coords([da1, da2], dim="space", squeeze=True) assert dc.shape == (2, 10) assert dc.dims == ("space", "time") - assert dc.coords["space"].values.tolist() == [0, 1] \ No newline at end of file + assert dc.coords["space"].values.tolist() == [0, 1] diff --git a/xdas/core/routines.py b/xdas/core/routines.py index a38b49d..1ae05b9 100644 --- a/xdas/core/routines.py +++ b/xdas/core/routines.py @@ -293,7 +293,8 @@ def open_mfdataarray( "The maximum number of file that can be opened at once is for now limited " "to 100 000." ) - with ProcessPoolExecutor() as executor: + max_workers = 1 if engine == "miniseed" else None # TODO: dirty fix + with ProcessPoolExecutor(max_workers=max_workers) as executor: futures = [ executor.submit(open_dataarray, path, engine=engine) for path in paths ]