- 积分
- 172
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2020-9-15
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
import numpy as np
import pandas as pd
import metpy.calc as mpcalc
from metpy.plots import Hodograph, SkewT
from metpy.units import units
df=pd.read_csv(r'F:/短时科/zhuzhu/57993_2022061300.csv',na_values={'9999'},keep_default_na=False)
#print(df)
#df = df.dropna(subset=('temperature', 'dewpoint', 'direction', 'speed', 'u_wind', 'v_wind'), how='all').reset_index(drop=True)
p = df['pressure'].values[1:150] * units.hPa
T = df['temperature'].values[1:150] * units.degC
Td = df['dewpoint'].values[1:150] * units.degC
wind_speed = df['speed'].values[1:150]*2.5 * units.knots
wind_dir = df['direction'].values[1:150] * units.degrees
u, v = mpcalc.wind_components(wind_speed, wind_dir)
#print(Td)
interval = np.logspace(2, 3, num=25) * units('hPa')
idx = mpcalc.resample_nn_1d(p, interval)
fig = plt.figure(figsize=(9, 9))
skew = SkewT(fig, rotation=30)
skew.plot(p, T, 'r', linewidth=2)
skew.plot(p, Td, 'g', linewidth=2)
skew.plot_barbs(p[idx], u[idx], v[idx])
skew.plot_dry_adiabats()
skew.plot_moist_adiabats()
skew.plot_mixing_lines()
skew.ax.axvline(0, color='c', linestyle='--', linewidth=2)
skew.ax.set_ylim(1000, 100)
skew.ax.set_xlim(-40, 60)
lcl_pressure, lcl_temperature = mpcalc.lcl(p[0], T[0], Td[0])
学习网上大家的语句绘制探空图,但是计算lcl的语句则报错 unsupported operand type(s) for -: 'str' and 'float',请问有大神能帮解答吗。
|
|