python - 如何在 python 中使用 xarray 将气候数据集相乘?
问题描述
输入 :
tws = ds1.lwe_thickness
print(tws.size)
print(tws.shape)
# tws
# vectorization
stacked1 = tws.stack(space =("latitude", "longitude")) #
stacked
print(stacked1.shape)
# standardization
Y = (stacked1-stacked1.mean())/(stacked1.std())
print(Y)
print(Y.shape)
print(Xt.shape) # precipitation dataset
print(Y.shape) # total water storage dataset
# co-variance between precipitation and total water storage
Cxy = (Xt*Y)/(72)
print(Cxy.shape)
print(Cxy)
print(Cxy.dims)
输出 :
(64800, 72) (72, 64800) (64800, 0) <xarray.DataArray (space: 64800, time: 0)> array([], shape=(64800, 0), dtype=float64) 坐标:*时间(time) datetime64[ns] * space (space) MultiIndex
- 纬度(空间) float64 -90.0 -90.0 -90.0 -90.0 ... 89.0 89.0 89.0 89.0
- 经度(空间) float64 0.0 1.0 2.0 3.0 4.0 ... 356.0 357.0 358.0 359.0('空间','时间')
最初 Xt 矩阵的大小是 64800 72,Y 是 72 64800。这两个矩阵相乘后,大小应该是 64800 64800,但我得到 64800 0。为什么会这样?帮我解决这个问题。基本上我在这里使用 xarray 。
图片附在这里
解决方案
推荐阅读
- c# - 在 c# 中带有数组的 null ReferenceException
- loops - 发生错误时循环的正确方法是什么
- shopify - 禁用或删除客户帐户
- azure-devops - 无法在本地或远程找到“开发”或“主”分支。- 语义 gitversion
- c - 可以在块范围内定义变量“EL_adv”[MISRA 2012 Rule 8.9,advisory] | pclint 9003 和 pclint 9075
- android - 这里 SDK Android 在布局更改时调整大小
- ios - SFSafariViewController 没有带有自定义条形颜色的暗模式
- reactjs - React - 带有输入变量的 Apollo 客户端查询
- python - pyplot:为图像图定义自定义颜色图,将颜色分配给某个值
- r - 在基本函数 barplot() 中自定义 Barplot