- 积分
- 20225
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2014-4-24
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
如图,我现在出的图填色是用student_t对回归检验的P值,不知道为什么会在陆地上有值,与原图差别较大?
其次想知道如何对t检验,负值填色冷色,正值填色暖色,我用的student_t 计算的值都是正值
代码如下(eof_ts的图并没有画出来)
希望得到解答,在这谢谢各位啦!!
- 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"
- ; ==============================================================
- ; User defined parameters that specify region of globe and
- ; ==============================================================
- begin
- latS = -20.
- latN = 20.
- yrStrt = 1979
- yrLast = 1996
- var = "sst"
- title = "Regr.on SST's PC1"
- ymStrt = yrStrt*100 + 1
- ymLast = yrLast*100 + 12
- neof = 1 ; Leading EOF only
- optEOF = True
- optEOF@jopt = 1
- optETS = False
- ; ==============================================================
- ; Open the file: Read only the user specified period and level
- ; ==============================================================
- f = addfile ("/disk3/HadISST/HadISST_sst.nc","r")
- TIME = f->time
- YYYY = cd_calendar(TIME,-1)/100 ; entire file
- iYYYY = ind(YYYY.ge.yrStrt .and. YYYY.le.yrLast)
- x = short2flt( f->sst(iYYYY,{latS:latN},:))
- y = short2flt(f->sst(iYYYY,:,:))
- printVarSummary(x) ; (time, lat,lon)
- ; ==============================================================
- ; compute climatology and Anomalies
- ; ==============================================================
-
- xAnom=month_to_season(x, "DJF")
- yAnom=month_to_season(y, "DJF")
- ;xAnom=xAnom1/100.
- ;copy_VarMeta(xAnom1, xAnom)
- printVarSummary(xAnom)
- printMinMax(xAnom, True)
- ; =================================================================
- ; create weights: sqrt(cos(lat)) [or sqrt(gw) ]
- ; =================================================================
- rad = get_r2d("float")
- clat = xAnom&latitude
- clat = sqrt( cos(rad*clat) ) ; gw for gaussian grid
- printVarSummary(clat)
- ; =================================================================
- ; weight all observations
- ; =================================================================
- xw = xAnom*conform(xAnom, clat, 1)
- copy_VarMeta(xAnom, xw)
- xw@long_name = "Wgt: "+x@long_name
- ; =================================================================
- ; Reorder (lat,lon,time) the *weighted* input data
- ; Compute EOFs & Standardize time series
- ; =================================================================
- eof = eofunc_n_Wrap(xw, neof, optEOF, 0)
- eof = -1*eof ; *special* match sign of CPC
- eof_ts = eofunc_ts_n_Wrap (xw, eof, optETS, 0)
-
- eof2 = eofunc_n_Wrap(yAnom, neof, optEOF, 0)
- eof2 = -1*eof2
- printVarSummary( eof ) ; examine EOF variables
- printVarSummary( eof_ts )
- eof_ts = dim_standardize_n( eof_ts, 0, 1) ; normalize
- printMinMax(eof_ts, False)
- ; =================================================================
- ; Regress
- ; =================================================================
- yw2=yAnom(latitude|:,longitude|:,time|:)
- tval =new((/180,360/),"float")
- nxy =new((/180,360/),"integer")
- lon = lonGlobeF(360, "lon", "lon", "degrees_east")
- tval!1= "lon"
- tval&lon = lon
- lat = latGlobeF(180, "lat", "lat", "degrees_north")
- tval!0= "lat"
- tval&lat = lat
- lon = lonGlobeF(360, "lon", "lon", "degrees_east")
- nxy!1= "lon"
- nxy&lon = lon
- lat = latGlobeF(180, "lat", "lat", "degrees_north")
- nxy!0= "lat"
- nxy&lat = lat
- eof_regres = eof2 ; create an array w meta data
- do ne=0,neof-1
- eof_regres(ne,:,:) = (/ regcoef(eof_ts(ne,:), yw2, tval,nxy) /)/100.
- end do
- df=16
- tval=student_t(tval, df)
- printVarSummary(tval)
- printMinMax(tval, False)
- printMinMax(eof_regres, False)
- ; =================================================================
- ; Extract the YYYYMM from the time coordinate
- ; associated with eof_ts [same as x&time]
- ; =================================================================
- yyyymm = cd_calendar(eof_ts&time,-1)
- yrfrac = yyyymm_to_yyyyfrac(yyyymm, 0.0); not used here
- ;============================================================
- ; PLOTS
- ;============================================================
- wks = gsn_open_wks("png","/disk1/dzz/study/ncl/TT/ssteof") ; send graphics to PNG file
- gsn_define_colormap(wks,"amwg256")
- plot = new(neof,graphic) ; create graphic array
- plot2= new(neof,graphic) ; only needed if paneling
- ; EOF patterns
- res = True
- res@gsnDraw = False ; don't draw yet
- res@gsnFrame = False ; don't advance frame yet
-
- res@mpFillOn = False ; turn off map fill
- res@mpOutlineOn = True
- res@mpMaxLatF = 60
- res@mpMinLatF = -60
- res@mpMaxLonF = 360
- res@mpMinLonF = 0
- res@mpCenterLonF = 180
- res@cnFillOn = False ; turn on color fill
- res@cnLinesOn = True
- res@gsnContourNegLineDashPattern = 1
- res@lbLabelBarOn = True ; turn off individual lb's
- res@cnInfoLabelOn = False
- res@lbTitleOn = False
- res@cnLevelSelectionMode = "ManualLevels"
- res@cnLevelSpacingF = 0.3
- ;res@cnFillPalette = "amwg256"
- res@cnLineDrawOrder ="PostDraw"
- res@cnRasterSmoothingOn = True ; set symmetric plot min/max
- ;symMinMaxPlt(eof_regres, 0.3, False, res) ; contributed.ncl
- ; res@cnLevelSpacingF = 0.3 ; *special* match CPC
- res2 = True
- res2@gsnDraw = False
- res2@gsnFrame = False
- res2@cnFillOn = True ; turn on color fill
- res2@cnLinesOn = False ; True is default
- res2@cnLineLabelsOn = False ; True is default
- res2@lbLabelBarOn = False ; turn off individual lb's
- res2@cnLevelSelectionMode = "ExplicitLevels"
- res2@cnLevels = (/0.05,0.01/)
- res2@cnFillColors = (/225,177,0/)
- res2@cnInfoLabelOn = False
- res2@lbTitleOn = False
- res2@cnSmoothingOn = True
- ; panel plot only resources
- resP = True ; modify the panel plot
- resP@gsnMaximize = True ; large format
- resP@gsnPanelLabelBar = True ; add common colorbar
- ;resP@gsnPaperOrientation = "portrait" ; force portrait
- resP@txString = title
- ;*******************************************
- ; first plot
- ;*******************************************
- do n=0,neof-1
- res@gsnLeftString = "(c)1979-1996"
- res@gsnRightString = ""
- plot(n)=gsn_csm_contour_map(wks,eof_regres(n,:,:),res)
- plot2(n)=gsn_csm_contour (wks,tval,res2)
- overlay(plot, plot2)
- draw(plot)
- frame(wks)
- end do
- gsn_panel(wks,plot,(/neof,1/),resP) ; now draw as one plot
- end
复制代码
|
-
Regression of the winter mean SST onto the simultaneous normalized PC1 of the tropical SST
-
原文献的图
|