;*********************************************************** ; Generate Sample Variances as in Fig 3 and 4 ;*********************************************************** 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/diagnostics_cam.ncl" begin plev = 850 ; 850hPa ymdStrt = 19790101 ; start yyyymmdd ymdLast = 20011231 ; last yrStrt = ymdStrt/10000 yrLast = ymdLast/10000 pltDir = "./" ; plot directory pltType = "png" ; x11, ps, eps, pdf, png pltName = "mjo" ; whatever diri = "/home/marilia/dados/analises/anomalias/" ; input directory monsea = (/ (/ 1, 2, 3, 10, 11, 12/) \ ; May-Oct [summer] , (/ 4, 5, 6, 7, 8,9/) /) ; Nov-Apr [winter] ;************************************************ ; create BandPass Filter ;************************************************ ihp = 2 ; bpf=>band pass filter nWgt = 201 sigma = 1.0 ; Lanczos sigma fca = 1./100. fcb = 1./20. wgt = filwgts_lanczos (nWgt, ihp, fca, fcb, sigma ) ;*********************************************************** ; Read daily U anomalies ;*********************************************************** fili = "uwnd."+plev+".day.anomalies.1979-2001.nc" f = addfile (diri+fili , "r") TIME = f->time ; days since ... YMD = cd_calendar(TIME, -2) ; entire (time,6) iStrt = ind(YMD.eq.ymdStrt) ; index start iLast = ind(YMD.eq.ymdLast) ; index last delete(TIME) delete(YMD ) x = f->U850_anom(iStrt:iLast,:,:) ; U_anom_sm printVarSummary(x) printMinMax(x, True) time = f->time(iStrt:iLast) ; days since ... ymdhms = cd_calendar(time, 0 ) ; (ntim,2) mm = floattoint( ymdhms(:,1) ) ; just months iWinter = ind( mm.ge.4 .and. mm.le.9) iSummer = ind((mm.ge.1 .and. mm.le. 3) .or. \ (mm.ge.10.and. mm.le.12) ) ;*********************************************************** ; Read daily OLR anomalies: same times as above ;*********************************************************** fili = "olr.day.anomalies.nc" f = addfile (diri+fili , "r") y = f->OLR_anom(iStrt:iLast,:,:) ; OLR_anom_sm printVarSummary(y) printMinMax(y, True) ;************************************************ ; Compute unfiltered seasonal variances (lat,lon) ;************************************************ xVarWinter = dim_variance_Wrap( x(lat|:,lon|:,time|iWinter) ) xVarSummer = dim_variance_Wrap( x(lat|:,lon|:,time|iSummer) ) yVarWinter = dim_variance_Wrap( y(lat|:,lon|:,time|iWinter) ) yVarSummer = dim_variance_Wrap( y(lat|:,lon|:,time|iSummer) ) ;************************************************ ; Apply the band pass filter to the original anomalies (lat,lon,time) ;************************************************ xBPF = wgt_runave_Wrap (x(lat|:, lon|:, time|:), wgt, 0) yBPF = wgt_runave_Wrap (y(lat|:, lon|:, time|:), wgt, 0) ;************************************************ ; Compute filtered seasonal variances (lat,lon) ;************************************************ xVarWinterBPF = dim_variance_Wrap( xBPF(:,:,iWinter) ) xVarSummerBPF = dim_variance_Wrap( xBPF(:,:,iSummer) ) yVarWinterBPF = dim_variance_Wrap( yBPF(:,:,iWinter) ) yVarSummerBPF = dim_variance_Wrap( yBPF(:,:,iSummer) ) ;************************************************ ; Compute (filiered_variance)/(unfiltered_variance) ;************************************************ xRatioVarWinter = (xVarWinterBPF/xVarWinter)*100 xRatioVarSummer = (xVarSummerBPF/xVarSummer)*100 yRatioVarWinter = (yVarWinterBPF/yVarWinter)*100 yRatioVarSummer = (yVarSummerBPF/yVarSummer)*100 copy_VarCoords( xVarWinter, xRatioVarWinter) copy_VarCoords( xVarSummer, xRatioVarSummer) copy_VarCoords( yVarWinter, yRatioVarWinter) copy_VarCoords( yVarSummer, yRatioVarSummer) ;************************************************ ; Plots ;************************************************ if (pltType.eq."png") then pltTypeLocal = "eps" else pltTypeLocal = pltType end if plot = new ( 2, "graphic") ;************************************************ ; resource list for first (color) data array ;************************************************ res1 = True res1@gsnDraw = False ; don't draw res1@gsnFrame = False ; don't advance frame res1@gsnStringFontHeightF = 0.0125 ; make larger than default res1@lbLabelBarOn = False ; turn off individual cb's res1@gsnSpreadColors = True ; use full range of colors res1@mpCenterLonF = 180. ; center plot at 180 res1@cnLevelSelectionMode = "ManualLevels" ; set manual contour levels res1@cnMinLevelValF = 10. res1@cnMaxLevelValF = 50. res1@cnLevelSpacingF = 5. res1@mpMinLonF = 30. ; select a subregion res1@mpMaxLonF = 300. res1@mpMinLatF = -35. res1@mpMaxLatF = 35. ;res1@mpLandFillColor = "background" ; color of land ;res1@cnFillDrawOrder = "Predraw" ;************************************************ "$CMN$ TO $CMX$ BY $CIU$" ; resource list for second (contour only) data array ;************************************************ res2 = True ;res2@cnInfoLabelOn = False ; do not want res2@cnInfoLabelOrthogonalPosF = -0.11 ; move the label inside th plot res2@cnInfoLabelFontHeightF = 0.008 res2@cnInfoLabelString = "$CMN$ TO $CMX$ BY $CIU$" res2@cnLineLabelsOn = True res2@cnLabelMasking = True res2@cnLineLabelFontHeightF = 0.008 ;************************************************ ; resource list for panel ;************************************************ resP = True ; modify the panel plot resP@gsnMaximize = True ; make large resP@gsnPanelLabelBar = True ; add common colorbar resP@lbLabelFontHeightF = 0.0125 ;************************************************ ; resource list for panel ;************************************************ pltPath = pltDir+pltName wks = gsn_open_wks(pltTypeLocal, pltPath+".winter") gsn_define_colormap(wks,"amwg") delete(xVarWinter@long_name) res1@gsnLeftString = x@long_name plot(0) = gsn_csm_contour_map_overlay(wks,xRatioVarWinter,xVarWinter,res1,res2) delete(yVarWinter@long_name) res1@gsnLeftString = y@long_name plot(1) = gsn_csm_contour_map_overlay(wks,yRatioVarWinter,yVarWinter,res1,res2) resP@txString = "Variance: Winter (N-A): "+ yrStrt+"-"+yrLast gsn_panel(wks,plot,(/2,1/),resP) ; now draw as one plot wks = gsn_open_wks(pltTypeLocal, pltPath+".summer") gsn_define_colormap(wks,"amwg") delete(xVarSummer@long_name) res1@gsnLeftString = x@long_name plot(0) = gsn_csm_contour_map_overlay(wks,xRatioVarSummer,xVarSummer,res1,res2) delete(yVarSummer@long_name) res1@gsnLeftString = y@long_name plot(1) = gsn_csm_contour_map_overlay(wks,yRatioVarSummer,yVarSummer,res1,res2) resP@txString = "Variance: Summer (M-O): "+ yrStrt+"-"+yrLast gsn_panel(wks,plot,(/2,1/),resP) ; now draw as one plot if (pltType.eq."png") then if (.not.isvar("pltConvert")) then pltConvert = " " ; default end if system("convert "+pltConvert+" "+pltPath+".winter.eps "+pltPath+".winter.png") system("convert "+pltConvert+" "+pltPath+".summer.eps "+pltPath+".summer.png") system("/bin/rm -f "+pltPath+".*.eps") end if end