File tree Expand file tree Collapse file tree 3 files changed +22
-7
lines changed Expand file tree Collapse file tree 3 files changed +22
-7
lines changed Original file line number Diff line number Diff line change 7
7
8
8
* remove unused templates
9
9
10
+ ### titiler.xarray
11
+
12
+ * fix ` xarray_open_dataset ` for cloud hosted files
13
+
10
14
## 0.22.1 (2025-05-13)
11
15
12
16
### titiler.xarray
Original file line number Diff line number Diff line change 7
7
import pytest
8
8
import xarray
9
9
10
- from titiler .xarray .io import Reader , get_variable
10
+ from titiler .xarray .io import Reader , get_variable , xarray_open_dataset
11
11
12
12
prefix = os .path .join (os .path .dirname (__file__ ), "fixtures" )
13
13
@@ -200,3 +200,17 @@ def test_zarr_group(group):
200
200
assert src .info ()
201
201
assert src .tile (0 , 0 , 0 )
202
202
assert src .point (0 , 0 ).data [0 ] == group * 2 + 1
203
+
204
+
205
+ @pytest .mark .parametrize (
206
+ "src_path" ,
207
+ [
208
+ "s3://mur-sst/zarr-v1" ,
209
+ "https://nasa-power.s3.amazonaws.com/syn1deg/temporal/power_syn1deg_monthly_temporal_lst.zarr" ,
210
+ os .path .join (prefix , "dataset_3d.zarr" ),
211
+ ],
212
+ )
213
+ def test_io_xarray_open_dataset (src_path ):
214
+ """test xarray_open_dataset with cloud hosted files."""
215
+ with xarray_open_dataset (src_path ) as ds :
216
+ assert list (ds .data_vars )
Original file line number Diff line number Diff line change @@ -80,12 +80,9 @@ def xarray_open_dataset( # noqa: C901
80
80
# Fallback to Zarr
81
81
else :
82
82
if module_available ("zarr" , minversion = "3.0" ):
83
- if protocol == "file" :
84
- store = zarr .storage .LocalStore (parsed .path , read_only = True )
85
- else :
86
- fs = fsspec .filesystem (protocol , storage_options = {"asynchronous" : True })
87
- store = zarr .storage .FsspecStore (fs , path = src_path , read_only = True )
88
-
83
+ store = zarr .storage .FsspecStore .from_url (
84
+ src_path , storage_options = {"asynchronous" : True }
85
+ )
89
86
else :
90
87
store = fsspec .filesystem (protocol ).get_mapper (src_path )
91
88
You can’t perform that action at this time.
0 commit comments