[英]Read grb2 files is very slow
Reading a grb2 file of about 100 megabytes takes me 5 minutes with the following code:使用以下代码读取大约 100 兆字节的 grb2 文件需要 5 分钟:
import cfgrib
datasets = cfgrib.open_datasets(grib_path, backend_kwargs={'indexpath': ''})
Is there any way or library with which I can read these files more quickly?有什么方法或库可以让我更快地读取这些文件?
You can activate parallel read to enhance the reading speed:您可以激活并行读取以提高读取速度:
import xarray
data = xarray.open_dataset(grib_path, engine='cfgrib', parallel=True)
it's actually an annoying issue that's being raised here.这实际上是这里提出的一个烦人的问题。 With a 12Mb Grib file, to read a single field, cfgrib takes 19 seconds compared to 0.02 seconds with pynio!使用 12Mb Grib 文件读取单个字段时,cfgrib 需要 19 秒,而 pynio 需要 0.02 秒! more than 900 times more!超过 900 倍!
ps : parallel = true gives as result : open_dataset() got an unexpected keyword argument 'parallel' ps:parallel = true 给出结果:open_dataset() 得到了一个意外的关键字参数“parallel”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.