如果已创建dask.distributed client,则xarray.open_mfdataset()不起作用

2024-05-28 20:49:07 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个奇怪的问题,我希望你能给我一些建议。基本上,我在AWS Pangeo云上运行一个笔记本,并在S3上打开一些GOES-16卫星数据(使用s3fs),使用xr.open_mfdataset

如果我根本不使用dask,那么这个方法非常有效,数据集在几分钟内就构建好了

但是如果我在打开文件之前创建一个dask.distributed客户机,open_mfdataset似乎永远挂起

我做了一些简单的笔记本,可以在这里浏览,还有一个活页夹链接,可以用来运行它们。任何意见都将不胜感激

https://github.com/lsterzinger/pangeo-cloud-L2-satellite/tree/main/dask_troubleshooting


Tags: 文件数据方法awss3笔记本open建议
1条回答
网友
1楼 · 发布于 2024-05-28 20:49:07

以下几点能达到你的目标吗

ds = xr.open_mfdataset(file_objs, combine='nested', concat_dim='t', data_vars='minimal', coords='minimal', compat='override')

请注意,使用这些设置,非dask版本的加载时间约为35秒,而dask版本的加载时间似乎为90秒。我还没有处理过这些数据,所以不知道这里是否存在这种情况,但扩展优势可能会对更多的文件起作用(现在是24个)

这是基于docs中的指导:

Commonly, a few of these variables need to be concatenated along a dimension (say "time"), while the rest are equal across the datasets (ignoring floating point differences).

This command concatenates variables along the "time" dimension, but only those that already contain the "time" dimension (data_vars='minimal', coords='minimal'). Variables that lack the "time" dimension are taken from the first dataset (compat='override').

相关问题 更多 >

    热门问题