简体   繁体   English

读取grb2文件很慢

[英]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.

相关问题 我发现使用Pygrib访问grb2文件非常缓慢且耗时,对所有人来说都一样吗? - I find accessing grb2 files with Pygrib very slow and time consuming, is it same for all? MetPy 和 grb2 文件打开问题:xarray 的值错误 - MetPy and grb2 file opening issue: xarray's Value Error SocketServer rfile.read()非常慢 - SocketServer rfile.read() very very slow 读/写NumPy结构化阵列非常慢,线性尺寸慢 - Read/Write NumPy Structured Array very slow, linear in size slow 比较2 .csv文件与一些计算非常慢 - Compare 2 .csv files with some calculation very slow Python Paramiko 客户端 SSH 读取标准输出时非常慢 - Python Paramiko Client SSH very slow when read stdout 对于非数字数据,Pandas read_hdf非常慢 - Pandas read_hdf very slow for non-numeric data ftplib - 文件创建速度非常慢:SSLError:读取操作超时 - ftplib - file creation very slow: SSLError: The read operation timed out 使用 Python 读取相机图像世界在 webbots 中运行非常缓慢 - Use Python to read camera image the world run very slow in webots Pandas 从 Jaydebeapi Netezza 读取 read_sql 非常慢 - Pandas read_sql very slow reading from Jaydebeapi Netezza
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM