我有一个包含多个变量的大型netcdf文件。我需要沿着一个维度对一个变量进行离散积分,比如形状(80,100,300000)与维度(时间,深度,节点)的温度。因此,我尝试使用xarray将大数据集分成块,然后尝试应用函数scipy.integrate.simps,但失败了。
import xarray as xr
import scipy.integrate as sci
ds = xr.open_dataset('./temperature.nc',chunks={'time':5, 'nodes':1000})
temp = ds.temperature请帮助我应用simps函数沿分块变量的第二维,然后将分块保存到netcdf文件,而不是将整个数据转储到RAM中。我想做这样的事情
temp.apply(sci.simps,{'dx':5}).to_netcdf('./temperature_integrated.nc')发布于 2018-05-01 18:17:28
我想你是在找xarray.apply_ufunc
也许下面这样的东西可以为你工作(未经测试):
import xarray as xr
xr.apply_ufunc(scipy.integrate, ds.temperature)https://stackoverflow.com/questions/50106229
复制相似问题