Skip to content

Commit 8cfdf2d

Browse files
authored
Merge pull request #342 from boutproject/fix-adios-warning
Import ADIOS2 only when actually used to remove warning
2 parents e4f23d5 + 4b044cb commit 8cfdf2d

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

xbout/xarraybackend.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
from typing import TYPE_CHECKING, Any, ItemsView
1414

1515
import numpy as np
16-
from adios2 import FileReader
1716

1817
from xarray import Dataset, Variable
1918
from xarray.backends.common import (
@@ -25,9 +24,11 @@
2524
from xarray.core import indexing
2625

2726
if TYPE_CHECKING:
27+
from adios2 import FileReader
2828
from io import BufferedIOBase
2929
from xarray.backends.common import AbstractDataStore
3030

31+
3132
# need some special secret attributes to tell us the dimensions
3233
DIMENSION_KEY = "time_dimension"
3334

@@ -199,6 +200,8 @@ def open_dataset( # type: ignore[override] # allow LSP violation, not supporti
199200
# stacklevel=3,
200201
# adios_version=None,
201202
) -> Dataset:
203+
from adios2 import FileReader
204+
202205
filename_or_obj = _normalize_path(filename_or_obj)
203206
# print(f"BoutAdiosBackendEntrypoint: path = {filename_or_obj} type = {type(filename_or_obj)}")
204207

0 commit comments

Comments
 (0)