- 积分
- 3700
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2018-6-12
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
请教家园的大佬们,本人想用gsn_csm_pres_hgt_streamline绘制剖面流线图,但画出来的流线几乎都是平行的,有垂直方向上的也特别奇怪,代码及出图结果如下,有无高手知道这是咋回事呀?
begin
f = addfile("E:/Trend_0.25/2020.01_02_1h.nc", "r")
lon = f->longitude ;longitude=281
lat = f->latitude ;latitude=241
prs = int2flt(f->level({1000:200})) ;lev=20 100,200,250,300,350,400,450,500,550,600,650,700,750,800,850,900,925,950,975,1000
time = f->time ;time=232
time@units = "hours since 1900-01-01 00:00:00.0"
utc_date = cd_calendar(time, 0)
year = tointeger(utc_date(:,0))
month = tointeger(utc_date(:,1))
day = tointeger(utc_date(:,2))
hour = tointeger(utc_date(:,3))
nmonth = 1
nday_start = 21
nday_end = 23
nhour_start = 0
nhour_end = 23
do iday = nday_start,nday_end
do ihour = nhour_start,nhour_end
ii = ind(month.eq.nmonth.and.day.eq.iday.and.hour.eq.ihour)
rh = short2flt(f->r(ii,{1000:200},{20:40},{108})) ;相对湿度
tk = short2flt(f->t(ii,{1000:200},{20:40},{108})) ;温度
V = short2flt(f->v(ii,{1000:200},{20:40},{108})) ;径向速度
omega = short2flt(f->w(ii,{1000:200},{20:40},{108})) ;垂直速度
rh@_Fillvalue = -32767
rh@units = "%"
tk@_Fillvalue = -32767
V@_Fillvalue = -32767
V@units = " "
V@long_name = " "
omega@_Fillvalue = -32767
omega@long_name = " "
tc = tk - 273.16 ;转换为摄氏度
copy_VarMeta(tk, tc)
tc@units = "degC"
es = new(dimsizes(tk),typeof(tk),tk@_Fillvalue)
es := where(tk.gt.273.16,6.1078*exp(17.2693882*tc/(tk-35.86)),6.1078*exp(21.8745584*tc/(tk-7.66))) ;单位hPa ;运用饱和水汽压Tetens经验公式
copy_VarCoords(tk,es)
prsconform = conform(es,prs,0) ;将气压一维数组扩展为跟es一样的二维数组
qs = 0.622*es/(prsconform - 0.378*es) ;计算饱和比湿,单位g/g
e = es * rh/100 ;计算水汽压,根据rh的单位原因除以100
copy_VarCoords(rh,e)
q = 0.622*e/(prsconform - 0.378*e) ;计算比湿
copy_VarCoords(rh,q)
tlcl = 55.0+2840.0/(3.5*log(tk)-log(e)-4.805) ;凝结高度的绝对温度
theta = tk * ((1000/prsconform)^(0.2854*(1.0-0.28*q)))
copy_VarCoords(rh,theta)
se = theta*exp(((3376./tlcl)-2.54)*q*(1.0+0.81*q))
copy_VarCoords(tk,se)
copy_VarMeta(tk,se)
se@long_name = " "
se@units = " "
wks = gsn_open_wks ("png", "thse_"+tostring(nmonth)+"_"+tostring(iday)+"_"+tostring(ihour))
re = True
re@gsnDraw = False
re@gsnFrame = False
re@gsnLeftString = " "
re@gsnRightString = " "
re@cnLinesOn = False
re@cnFillOn = True
re@cnInfoLabelOn = False
re@cnLevelSelectionMode = "ExplicitLevels"
re@cnLevelSpacingF = 0.2
re@tiYAxisString = "Pressure(hPa)"
re@tiMainString = tostring(nmonth)+"_"+tostring(iday)+"_"+tostring(ihour)+" 108E"
re@cnLevels = (/-1.6,-1.3,-1.0,-0.7,-0.4,0.4,0.7,1.0,1.3,1.6/)
re@cnFillPalette = "CBR_coldhot"
re@pmLabelBarHeightF = 0.1
re@lbTitleString = "Pa/s"
re@lbTitlePosition = "Bottom"
plot_omega = gsn_csm_pres_hgt(wks, omega, re)
res = True
res@gsnDraw = False
res@gsnFrame = False
prsconform = conform(es,prs*100,0) ;将气压转换为Pa
omega = omega_to_w(omega,prsconform,tk) ;将垂直速度转换为m/s
omega = omega*100
res@pmTickMarkDisplayMode = "Always" ; more detailed tickmarks
res@stArrowLengthF = 0.008
res@stMinArrowSpacingF = 0.008 ;controls the distance between drawn arrows. The default is 0.0, which could draw arrows right on top of each other
res@stArrowStride = 3
res@stLineThicknessF = 5.0
res@stMinDistanceF = 0.06 ; distance between lines
res@stMinLineSpacingF = 0.001
res@cnLevelSelectionMode = "ManualLevels" ;根据上述最值设置等值线数值
res@cnLevelSpacingF = 4
res@cnLinesOn = True
res@cnSmoothingOn = True
res@cnLineLabelsOn = True ;关闭等值线标签
res@cnFillOn = False ; 打开填色
res@cnInfoLabelOn = False
res@cnLineThicknessF = 2
res@cnLineColor = "red"
plot_se = gsn_csm_pres_hgt_streamline(wks, se, V, omega, res)
overlay(plot_omega, plot_se)
draw(plot_omega)
frame(wks)
delete(ii)
delete(rh)
delete(tc)
delete(V)
delete(omega)
delete(tk)
delete(es)
delete(prsconform)
delete(qs)
delete(e)
delete(q)
delete(tlcl)
delete(theta)
delete(se)
end do
end do
end
|
-
|