- 积分
- 415
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2017-5-29
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
小白一枚,ncl学习中...最近需要分析逆温层,手里只下了ECMWF的nc数据,结合官网例子画出的斜温图。
贴上来分析和交流,贴出代码分享给需要的小伙伴。
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/skewt_func.ncl"
begin
f = addfile("D:/data/201903t2.nc","r")
;经纬度:24.5,98.5
r = short2flt(f->r(:,:,12,12))
tk = short2flt(f->t(:,:,12,12))
u = short2flt(f->u(:,:,12,12))
v = short2flt(f->v(:,:,12,12))
;print(r)
;单位换算
t = tk-273.15
;printVarSummary(avet)
;printVarSummary(aver)
;print(r(:,:))
;print(aver(0,:))
;计算露点温度
td = new(dimsizes(t),float)
td!0 = "time"
td!1 = "level"
td@units = "degC"
td&time = tk&time
td&level = tk&level
do i = 0,123
do j = 0,26
td(i,j) = r(i,j)*(0.198+0.0017*t(i,j))+0.84*t(i,j)-19.2
end do
end do
;print(avetd)
;设置绘图变量
tt = 111 ;时间点选取
ap = tk&level
atc = t(tt,:)
atd = td(tt,:)
az = new(dimsizes(ap),float)
az = (/0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0/)
uu = u(tt,:)
vv = v(tt,:)
wspd = sqrt(uu^2+vv^2)
wdir = wind_direction(uu,vv,0)
;print(az)
;print(wspd)
;print(wdir)
wks = gsn_open_wks("png","03281800")
;底图
skewtOpts = True
skewtOpts@DrawColAreaFill = True
skewtOpts@DrawFahrenheit = False ;横坐标显示摄氏度单位
skewtOpts@tiMainString = "Skew-T:20190328 18:00"
skewt_bkgd = skewT_BackGround(wks,skewtOpts)
draw(skewt_bkgd)
;数据
dataOpts = True
dataOpts@PrintZ = False
dataOpts@ThermoInfo = False
dataOpts@colTemperature = "black"
dataOpts@colDrewPt = "red"
dataOpts@linePatternDrewPt = 1
skewt_data = skewT_PlotData(wks,skewt_bkgd,ap,atc,atd,az,wspd,wdir,dataOpts)
draw(skewt_data)
frame(wks)
end
|
|