【问题标题】:Calculate complex expression with the Cdo package in python用python中的Cdo包计算复数表达式
【发布时间】: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


    【解决方案1】:

    请注意,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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-03-09
      • 1970-01-01
      • 2012-01-02
      • 1970-01-01
      • 2021-04-11
      相关资源
      最近更新 更多