标签: cfgrib

xarray使用cfgrib读取s3上的远程grib文件

crgrib 引擎可以读取远程文件吗?根据马丁·杜兰特的评论,它看起来不像(https://github.com/ecmwf/cfgrib/issues/198#issuecomment-772852412

s3 上托管着一个较小的 grib 文件:https://mf-nwp-models.s3.amazonaws.com/index.html#arpege-world/v2/2021-02-16/00/UGRD/10m/(注意不要单击文件,因为它会下载)。

当我尝试阅读它时,sf3s我得到

import s3fs
import xarray as xr

fs = s3fs.S3FileSystem(anon=True)

uri = "s3://mf-nwp-models/arpege-world/v2/2021-02-16/00/UGRD/10m/0h.grib2"

file = s3fs.S3Map(uri, s3=fs)
ds = xr.open_dataset(file, engine="cfgrib")

Can't create file '<File-like object S3FileSystem, mf-nwp-models/arpege-world/v2/2021-02-16/00/UGRD/10m/0h.grib2>.90c91.idx'
Traceback (most recent call last):
  File "/Users/ray.bell/miniconda/envs/test_env/lib/python3.8/site-packages/cfgrib/messages.py", line 342, in from_indexpath_or_filestream
    with compat_create_exclusive(indexpath) as new_index_file:
  File "/Users/ray.bell/miniconda/envs/test_env/lib/python3.8/contextlib.py", line 113, in __enter__
    return next(self.gen)
  File "/Users/ray.bell/miniconda/envs/test_env/lib/python3.8/site-packages/cfgrib/messages.py", line 274, in compat_create_exclusive
    fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_EXCL)
FileNotFoundError: [Errno 2] …
Run Code Online (Sandbox Code Playgroud)

python-xarray cfgrib fsspec

1
推荐指数
1
解决办法
1904
查看次数

标签 统计

cfgrib ×1

fsspec ×1

python-xarray ×1