- 积分
- 119
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2013-7-27
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2013-8-12 17:23:42
|
显示全部楼层
;********************************************************
; Load NCL scripts
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 "$NCARG_ROOT/lib/ncarg/nclscripts/csm/skewt_func.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/wind_rose.ncl"
begin
files = systemfunc("ls ./exmoc*.nc") ;批量处理
f0 =addfiles(files,"r") ;以只读方式打开一个文件
ListSetType (f0, "join")
strf =f0[:]->strf
strf!0 ="time"
; tem =lonFlip(tem0)
if (any(isnan_ieee(strf))) then ;isnan_ieee返回包含ieee nan的数组
value = 1.e20
replace_ieeenan (strf, value, 0) ;该函数用于将nan值转换成用户指定的值 ;value是用于代替nan
strf@_FillValue = value
end if
strf1 =strf(time|:,{dep|0:4500},{lat|0:30})
; strf1=strf1*1e1
lat =strf1&lat
dep =strf1&dep
lat@units ="degrees_north"
dep@units ="m"
strf1_mean=dim_avg_n_Wrap(strf1,0) ;求年平均
strf2 =dim_rmvmean_n_Wrap(strf1,0)
print(strf1(0,0,:))
delete(strf2@long_name) ;去掉strf2中的属性long_name
printVarSummary(strf1)
;******************************************
;plot
wks1 =gsn_open_wks("ps","external_month_mean_minus_annual_mean_streamfunction")
wks2 =gsn_open_wks("ps","external_annual_mean")
gsn_define_colormap(wks1,"ncl_default")
gsn_define_colormap(wks2,"ncl_default")
res =True
plot =new(12,graphic)
res@gsnDraw =False
res@gsnFrame =False
res@cnLevelSelectionMode ="ExplicitLevels" ;设置colorbar等距
res@cnMinLevelValF =-1.6
res@cnMaxLevelValF =0.5
res@cnLevelSpacingF =0.1
res@cnLevels =(/-1.6,-1.2,-1.0,-0.8,-0.6,-0.4,-0.2,-0.1,-0.08,-0.07,-0.05,-0.03,-0.02,0,0.02,0.05,0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.5,0.6/)
res@cnInfoLabelFontHeightF =0.012
res@tmXBLabelFontHeightF =0.025
res@tmYLLabelFontHeightF =0.025
res@tmXBLabelsOn = False ; no bottom labels
res@tmXBOn = False ; no bottom tickmarks
res@tmYRLabelsOn = False ; no right labels
res@tmYROn = False ; no right tickmarks
res@tmYLLabelsOn = False ; do not draw left labels
res@tmYLOn = False ; no left tickmarks
res@tmXTLabelsOn = False ; do not draw top labels
res@tmXTOn = False
res@tmXBOn =False
res@tmXBLabelFontColor =1
res@tmYLLabelFontColor =1
res@lbLabelStride =1
res@lbLabelBarOn =False
res@lbOrientation ="Vertical";
res@vpHeightF =0.4
res@vpWidthF =0.6
res@cnFillOn =True
res@cnLinesOn =False
res@cnLineLabelsOn =False
res@cnInfoLabelOn =False
res@gsnSpreadColors=True
res@lbOrientation ="vertical"
; res@gsnPaperHeight =15
res@sfXArray =lat
res@sfYArray =dep
res@gsnYAxisIrregular2Linear =True
res@trYReverse =True
do i=0,1
plot(i+1)=gsn_csm_contour(wks1,strf2(i+1,:,:),res)
plot(i+4)=gsn_csm_contour(wks1,strf2(i+4,:,:),res)
plot(i+7)=gsn_csm_contour(wks1,strf2(i+7,:,:),res)
end do
res@tmYLOn =False
res@tmXBOn =True
res@tmXBLabelsOn = True
print(lat)
do i=0,1
plot(i+10)=gsn_csm_contour(wks1,strf2(i+10,:,:),res)
end do
res@tmYLOn =True
res@tmYLLabelsOn = True
plot(9) =gsn_csm_contour(wks1,strf2(9,:,:),res)
res@tmXBOn =False
res@tmXBLabelsOn = False
plot(0) =gsn_csm_contour(wks1,strf2(0,:,:),res)
plot(3) =gsn_csm_contour(wks1,strf2(3,:,:),res)
plot(6) =gsn_csm_contour(wks1,strf2(6,:,:),res)
;panel plot ;所有图画在一张图上
pres =True
; pres@gsnMaximize =True
pres@gsnPanelLabelBar =True
pres@gsnPanelFigureStrings= (/"JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"/)
pres@amJust = "BottomLeft"
pres@gsnPanelScalePlotIndex = 3
pres@pmLabelBarOrthogonalPosF =0.005
pres@gsnPanelFigureStringsFontHeightF=0.01
pres@gsnPanelXWhiteSpacePercent =0
pres@gsnPanelYWhiteSpacePercent =0
pres@lbLabelBarOn =True
pres@lbOrientation ="Vertical"
pres@pmLabelBarHeightF =0.6
pres@lbLabelStride = 3
pres@gsnPanelLeft = 0.1
pres@gsnPanelRight = 0.95
; pres@txFontHeightF = 0.01
; gsn_text_ndc(wks1,"x10~S~-1",0.97,0.91,pres)
gsn_panel(wks1,plot,(/4,3/),pres)
; drawNDCGrid(wks2)
res@tmXBOn =True
res@lbLabelBarOn =True
; res@txFontHeightF = 0.01
; gsn_text_ndc(wks2,"x10~S~-2",0.76,0.81,res)
plot1 =gsn_csm_contour(wks2,strf1_mean,res)
end
|
-
|