问题描述
我编写了一个 for 循环来计算我的 NetCDF 文件的样本滚动平均值(73、10000、10000),它计算了 25 个维度为(73、2000、2000)的字幕的滚动平均值,我想在每次迭代时保存此 vh_sub_roll 以实现最终更正的 NetCDF 文件,该文件也是 (73,10000,10000),但我不知道该怎么做。有人可以帮助解决这个问题。
vh = xarray.open_dataset('D:/kfakheri_data/thesis/Netcdf_files/all/ultimate_netcdf_VH.nc')
maxr = 5
# subtile numbers help to check individual parts of the array,if necessary. 1=upper right,25=lower left corner
subtile = 1
for rx in range(maxr):
for ry in range(maxr):
x1 = rx*2000
x2 = rx*2000+2000-1
y1 = ry*2000+2000-1
y2 = ry*2000
print(x1,x2,y2,y1)
# slice entire tile into 2000x2000 pixels
vh_sub = vh.sel(x=slice(x1,x2),y=slice(y1,y2))
# apply rolling average: average over 5 timestamps (centered around the timestamp of
interest),if less than
vh_sub_roll = vh_sub['VH_gaussian'].rolling(dim={'time': 5},min_periods=2,center=True).mean()
subtile += 1
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)