- 积分
- 15
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2018-5-16
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
; 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"
begin
; ==============================================================
; User defined parameters that specify region of globe and
; ==============================================================
latS = 20.
latN = 20.
lonL = 70.
lonR = 0.
season = "DJF" ;
neof = 3 ;
optEOF = True
optEOF@jopt = 0 ;
;;optEOF@jopt = 1 ;
optETS = False
; ==============================================================
; Open the file: Read only the user specified period
; ==============================================================
f=addfile("lgm_c_sp.psl.nc","r")
Sea_level_pressure = f->PSL
printVarSummary(Sea_level_pressure) ;
; ==============================================================
; dataset longitudes span 0=>357.5
; Because EOFs of the North Atlantic Oscillation are desired
; use the "lonFlip" (contributed.ncl) to reorder
; longitudes to span -180 to 177.5: facilitate coordinate subscripting
; ==============================================================
slp = lonFlip( Sea_level_pressure )
printVarSummary(slp) ;
; ==============================================================
; compute desired global seasonal mean: month_to_season (contributed.ncl)
; ==============================================================
SLP = month_to_season (slp, season)
nyrs = dimsizes(SLP)
printVarSummary(SLP)
; =================================================================
; create weights: sqrt(cos(lat)) [or sqrt(gw) ]
; =================================================================
rad = 4.*atan(1.)/180.
clat = f->lat
clat = sqrt( cos(rad*clat) ) ;
; =================================================================
; gw for gaussian grid
; =================================================================
wSLP = SLP ;
wSLP = SLP*conform(SLP, clat, 1)
wSLP@long_name = "Wgt: "+wSLP@long_name
; =================================================================
; Reorder (lat,lon,time) the *weighted* input data
; Access the area of interest via coordinate subscripting
; =================================================================
xw = wSLP({lat|latS:latN},{lon|lonL:lonR})
eof = eofunc_Wrap(xw, neof, optEOF)
eof_ = eofunc_ts_Wrap (xw, eof, optETS)
printVarSummary( eof ) ;
printVarSummary( eof_ts )
; =================================================================
; Normalize time series: Sum spatial weights over the area of used
; =================================================================
dimxw = dimsizes( xw )
mln = dimxw(1)
sumWgt = mln*sum( clat({lat|latS:latN}) )
eof_ts = eof_ts/sumWgt
; =================================================================
; Extract the YYYYMM from the time coordinate
; associated with eof_ts [same as SLP&time]
; =================================================================
; PLOTS
;============================================================
wks = gsn_open_wks("png","eof") ;
plot = new(neof,graphic) ;
;
; EOF patterns
res = True
res@gsnDraw = False ;
res@gsnFrame = False ;
res@gsnAddCyclic = False ;
res@mpFillOn = False ;
res@mpMinLatF = latS ;
res@mpMaxLatF = latN
res@mpMinLonF = lonL
res@mpMaxLonF = lonR
res@cnFillOn = True ; l
res@cnLinesOn = False ;
;res@cnLineLabelsOn = False ;
res@cnFillPalette = "BlWhRe" ;
res@lbLabelBarOn = False ;
;
symMinMaxPlt(eof, 16, False, res) ;
;
resP = True ; modify the panel plot
resP@gsnMaximize = True ; large format
resP@gsnPanelLabelBar = True ; add common colorbar
resP@gsnPanelMainString = "SLP: "+"season+"
;*******************************************
; first plot
;*******************************************
do n=0,neof-1
res@gsnLeftString = "EOF "+(n+1)
res@gsnRightString = sprintf("%5.1f", eof@pcvar(n)) +"%"
plot(n)=gsn_csm_contour_map(wks,eof(n,:,:),res)
end do
gsn_panel(wks,plot,(/neof,1/),resP) ;
;*******************************************
; second plot
;*******************************************
; EOF time series [bar form]
rts = True
rts@gsnDraw = False ;
rts@gsnFrame = False ;
rts@gsnScale = True ;
;
;
rts@vpHeightF = 0.40 ;
rts@vpWidthF = 0.85
rts@vpXF = 0.10 ;
rts@vpYF = 0.75 ;
rts@tiYAxisString = "Pa" ;
rts@gsnYRefLine = 0. ;
rts@gsnXYBarChart = True ;
rts@gsnAboveYRefLineColor = "red" ;
rts@gsnBelowYRefLineColor = "blue" ;
; panel plot only resources
rtsP = True ;
rtsP@gsnMaximize = True ;
rtsP@gsnPanelMainString = "SLP: "+"season+"
; create individual plots
do n=0,neof-1
rts@gsnLeftString = "EOF "+(n+1)
rts@gsnRightString = sprintf("%5.1f", eof@pcvar(n)) +"%"
plot(n) = gsn_csm_xy (wks,year,eof_ts(n,:),rts)
end do
gsn_panel(wks,plot,(/neof,1/),rtsP) ;
end
错误是这个
fatal:["NclVar.c":1390]:Assignment type mismatch, right hand side can't be coerced to type of left hand side
fatal:["Execute.c":8576]:Execute: Error occurred at or near line 56
|
|