如果已创建 dask.distributed 客户端,xarray.open_mfdataset() 将不起作用

xarray.open_mfdataset() doesn't work if dask.distributed client has been created

我有一个奇怪的问题,希望能提供一些意见。基本上,我 运行 在 AWS Pangeo Cloud 上打开一个笔记本,并在 S3(带有 s3fs)上用 xr.open_mfdataset 打开一些 GOES-16 卫星数据。

如果我根本不使用 dask,这会很好用,数据集会在几分钟内构建。

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

我制作了一些可以在此处浏览的简单笔记本,以及可用于 运行 它们的活页夹 link。如有任何意见,我们将不胜感激!

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

以下是否能达到您的要求?

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').