平均压力加权函数的计算

2024-09-20 01:34:32 发布

您现在位置:Python中文网/ 问答频道 /正文

定义的mean pressure weighted函数here似乎基于一个奇怪的公式(见下面的代码)。Holton(第五版,第20页)和许多其他人计算所需变量乘以dp而不是pdp的总和,如下代码所示。此外,大多数作者还通过将dp之和(即上游压力-顶部压力)来规范化结果。然而,下面的代码使用了SUFREACE PRESSION ^2-top PRESSION ^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]

Tags: theto代码forvarfunction公式int
1条回答
网友
1楼 · 发布于 2024-09-20 01:34:32

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

所使用的公式直接来自aweighted average using an integral的定义,最重要的是:

enter image description here

当你把w(x)替换为pdx替换为p时,你得到了p * dp的积分,它的反导数为p**2

向MetPy中添加一个函数,该函数不需要任何加权就可以完成相同的积分集,因为这与简单地使用numpy.mean不同

相关问题 更多 >