【发布时间】:2023-01-27 17:14:51
【问题描述】:
我有一个带有变量 tas 和 hurs 的 netcdf 文件。我想使用 Cdo python 包的 expr 运算符来计算一个新变量 h。 h的公式为:
h=5/9 * (e-10), where
e = 6.112 * 10^(7.5*tas/(237.7+tas))*hurs/100
【问题讨论】:
标签: python
我有一个带有变量 tas 和 hurs 的 netcdf 文件。我想使用 Cdo python 包的 expr 运算符来计算一个新变量 h。 h的公式为:
h=5/9 * (e-10), where
e = 6.112 * 10^(7.5*tas/(237.7+tas))*hurs/100
【问题讨论】:
标签: python
请注意,python-cdo 只是cdo 的包装器,因此我建议您先使用cdo,然后将其转换为 python 包装器版本(如果您确实需要它......)。
我认为编写与 expr 运算符的输入完全相同的公式应该可行。如果您查看文档,*、+、/ 和^ 都是有效的运算符,您只需使用来自 netcdf 文件infile 的变量名为表达式提供输入变量。
cdo expr,’out=(5/9)*((6.112 * 10^(7.5*tas/(237.7+tas))*hurs/100)-10);’ infile outfile
【讨论】: