3737
3838
3939@cache
40- def open_dataset (src_path : str ) -> xarray .Dataset :
40+ def open_dataset (src_path : str , ** kwargs : Any ) -> xarray .Dataset :
4141 """Open Xarray dataset
4242
4343 Args:
@@ -51,7 +51,7 @@ def open_dataset(src_path: str) -> xarray.Dataset:
5151 if not parsed .scheme :
5252 src_path = str (Path (src_path ).resolve ())
5353 src_path = "file://" + src_path
54- store = obstore .store .from_url (src_path )
54+ store = obstore .store .from_url (src_path , ** kwargs )
5555 zarr_store = ObjectStore (store = store , read_only = True )
5656 ds = xarray .open_dataset (
5757 zarr_store ,
@@ -77,7 +77,10 @@ class ZarrReader(BaseReader):
7777 Examples:
7878 >>> with ZarrReader(
7979 "s3://mur-sst/zarr-v1",
80- opener_options={"engine": "zarr"}
80+ opener_options={
81+ "skip_signature": True,
82+ "region": "us-west-2",
83+ }
8184 ) as src:
8285 print(src)
8386 print(src.variables)
@@ -91,7 +94,7 @@ class ZarrReader(BaseReader):
9194 tms : TileMatrixSet = attr .ib (default = WEB_MERCATOR_TMS )
9295
9396 opener : Callable [..., xarray .Dataset ] = attr .ib (default = open_dataset )
94-
97+ opener_options : Dict = attr . ib ( factory = dict )
9598 _ctx_stack : contextlib .ExitStack = attr .ib (init = False , factory = contextlib .ExitStack )
9699
97100 def __attrs_post_init__ (self ):
@@ -100,7 +103,9 @@ def __attrs_post_init__(self):
100103 assert rioxarray is not None , "rioxarray must be installed to use XarrayReader"
101104
102105 if not self .dataset :
103- self .dataset = self ._ctx_stack .enter_context (self .opener (self .input ))
106+ self .dataset = self ._ctx_stack .enter_context (
107+ self .opener (self .input , ** self .opener_options )
108+ )
104109
105110 # NOTE: rioxarray returns **ordered** bounds in form of (minx, miny, maxx, maxx)
106111 self .bounds = tuple (self .dataset .rio .bounds ())
0 commit comments