mean_pressure_weighted函数的计算

Calculation of the mean_pressure_weighted function

mean pressure weighted function defined here 似乎是基于一个奇怪的公式(见下面的代码)。 Holton(第 5 版,第 20 页)和许多其他人计算所需变量乘以 dp 而不是乘以 pdp 的总和,如下面的代码所示。此外,大多数作者通过 dp 的总和对结果进行归一化,dp 是表面压力 - 顶部压力。然而,下面的代码使用表面压力^2 - 顶部压力^2。下面使用的公式是否有任何参考。谢谢

# Taking the integral of the weights (pressure) to feed into the weighting
# function. Said integral works out to this function:
pres_int = 0.5 * (pres_prof[-1] ** 2 - pres_prof[0] ** 2)

# Perform integration on the profile for each variable
return [np.trapz(var_prof * pres_prof, x=pres_prof) / pres_int for var_prof in others]

不幸的是,我现在无法访问我的 Holton 副本,所以我无法查看那里做了什么。我可以说,如果您按 dp 而不是 p * dp 加权,则您计算的不是 压力加权 平均值,您只是在计算平均值。

所使用的公式直接脱离了weighted average using an integral的定义,最重要的是:

当您将 w(x) 替换为 p 并将 dx 替换为 p 时,您将得到 p * dp 的积分,它具有反导数 p**2.

向 MetPy 添加一个函数,该函数执行相同的一组积分而不用任何加权,这可能会很有用,因为这与简单地使用 numpy.mean.

不同