CAPE_CIN返回不正确的值

2024-09-30 06:11:36 发布

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

我感兴趣的是根据过去的探测结果计算海角。我做了一些测试计算,由于某些原因,我的CAPE值与当前测深提供的值不一致

例如,见latest sounding from Boa Vista, Brazil(随机挑选的b/c,温度足以在一月份形成明显的海角)。数据显示CAPE为189 J/kg,而metpy给出的数值要低得多。具体地说,如果我使用探测中所有压力水平的所有数据,我得到72 J/kg。相反,如果我只使用标准压力水平(1000、925等——如下代码所示),我得到1 J/kg

我复制了下面的代码。有人能帮我找出正确的方法吗

谢谢, 纪尧姆

# IMPORT:
import metpy.calc as mpcalc
from metpy.units import units
import numpy as np

# SOUNDING:
p=np.array([1003,925,850,700,500,400,300,200,100])
t=np.array([24.4,20.6,16.4,10.4,-5.3,-15.5,-28.7,-52.3,-79.7])
d=np.array([21.1,20.2,16.3,6.5,-7.0,-25.5,-51.7,-73.3,-87.7])

# UNITS:
p = units.Quantity(p, "hPa")
t = units.Quantity(t, "degC")
d = units.Quantity(d, "degC")

# CALCULATE CAPE:
cape1,cin1 = mpcalc.surface_based_cape_cin(p,t,d)
prof = mpcalc.parcel_profile(p, t[0], d[0])

cape2,cin2 = mpcalc.cape_cin(p,t,d,prof)

print(cape1)
print(cape2)

Tags: 数据代码fromimportnp水平arrayquantity
1条回答
网友
1楼 · 发布于 2024-09-30 06:11:36

怀俄明州档案中的计算值使用lowest 500m的平均值来表示用于计算的地块。不幸的是,这并非微不足道,但可以通过MetPy实现:

from datetime import datetime

import metpy.calc as mpcalc
from metpy.units import pandas_dataframe_to_unit_arrays, units
import numpy as np
from siphon.simplewebservice.wyoming import WyomingUpperAir

df = WyomingUpperAir.request_data(datetime(2021, 1, 31, 12), '82022')
data = pandas_dataframe_to_unit_arrays(df)

# Calculate the mixed parcel need to pass pressure as an additional variable to "mix" so that we get
# an appropriate "average pressure" to use as the mixed parcel
parcel_temp, parcel_dewp, mixed_press = mpcalc.mixed_layer(data['pressure'], data['temperature'],
                                                           data['dewpoint'], data['pressure'],
                                                           height=data['height'], depth=500 * units.m)

# Replace the lowest part of the sounding with the mixed value
press_mixed = np.concatenate([np.atleast_1d(mixed_press), data['pressure'][data['pressure'] < mixed_press]])
temp_mixed = np.concatenate([np.atleast_1d(parcel_temp), data['temperature'][data['pressure'] < mixed_press]])
dewpt_mixed = np.concatenate([np.atleast_1d(parcel_dewp), data['dewpoint'][data['pressure'] < mixed_press]])

# Calculate the parcel profile, including the LCL this interpolates the sounding to the level of the LCL
# as well, so that the profile and all variables have the same points
p, t, d, prof = mpcalc.parcel_profile_with_lcl(press_mixed, temp_mixed, dewpt_mixed)

lcl_press, lcl_temp = mpcalc.lcl(mixed_press, parcel_temp, parcel_dewp)
cape, cin = mpcalc.cape_cin(p, t, d, prof)

混合到位后,我得到的LCL压力/温度值(943.84 hPa和20.52 degC)与怀俄明州一致。这使我的CAPE为208 J/kg,CIN为-16 J/kg,这与怀俄明州报告的结果更为一致。任何差异,特别是对于这种轻微不稳定的测深,都可能是由于计算细节的差异造成的,就像原始差异是使用浅层混合地块造成的一样

这应该可以通过metpy.calc.mixed_layer_cape_cin实现,但由于a bug的原因,目前不适用于非基于压力的深度

相关问题 更多 >

    热门问题