You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

xarray调用compute()触发Dask大图警告的原因及疑问

问题

我运行这段代码:

client=Client()
ds=xr.open_dataset(file_paths[0], chunks='auto')
time_data = ds['ObservTimes'].compute()

每次执行compute()都会弹出这个警告:

UserWarning: Sending large graph of size 23.71 MiB. This may cause some slowdown. Consider loading the data with Dask directly  or using futures or delayed objects to embed the data into the graph without repetition

按理解,compute()是把数据加载到内存里,为什么反而会把数据嵌入Dask图?

ds['ObservTimes']的数据如下:

array(['201301010001', '201301010002', '201301010003', ...,
       '201312312358', '201312312359', '201401010000'], dtype='<U12')

现在看起来像是把这些时间字符串嵌入了Dask图,但我看xarray官方文档的示例里从来没遇到过这种情况。原始数据是NetCDF格式,数据结构显示:ObservTimes是基于time维度的字符型变量,其余变量多为time、lat、lon三维的数值型变量,且全部启用了分块存储。

内容的提问来源于stack exchange,提问作者tangyp

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.13 03:32:39