好奇心Log 发表于 2024-4-22 00:44:22

数据下载 | 探空数据自动下载&可视化基础

本帖最后由 好奇心Log 于 2024-4-22 00:48 编辑

探空资料简介
探空站一般是为探测高空气象要素而建立的,通过探空气球来收集每天8点和20点的高空气象数据,遇到特殊天气(台风等)会进行加密观测。可以获近地层、850、700、500、200百帕的温度、温度露点差、位势高度、风速风向等气象要素。探空数据在天气预报有着重要的指示作用,可以分析出高空引导气流的位置、强度,及到达本地的时间和对当地天气的影响情况。

数据来自怀俄明大学:http://weather.uwyo.edu/upperair/seasia.html
我国的探空站表格:http://data.cma.cn/article/showPDFFile.html?file=/pic/static/doc/B/B.0011.0001C/UPAR_CHN_MUL_STATION.pdf图片

批量下载数据
在之前的一些文章里使用过siphon,他除了可以下载到预报数据、再分析数据以外还可以下载到怀俄明的探空数据。
下面为简单的示例,时间段和下载的站点可以自行设置。

#导入模块
import datetime
from metpy.units import units
from siphon.simplewebservice.wyoming import WyomingUpperAir

# 设置下载时段(这里是UTC时刻)
start = datetime.datetime(2019, 8, 1, 0)
end = datetime.datetime(2019, 8, 2, 0)

datelist = []
while start<=end:
    datelist.append(start)
    start+=datetime.timedelta(hours=12)

# 选择下载站点(以北京为例)
stationlist = ['54511']

# 批量下载
for station in stationlist:
    for date in datelist:
      try:
            df = WyomingUpperAir.request_data(date, station)
            df.to_csv(station+'_'+date.strftime('%Y%m%d%H')+'.csv',index=False)
            print(f'{date.strftime("%Y%m%d_%H")}下载成功')
      except Exception as e:
            print(f'{date.strftime("%Y%m%d_%H")}下载失败: {e}')
            pass
读取示例数据
数据包含气压、高度、气温、露点、风向、风速、经向风速、纬向风速,还包含探空站观测时刻、经纬度和高程信息。

import pandas as pd
import metpy.calc as mpcalc
from metpy.cbook import get_test_data
from metpy.plots import add_metpy_logo, SkewT
from metpy.units import units
import matplotlib.pyplot as plt
df = pd.read_csv('./54511_2019080200.csv')
df.info()


数据可视化

p = df['pressure'].values * units.hPa
T = df['temperature'].values * units.degC
Td = df['dewpoint'].values * units.degC
wind_speed = df['speed'].values * units.knots
wind_dir = df['direction'].values * units.degrees
u, v = mpcalc.wind_components(wind_speed, wind_dir)

fig = plt.figure(figsize=(9, 9))
skew = SkewT(fig, rotation=45)

# Plot the data using normal plotting functions, in this case using
# log scaling in Y, as dictated by the typical meteorological plot.
skew.plot(p, T, 'r')
skew.plot(p, Td, 'g')
skew.plot_barbs(p, u, v)
skew.ax.set_ylim(1050, 300)
skew.ax.set_xlim(0, 40)

# Calculate LCL height and plot as black dot. Because `p`'s first value is
# ~1000 mb and its last value is ~250 mb, the `0` index is selected for
# `p`, `T`, and `Td` to lift the parcel from the surface. If `p` was inverted,
# i.e. start from low value, 250 mb, to a high value, 1000 mb, the `-1` index
# should be selected.
lcl_pressure, lcl_temperature = mpcalc.lcl(p, T, Td)
skew.plot(lcl_pressure, lcl_temperature, 'ko', markerfacecolor='black')

# Calculate full parcel profile and add to plot as black line
prof = mpcalc.parcel_profile(p, T, Td).to('degC')
skew.plot(p, prof, 'k', linewidth=2)

# Shade areas of CAPE and CIN
skew.shade_cin(p, T, prof)
skew.shade_cape(p, T, prof)

# An example of a slanted line at constant T -- in this case the 0
# isotherm
skew.ax.axvline(0, color='c', linestyle='--', linewidth=2)

# Add the relevant special lines
skew.plot_dry_adiabats()
skew.plot_moist_adiabats()
skew.plot_mixing_lines()
大气物理知识回顾

其实到这里本来就应该结束了,但是还想根据这张图再继续说说大气物理中的静力稳定度的问题。
通过大气垂直探空数据绘制T-lnP图,在天气学中经常用这种方式来判断对流发展与否。

T-lnP图
先说几个基本概念:干绝热线(红),湿绝热线(蓝),等饱和混合比 线 (绿)
红、蓝两条线分别代表干气团和湿气团上升过程中的温度递减变化程度,至于为什么蓝色的线斜率更大,也就是为什么上升同样高度湿空气比干空气温度减少少?这是因为饱和湿空气在上升过程中,会发生形态变化,气态水分子变成液态水分子,在这个相变过程中会释放潜热,既然这个过程会放热自然温度减少就更小了。
绿线代表的等饱和比湿线,也就是表明在这个温度、这个高度下空气达到饱和,如果在继续上升空气中的水汽就会凝结成水滴。

fig = plt.figure(figsize=(9, 9))
skew = SkewT(fig, rotation=45)
skew.plot_dry_adiabats()
skew.plot_moist_adiabats()
skew.plot_mixing_lines()

T-lnP图中线条的物理意义
大气层结曲线:环境空气温度随高度的分布曲线。
大气状态曲线:气块作垂直运动时,温度随高度的变化曲线。

抬升凝结高度(LCL):气块达到这个高度,水汽达到饱和,再向上会就凝结成水滴。
自由对流高度(LFC):气块达到这个高度以后不需要任何外力就可以自由上升。
平衡高度(EL):受力平衡点,垂直速度最大,加速度为0。
对流云顶高度(MPL):气块能达到的最大高度,取决于EL层以上负不稳定能量刚好抵消CAPE时所达到的高度。

对流有效位能(CAPE):正不稳定能量,是气块达到自由对流高度后可以获得继续上升的能量。
对流抑制能量(CIN):负不稳定能量,是大气底层的气块要能达到自由对流高度,至少需从其它途径获得能量的下限。

有了上面这些基本介绍再对照着刚才可视化的图可能会更好理解。
红色实线为层结曲线,黑色实线为状态曲线,其他各个高度和能量已经在图中标注出来。MPL是大概画了个位置,原则还是在EL上面找到一个高度使得蓝色区域面积与红色的CAPE面积相等。

大气分型
了解了上面这些内容,就可以根据层结曲线和状态曲线的分布将大气稳定性分为条件性不稳定、绝对稳定、绝对不稳定3种类型。
更多详细内容可以看学习资源 |大气物理学(南信大官方)。

条件不稳定
1.1 真潜在不稳定

1.2 假潜在不稳定

绝对稳定

绝对不稳定

根据分型和上面我们对北京地区探空数据的可视化,可以得出2019年8月2日北京探测到的大气属于假潜在不稳定。要借助一定外部的因素才能发生对流,比如非绝热加热、垂直运动等。

资源获取
获取数据及jupyter notebook脚本:在好奇心Log公众号后台回复“探空”




文章来源于微信公众号:好奇心Log
页: [1]
查看完整版本: 数据下载 | 探空数据自动下载&可视化基础