- 积分
- 256
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2014-4-30
- 最后登录
- 1970-1-1
|

楼主 |
发表于 2015-1-13 09:34:39
|
显示全部楼层
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"
begin
;************************************************
; Specify geographical region and time span (year-month start and end
;************************************************
latS = -90
latN = 90
lonL = 0
lonR = 360
ymStrt = 194801
ymLast = 201012
;************************************************
; Read from netCDF file: variable is type short...unpack
;************************************************
diri = "E:/data/"
fili = "sst.mnmean.nc"
f = addfile(diri+fili,"r")
YYYYMM = cd_calendar( f->time, -1)
iStrt = ind(YYYYMM.eq.ymStrt)
iLast = ind(YYYYMM.eq.ymLast)
x = short2flt( f->sst(iStrt:iLast,{latS:latN},{lonL:lonR}) )
printVarSummary(x) ; [time| 720]x[lat| 91]x[lon| 180]
yyyymm = cd_calendar(x&time, -1) ;转换时间格式
yyyy = yyyymm/100 ;年份
dimx = dimsizes(x) ;给各变量分配维数大小
ntim = dimx(0)
nlat = dimx(1)
mlon = dimx(2)
year = ispan(yyyy(0), yyyy(ntim-1), 1) ;创建整型数组 (1948,。。。。2010)
nyrs = dimsizes(year) ;年数 63年
;************************************************
xann=clmMonTLL(x)
xano=calcMonAnomTLL(x,xann)
season="DJF"
xdjf = month_to_season(xano ,season) ; 月平均资料转换为年平均资料
printVarSummary(xdjf)
;************************************************
xep=(/xdjf(3,:,:),xdjf(10,:,:),xdjf(18,:,:),xdjf(25,:,:),xdjf(29,:,:),xdjf(50,:,:),xdjf(61,:,:)/)
xepsat=dim_avg_n_Wrap(xep,0)
xcp=(/xdjf(21,:,:),xdjf(30,:,:),xdjf(39,:,:),xdjf(47,:,:),xdjf(55,:,:),xdjf(62,:,:)/)
xcpsat=dim_avg_n_Wrap(xcp,0)
copy_VarMeta(xdjf(0,:,:),xepsat)
copy_VarMeta(xdjf(0,:,:),xcpsat)
;************************************************
;ttest
;************************************************
siglvl=0.05
xepave=xepsat
xcpave=xcpsat
yave=dim_avg_n(xdjf,0)
xepvar=dim_variance_n(xep,0)
xcpvar=dim_variance_n(xcp,0)
yvar=dim_variance_n(xdjf,0)
sxep=dim_num_n((.not.ismissing(xep),0)
sxcp=dim_num_n((.not.ismissing(xcp),0)
sy=dim_num_n((.not.ismissing(xdjf),0)
iflag= False ; population variance similar
probep = ttest(xepave,xepvar,sxep, yave,yvar,sy,iflag, False)
probcp = ttest(xcpave,xcpvar,sxcp, yave,yvar,sy,iflag, False)
copy_VarMeta(xepsat,probep)
copy_VarMeta(xcpsat,probcp)
printVarSummary(probep)
;************************************************
; plotting parameters
;************************************************
wks = gsn_open_wks("png","E:/ENSO/ELsat") ; specifies a ps plot
colors=read_colormap_file("BlWhRe")
printVarSummary(colors)
res = True
res@gsnDraw=False
res@gsnFrame=False
res@gsnMaximize = True ; make large
res@cnFillPalette =colors(20:75,:)
res@cnFillOn = True ; turn on color
res@cnLinesOn = False ; turn off contour lines
res@cnLineLabelsOn = False ; turn off contour line labels
;res@cnFillMode = "RasterFill"
res@cnLevelSelectionMode = "ManualLevels" ; set manual contour levels
res@cnMinLevelValF = -2.4 ; set min contour level
res@cnMaxLevelValF = 2 ; set max contour level
res@cnLevelSpacingF = 0.2 ; set contour interval
res@mpFillOn = False ; turn off default background gray
res@mpCenterLonF = 180
; res@gsnCenterString = year(0)+"-"+year(nyrs-1)
res@gsnLeftString ="EP"
; res@tiMainString = "" ; fili
res@lbLabelBarOn=False
; res@cnLineColors=True
; res@cnLinePalette="BlWhRe"
;*********************************************
res2 = True
res2@gsnDraw = False ; do not draw
res2@gsnFrame = False ; do not advance frame
res2@gsnMaximize = True ; make large
; res2@cnFillPalette =colors(22:72,:)
; res2@cnFillOn = True ; turn on color
; res2@cnLinesOn = False ; turn off contour lines
; res2@cnLineLabelsOn = False ; turn off contour line labels
res2@cnLevelSelectionMode = "ManualLevels" ; set manual contour levels
res2@cnMinLevelValF = -1.4 ; set min contour level
res2@cnMaxLevelValF = 0.6 ; set max contour level
res2@cnLevelSpacingF = 0.1 ; set contour interval
res2@lbLabelBarOn=False
res2@cnInfoLabelString=""
res2@gsnRightString =""
res2@gsnLeftString =""
plot1 = gsn_csm_contour_map_ce(wks,xepsat,res)
plot3 = gsn_csm_contour(wks,probep,res2)
overlay(plot1,plot3)
res@gsnLeftString ="CP"
plot2 = gsn_csm_contour_map_ce(wks,xcpsat,res)
plot4 = gsn_csm_contour(wks,probcp,res2)
overlay(plot2,plot4)
pres=True
pres@gsnPanelLabelBar=True
pres@pmLabelBarWidthF=0.8
pres@lbBoxLinesOn=False
gsn_panel(wks,(/plot1,plot2/),(/2,1/),pres)
end
|
|