- 积分
- 816
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2014-6-18
- 最后登录
- 1970-1-1
|

楼主 |
发表于 2016-1-28 16:17:20
|
显示全部楼层
;********************************************
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/shea_util.ncl"
load "/data/qxs/dxh/ncep/thick_specified_contourF.ncl"
;********************************************
begin
baofa_initial= asciiread("8423_cisk_test.txt",-1,"float")
counter_num=dimsizes(baofa_initial)
baofa=reshape(baofa_initial,(/floattoint(counter_num(0)/3.0),3/))
lat_baofa=baofa(:,1:1)/10.0
lon_baofa=baofa(:,2:2)/10.0
counter_point=dimsizes(lat_baofa)
f = addfile ("typhoon_8_poumian.nc", "r")
latitude=f->latitude
longitude=f->longitude
level=f->level
counter_level=dimsizes(level)
time = f->time
iymdh = cd_calendar(time, -3)
yrStrt=1984102306
yrLast=1984103012
;yrLast=1983092900
iStrt = ind(iymdh.eq.yrStrt)
iLast = ind(iymdh.eq.yrLast)
do ii=0,(counter_point(0)-1)
w=short2flt( f->w(iStrt:iStrt,:,:,:) )
sandu=short2flt( f->d(iStrt:iStrt,:,:,:) )
vo=short2flt( f->vo(iStrt:iStrt,:,:,:) )
do i=0,(counter_level-1)
pre_levels=level(i)
rh=short2flt( f->r(iStrt:iStrt,{pre_levels:pre_levels},:,:) );
;q= short2flt( f->q(iStrt:iStrt,{pre_levels:pre_levels},:,:) )
t2_zanshi_tmp = short2flt( f->t(iStrt:iStrt,{pre_levels:pre_levels},:,:) )
tmpprs=flt2dble(t2_zanshi_tmp)
tmp_ave=flt2dble(t2_zanshi_tmp)
es=6.112*exp(17.67*(tmpprs-273.15)/(tmpprs-29.65))
q=rh*(0.62197*es/(pre_levels-es))/100.
e = pre_levels * q/(0.62197+q)+1e-10;10^(-10)
tlcl = 55.0+2840.0/(3.5*log(tmp_ave)-log(e)-4.805)
theta = tmp_ave*(1000. / pre_levels )^(0.2854*(1.0-0.28*q))
eqt = theta*exp(((3376./tlcl)-2.54)*q*(1.0+0.81*q))
se=doubletofloat(eqt)
counter_se=dimsizes(se)
if (i.eq.0) then
se_output=new((/1,counter_level,counter_se(2),counter_se(3)/),"float")
end if
se_output(0:0,i:i,:,:)=se
delete([/pre_levels,q,t2_zanshi_tmp,tmpprs,tmp_ave,es,e,tlcl,theta,eqt,se/])
end do
counter=dimsizes(se_output)
se=reshape(se_output,(/counter(1),counter(2),counter(3)/))
se!0="level"
se!1="latitude"
se!2="longitude"
se&level=level
se&latitude=latitude
se&longitude=longitude
;t2_tmp=reshape(t2,(/counter(1),counter(2),counter(3)/))-273.15
;copy_VarCoords(se,t2_tmp)
vo_tmp=reshape(vo,(/counter(1),counter(2),counter(3)/))
vo_tmp=vo_tmp*100000
copy_VarCoords(se,vo_tmp)
sandu_tmp=reshape(sandu,(/counter(1),counter(2),counter(3)/))
sandu_tmp=sandu_tmp*100000
copy_VarCoords(se,sandu_tmp)
w_tmp=reshape(w,(/counter(1),counter(2),counter(3)/))
w_tmp=w_tmp*10
copy_VarCoords(se,w_tmp)
ti_string=tostring(iymdh(iStrt))
wks = gsn_open_wks ("png", "se_typhoon8423_"+ti_string ) ; open workstation
gsn_define_colormap(wks,"BlWhRe") ; choose colormap
; gsn_define_colormap(wks,"BlueRed")
;colors = (/"firebrick3","firebrick1","indianred1","lightsalmon","ivory1",\
; "lavenderblush","lavender","lightskyblue1","lightskyblue","deepskyblue",\
; "dodgerblue"/)
;gsn_define_colormap(wks, "WhBlGrYeRe")
res = True ; plot mods desired
; res@tiMainString = "January 1988" ; title
res@cnSmoothingOn=True
res@cnLevelSelectionMode = "ManualLevels" ; manual contour levels
res@cnLevelSpacingF = 2.5 ; contour interval
res@cnMinLevelValF = 280. ; min level
res@cnMaxLevelValF = 410. ; max level
;res@cnMinLevelValF = -100. ; min level
;res@cnMaxLevelValF = 40. ; max level
;res@cnMinLevelValF = -15. ; min level
;res@cnMaxLevelValF = 15. ; max level
;res@cnLevelSpacingF = 2.0 ; contour interval
; res@cnMinLevelValF = -3. ; min level
;res@cnMaxLevelValF = 3. ; max level
;res@cnLevelSpacingF = 0.5 ; contour interval
; res@cnMinLevelValF = -5. ; min level
;res@cnMaxLevelValF = 5. ; max level
;res@cnLevelSpacingF = 0.5 ; contour interval
res@cnLineLabelsOn = True ; turn on line labels
res@cnFillOn = True ; turn on color fill
;---This resource not needed in V6.1.0
res@gsnSpreadColors = True ; use full range of colors
;---This resource defaults to True in NCL V6.1.0
res@lbLabelAutoStride = True ; optimal labels
lat_special=lat_baofa(ii:ii,0)
;plot = gsn_csm_pres_hgt(wks,sandu_tmp(10:36,{lat_special},{120:155}),res)
;plot = gsn_csm_pres_hgt(wks,w_tmp(10:36,{lat_special},{125:155}),res)
;plot = gsn_csm_pres_hgt(wks,vo_tmp(10:36,{lat_special},{120:155}),res)
plot = gsn_csm_pres_hgt(wks,se(10:36,{lat_special},{100:155}),res)
;plot = gsn_csm_pres_hgt(wks,t2_tmp(10:36,{5:20},{lon_special}),res)
;plot = gsn_csm_pres_hgt(wks,se(10:36,{5:25},{lon_special}),res)
print(lat_special)
;mresp = True
;mresp@txFontHeightF = 0.013
;mresp@txFontColor = "red"
;mresp@txFontThicknessF = 2.5
;gsn_text(wks,plot,"~F37~m",lon_baofa(ii:ii,:),lat_special,mresp)
;thick_specified_contourF(plot,0,4,-1)
thick_specified_contourF(plot,344,4,-1)
draw(plot)
frame(wks)
iStrt=iStrt+1
;delete([/plot,wks,ti_string,se,lon_special,t2_tmp/])
delete([/plot,wks,ti_string,se,lat_special,vo_tmp,sandu_tmp,w_tmp/])
;delete([/plot,wks,ti_string,se,lon_special,vo_tmp/])
end do
end
这个是ncl程序。 |
|