CAPE_CIN返回不正确的值

0 人关注

我对从过去的探测数据中计算CAPE感兴趣。我已经做了一些测试计算,但由于某些原因,我的CAPE值与那些与当前测绘提供的值不一致。

e.g., see the 来自巴西Boa Vista的最新声音 (随机选取,因为足够温暖,在1月份有一个可观的CAPE)。数据显示CAPE为189J/kg,而metpy给我的数值要低得多。具体来说,如果我使用探空中所有压力水平的所有数据,我得到72J/kg。如果我只使用标准压力水平(1000、925等--在下面的代码中显示),我得到1J/kg。

I've copied my code below. Could someone help me figure out how to do this correctly?

# 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)
    
python
metpy
Guillaume Mauger
Guillaume Mauger
发布于 2021-02-01
1 个回答
DopplerShift
DopplerShift
发布于 2021-02-18
已采纳
0 人赞同

怀俄明州档案馆的计算值使用的是一个平均的 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)