I try to run this code, which ought to work...
import xarray as xr
import intake
import hvplot.xarray
import dask
catalog_url = 'https://raw.githubusercontent.com/hydrocloudservices/catalogs/main/catalogs/main.yaml'
cat=intake.open_catalog(catalog_url)
ds_era5l = cat.atmosphere.era5_land_reanalysis.to_dask()
the last line give me this error:
if path.startswith("file://"):
AttributeError: 'list' object has no attribute 'startswith'
The code is suppose to work as is... The complete traceback:
Traceback (most recent call last):
File "E:\Windows programs\PyCharm Community Edition 2021.3.1\plugins\python-ce\helpers\pydev\_pydevd_bundle\pydevd_exec2.py", line 3, in Exec
exec(exp, global_vars, local_vars)
File "<input>", line 1, in <module>
File "E:\Anaconda3\envs\Data_Extraction\lib\site-packages\intake_xarray\base.py", line 69, in to_dask
return self.read_chunked()
File "E:\Anaconda3\envs\Data_Extraction\lib\site-packages\intake_xarray\base.py", line 44, in read_chunked
self._load_metadata()
File "E:\Anaconda3\envs\Data_Extraction\lib\site-packages\intake\source\base.py", line 285, in _load_metadata
self._schema = self._get_schema()
File "E:\Anaconda3\envs\Data_Extraction\lib\site-packages\intake_xarray\base.py", line 18, in _get_schema
self._open_dataset()
File "E:\Anaconda3\envs\Data_Extraction\lib\site-packages\intake_xarray\xzarr.py", line 30, in _open_dataset
self._mapper = get_mapper(self.urlpath, **self.storage_options)
File "E:\Anaconda3\envs\Data_Extraction\lib\site-packages\fsspec\mapping.py", line 237, in get_mapper
fs, urlpath = url_to_fs(url, **kwargs)
File "E:\Anaconda3\envs\Data_Extraction\lib\site-packages\fsspec\core.py", line 387, in url_to_fs
urlpath = fs._strip_protocol(url)
File "E:\Anaconda3\envs\Data_Extraction\lib\site-packages\fsspec\implementations\local.py", line 207, in _strip_protocol
if path.startswith("file://"):
AttributeError: 'list' object has no attribute 'startswith'
The code as given works fine for me, resulting in
<xarray.Dataset>
Dimensions: (latitude: 701, longitude: 1171, time: 636240)
Coordinates:
* latitude (latitude) float64 85.0 84.9 84.8 84.7 ... 15.3 15.2 15.1 15.0
* longitude (longitude) float64 -167.0 -166.9 -166.8 ... -50.2 -50.1 -50.0
* time (time) datetime64[ns] 1950-01-01 ... 2022-07-31T23:00:00
Data variables:
sd (time, latitude, longitude) float32 dask.array<chunksize=(8760, 7, 7), meta=np.ndarray>
t2m (time, latitude, longitude) float32 dask.array<chunksize=(8760, 7, 7), meta=np.ndarray>
tp (time, latitude, longitude) float32 dask.array<chunksize=(8760, 7, 7), meta=np.ndarray>
It may be that you have an old version of intake-xarray or xarray. Ppassing a list of paths means using xr.open_mfdataset rather than xr.open_dataset, but this was not always supported for zarr. For this particular source, there is only one path, so expressing it as a list is not actually doing anything useful.