File tree Expand file tree Collapse file tree 5 files changed +32
-7
lines changed Expand file tree Collapse file tree 5 files changed +32
-7
lines changed Original file line number Diff line number Diff line change 3535 with :
3636 python-version : ${{ matrix.python-version }}
3737
38+ - name : Configure AWS credentials
39+ uses : aws-actions/configure-aws-credentials@v4
40+ with :
41+ aws-access-key-id : ${{ secrets.AWS_ACCESS_KEY_ID }}
42+ aws-secret-access-key : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
43+ aws-region : us-east-1
44+
3845 - name : Install dependencies
3946 run : |
4047 python -m pip install --upgrade pip
Original file line number Diff line number Diff line change 77
88* remove unused templates
99
10+ ### titiler.xarray
11+
12+ * fix ` xarray_open_dataset ` for cloud hosted files
13+
1014## 0.22.1 (2025-05-13)
1115
1216### titiler.xarray
Original file line number Diff line number Diff line change @@ -67,6 +67,9 @@ test = [
6767 " zarr" ,
6868 " h5netcdf" ,
6969 " fsspec" ,
70+ " s3fs" ,
71+ " aiohttp" ,
72+ " requests" ,
7073]
7174
7275[project .urls ]
Original file line number Diff line number Diff line change 77import pytest
88import xarray
99
10- from titiler .xarray .io import Reader , get_variable
10+ from titiler .xarray .io import Reader , get_variable , xarray_open_dataset
1111
1212prefix = os .path .join (os .path .dirname (__file__ ), "fixtures" )
1313
@@ -200,3 +200,17 @@ def test_zarr_group(group):
200200 assert src .info ()
201201 assert src .tile (0 , 0 , 0 )
202202 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
8080 # Fallback to Zarr
8181 else :
8282 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+ )
8986 else :
9087 store = fsspec .filesystem (protocol ).get_mapper (src_path )
9188
You can’t perform that action at this time.
0 commit comments