;************************************************ 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 ;************************************************ ihp = 0 ;0->low pass,1->high pass,2->band pass sigma = 1.0 nWgt = 20*12+1 fcb = 1/(8.*12) fca = 1/(20*12.) wgt = filwgts_lanczos(nWgt, ihp, fcb, -999., sigma) opt = 1 ;------- latS = -15 latN = 15 lonW = 0 lonE = 360 ;---------- ORA S3,1959-2009 fil = "/enso/data2/jian/hadslp2r.mnmean.185001-201305.nc" f = addfile(fil,"r") slp = short2flt(f->slp(1308:1919,{latS:latN},{lonW:lonE})) ;1080:1955->194001-201212 slp&time = yyyymm_to_yyyyfrac(cd_calendar(slp&time,1),0.0) print(""+slp&time(0)) slp = rmMonAnnCycTLL(slp) ; u = dtrend_msg_n(ispan(0,dimsizes(u&TIME)-1,1), u, False, False, 0) slp = wgt_runave_n_Wrap(slp, wgt, opt, 0) slpgrd = -center_finite_diff_n(slp,1.,False,0,2) copy_VarMeta(slp,slpgrd) slpxt = dim_avg_n_Wrap(slpgrd,1) ; delete([/slp,slpgrd/]) ;------- path = "/enso/data2/jian/ORA-S3/" fil = "TAUX.195901-200912.nc" f = addfile(path+fil,"r") u = f->TAUX(:,{latS:latN},1:) u = lonFlip(u) u&TIME = yyyymm_to_yyyyfrac(cd_calendar(u&TIME,1),0.0) print(""+u&TIME(0)) ; u = rmMonAnnCycTLL(u) ; u = dtrend_msg_n(ispan(0,dimsizes(u&TIME)-1,1), u, False, False, 0) u = wgt_runave_n_Wrap(u, wgt, opt, 0) ; ugrd = center_finite_diff_n(u,1.,False,0,2) ; copy_VarMeta(u,ugrd) uxt = dim_avg_n_Wrap(u(:,{latS:latN},{lonW:lonE}),1) delete([/u/]) ;------- fils = systemfunc("ls "+"/enso/data2/jian/MERRA/TAUXY/*tavgM_2d_ocn_Nx*.nc") fs = addfiles(fils(:371),"r") u = fs[:]->tauxwtr(:,{latS:latN},:) u = lonFlip(u) u&time = slp&time(240:);240 print(""+u&time(0)) ; u = rmMonAnnCycTLL(u) ; u = dtrend_msg_n(ispan(0,dimsizes(u&TIME)-1,1), u, False, False, 0) u = wgt_runave_n_Wrap(u, wgt, opt, 0) ; ugrd = center_finite_diff_n(u,1.,False,0,2) ; copy_VarMeta(u,ugrd) uxtmerra = dim_avg_n_Wrap(u(:,{latS:latN},{lonW:lonE}),1) delete([/u/]) ; rho=0.001175*1.e3 ;kg/m3 cd=0.0015 uxt = uxt/(rho*cd) ; /mon->/yr, pseudo stress uxtmerra = uxtmerra/(rho*cd) ;*********** plnm = "../ObsFig/SLPhad_grad.TAUX_oras3_MERRA_time.lon40-290_8yrlp" wks = gsn_open_wks("ps",plnm) ;drawNDCGrid(wks) gsn_define_colormap(wks,"ncl_default") ; gsn_reverse_colormap(wks) ; res = True res@gsnDraw = False ;Don't draw graphics and frame, res@gsnFrame = False ;in order to draw sevral subpots in on page res@gsnSpreadColors = True ;use the whole color map res@gsnAddCyclic = False res@cnFillOn = True res@cnLinesOn = False ;don't draw contour line res@cnLineLabelsOn = False res@cnLevelSelectionMode = "ExplicitLevels" res@cnLevels = fspan(-0.2,0.2,11) res@cnInfoLabelOn = False res@tmXBLabelFontHeightF = 0.015 ; resize tick labels res@tmYLLabelFontHeightF = 0.015 res@tmYLLabelAngleF = 90 ; tilt the XB labels 45 degrees res@tmYLLabelJust = "CenterCenter" res@tiYAxisString = "" res@tiXAxisString = "" res@trYReverse = True ; reverse Y-axis ; res@lbOrientation = "vertical" ; res@pmLabelBarOrthogonalPosF = -0.08 res@pmLabelBarHeightF = 0.12 res@gsnRightString = "15S-15N" res@gsnLeftStringFontHeightF = 0.015 res@gsnRightStringFontHeightF = 0.015 ;------------ vecres = True ; vector only resources vecres@gsnDraw = False ; don't draw vecres@gsnFrame = False ; don't advance frame vecres@gsnAddCyclic = False ;the data does not cover the whole globe ; vecres@vcGlyphStyle = "CurlyVector" ; curly vectors vecres@vcRefMagnitudeF =4 ; define vector ref mag vecres@vcRefLengthF = 0.035 ; define length of vec ref vecres@gsnRightString = " " ; turn off right string vecres@gsnLeftString = " " ; turn off left string vecres@tiXAxisString = " " ; turn off axis label vecres@vcRefAnnoOrthogonalPosF = -0.3 ; move ref vector into plot vecres@vcRefAnnoString2On = "False" vecres@vcMinDistanceF = 0.02 ;---------- plot = new(2,graphic) ; res@vpXF = 0.05 res@vpYF = 0.9 res@vpWidthF = 0.43 res@vpHeightF = 0.7 res@tmYLMode = "Explicit" res@tmYLValues = ispan(1960,2000,10) res@tmYLLabels = ispan(1960,2000,10) res@gsnLeftString = "a) SLP gradient & ORA-S3 TAUX" res@lbLabelBarOn = False ; turn off individual bar plot(0) = gsn_csm_hov(wks,slpxt,res) ; vecres@vcRefAnnoOrthogonalPosF = -0.06 ; move ref vector into plot tplot1 = gsn_csm_vector(wks,uxt,uxt/1000,vecres) overlay(plot(0),tplot1) ; res@vpXF = 0.54 res@vpYF = 0.9-0.7*(612-372)/612. res@vpWidthF = 0.43 res@vpHeightF = 0.7*372/612. res@gsnLeftString = "b) SLP gradient & MERRA TAUX" res@lbLabelBarOn = True ; turn off individual bar res@pmLabelBarParallelPosF = -0.02 plot(1) = gsn_csm_hov(wks,slpxt({1979:},:),res) ; vecres@vcRefAnnoOrthogonalPosF = -0.35 ; move ref vector into plot tplot2 = gsn_csm_vector(wks,uxtmerra,uxtmerra/1000,vecres) overlay(plot(1),tplot2) getvalues tplot1 ; "vpWidthF" : vpw ; "vpHeightF": vph ; "pmLabelBarOrthogonalPosF" : bf "vcRefLengthF" : vcf end getvalues print(""+vcf) ;print("w "+vpw) ;print("h "+vph) draw(plot) maximize_output(wks,True) ;-------------- resP = True ; resP@txString = "IP pattern(1948-2010)" ; resP@txPosYF = 0.8 ; resP@gsnPanelDebug = True ; resP@gsnPanelYF = (/0.75,0.75,0.47,0.47/) ; resP@gsnPanelLabelBar = True resP@gsnMaximize = True ; maximize plots ; resP@lbLabelAutoStride = True ; automatically adjust the numbers in colorbar ; resP@gsnPaperOrientation = "portrait" ; resP@gsnPanelRowSpec = True resP@gsnPanelCenter = False resP@gsnPanelFigureStrings= (/"a)","b)","c)"/) ; add strings to panel resP@gsnPanelFigureStringsFontHeightF = 0.013 resP@amJust = "TopLeft" ; gsn_panel(wks,plot,(/1,2/),resP) destroy(wks) system("convert -geometry 1000x1000 -density 300 -trim "+plnm+".ps "+plnm+".png") end