- 积分
- 2050
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2012-5-12
- 最后登录
- 1970-1-1
|
发表于 2019-2-21 11:51:28
|
显示全部楼层
; 假相当位温
begin
fi = addfile("./new.grib2", "r")
time = fi->initial_time0_hours
;
YYYYMMDDHH = tostring(cd_calendar(time, -3))
dims = dimsizes(YYYYMMDDHH)
cst=new((dims),string)
cst1=new((dims),string)
do i = 0,dims-1
utc = str_get_cols(YYYYMMDDHH(i), 0, 7)
hr = str_get_cols(YYYYMMDDHH(i), 8, 9)
cst(i) = systemfunc("date +'%Y%m%d%H' -d " + "'" + utc + " " + hr + " " + 8 + " hour'")
cst1(i) = str_get_cols(cst(i), 2, 9)
end do
;读取数据
rh=fi->RH_P0_L100_GLL0(:,10:30,:,:)
;print(rh(0,0,0)) ;rh=17.2%
lev=fi->lv_ISBL0(10:30)
levv=lev/100
;print(levv)
dims_lev = dimsizes(levv)
;print(levv)
tk=fi->TMP_P0_L100_GLL0(:,10:30,:,:)
tc=tk-273.16
copy_VarCoords(tk,tc)
printVarSummary(tc)
levv4d=conform(tc,levv,1)
;print (levv4d(0,20,0:10,0:10))
copy_VarCoords(tk,levv4d)
printVarSummary(levv4d)
eqt=new((/dims,dims_lev,181,360/),float)
copy_VarCoords(tk,eqt)
;es = 6.112*exp((17.67*tt(k,n,:,:))/(tt(k,n,:,:)+273.16-29.65))
;es = where( tt(k,n,:,:).lt.0, 6.1078*exp(21.87* tt(k,n,:,:)/( t1(k,n,:,:)-7.66)),\
; 6.1078*exp(17.2693882*tt(k,n,:,:)/(t1(k,n,:,:)-35.86)))
;qs = 0.62197*es/(levv(n)-0.378*es) ;prs 为高度,设置高度循环
;q = qs*rh(k,n,:,:)/100.
a1 = where(tk.gt. 263.0, 0.622*6.11*exp(17.26*(tk-273.16)/(tk-35.86)), \
0.622*6.11*exp(21.87*(tk-273.16)/(tk-7.66)))
b1= where(tk .gt. 263.0, levv4d-0.278*exp(17.26*(tk-273.16)/(tk-35.86)),\
levv4d-0.278*exp(21.87*(tk-273.16)/(tk-7.66)))
q=a1/b1/100
ee = (levv4d*q)/(0.62197+q)
tlcl=55.0+2840.0/(3.5*log(tk)-log(ee)-4.805)
theta=tk*((1000./levv4d)^(0.2854*(1.0-0.28*q)))
eqt=theta*exp(((3376./tlcl)-2.54)*q*(1.0+0.81*q))
;eqt!0="time"
;eqt!1="levels"
;eqt!2="lat"
;eqt!3="lon"
;copy_VarCoords(tk,eqt)
res = True
res@gsnDraw = False ; do not draw
res@gsnFrame = False ; do not advance the frame
res@trYReverse = True ; Reverse the Y values.
res@cnFillOn =False ; turns on color fill
res@cnFillPalette = "BlueDarkRed18" ; set color map
res@cnLineLabelsOn = True ; no contour labels
;res@cnLevelSelectionMode = "ManualLevels" ; manual levels
;res@cnMinLevelValF = -1.2
;res@cnMaxLevelValF = 1.2
;res@cnLevelSpacingF = 0.1
; x-bottom axis changes
;res@tmXBMode = "Explicit" ; Define own tick mark labels.
;res@tmXBValues = eqt&lat ; location of explicit labels
;res@tmXBLabels = cst1
;res@tmXBLabelAngleF = 45. ; change label angle
;res@tmXBMinorOn = False ; No minor tick marks.
;res@tmXBLabelJust = "CenterCenter" ; label justification
;res@tmXBLabelFontHeightF = .015 ; Font size
;******************画图****************************
wks = gsn_open_wks("png", "tj")
res@gsnLeftString = "tjj"
plot = gsn_csm_pres_hgt(wks,eqt(0,:,{20:40},{113}),res)
getvalues plot ; get the X/Y axis min/max for use in the loglin plot
"trXMinF" : trxmin
"trXMaxF" : trxmax
"trYMinF" : trymin
"trYMaxF" : trymax
end getvalues
loglin = create "logling" logLinPlotClass wks ; draw a loglin plot, with expanded X/Y axis
"trXMinF" : trxmin-1
"trXMaxF" : trxmax+1
"trYMinF" : trymin
"trYMaxF" : trymax
"trYReverse" : True
"vpXF" : .15 ; set the X-axis NDC starting point
"vpYF" : .8 ; set the Y-axis NDC starting point
"vpWidthF" : .7 ; set the width of the plot in NDC units
"vpHeightF" : .45 ; set the height of the plot in NDC units
end create
overlay(loglin,plot) ; overlay plot with the loglin plot
draw(loglin) ; draw the plot
frame(wks)
end
http://bbs.06climate.com/forum.php?mod=attachment&aid=ODExNTd8ODNiYThkNTM0YjgyMjllN2I0MjIzMmY4ZjIyNzlhMGF8MTczMjQyNDA3Ng%3D%3D&request=yes&_f=.png |
-
|