From de1f002a9d02ca47780c4fe322d06f54d633ca0c Mon Sep 17 00:00:00 2001 From: vincentsarago Date: Wed, 22 Jan 2025 10:57:43 +0100 Subject: [PATCH] avoid type error --- rio_tiler/io/xarray.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rio_tiler/io/xarray.py b/rio_tiler/io/xarray.py index e1e50e75..099c6959 100644 --- a/rio_tiler/io/xarray.py +++ b/rio_tiler/io/xarray.py @@ -39,8 +39,10 @@ try: import xarray + from xarray import open_dataset except ImportError: # pragma: nocover xarray = None # type: ignore + open_dataset = None # type: ignore try: import rioxarray @@ -644,7 +646,7 @@ class DatasetReader(BaseReader): tms: TileMatrixSet = attr.ib(default=WEB_MERCATOR_TMS) - opener: Callable[..., xarray.Dataset] = attr.ib(default=xarray.open_dataset) + opener: Callable[..., xarray.Dataset] = attr.ib(default=open_dataset) opener_options: Dict = attr.ib(factory=dict) _ctx_stack: contextlib.ExitStack = attr.ib(init=False, factory=contextlib.ExitStack)