;diri = "/project/cas/shea/CDC/" diri = "/Users/shea/Data/CDC/" fili = "olr.day.1x1.ltm.nc" pthi = diri+fili f = addfile(pthi, "r") x = f->olr(0:0,:,:) x@long_name = "Daily OLR" ; short name printVarSummary(x) ; [time | 1] x [lat | 181] x [lon | 360] printMinMax(x,0) print("-------------") dimx = dimsizes(x) nlon = dimx(2) ; Complex Analysis of source grid sc = shaeC( x ) ; spectral coefficients printVarSummary(sc) ; [2] x [1] x [181] x [181] ; [2] -> real and imaginary printMinMax(sc,0) print("-------------") ; https://climatedataguide.ucar.edu/climate-model-evaluation/common-spectral-model-grid-resolutions ; T42 64128 310 5.61 ; T62 94x192 210 1.89 ; T63 96x192 210 1.88 ; T85 128x256 155 1.39 ; T106 160x320 125 1.12 ; Apply triangular truncation; Synthesize at the original resolution T = 42 scT = tri_trunC (sc,T) xT = shsgC (scT,nlon) xT@long_name = "Tri. Trunc: T="+T copy_VarCoords(x, xT) printVarSummary(xT) ; [time | 1] x [lat | 181] x [lon | 360] printMinMax(xT,0) print("-------------") N = 50 R = 2 scE = exp_tapershC (sc, N, R) xE = shsgC (scE,nlon) xE@long_name = "Exp. Taper: N="+N+": R="+R copy_VarCoords(x, xE) printVarSummary(xE) ; [time | 1] x [lat | 181] x [lon | 360] printMinMax(xE,0) print("-------------") ;---Plots nt = 0 wks = gsn_open_wks("x11","olr_spec") ; send graphics to PNG file plot = new(3,graphic) res = True ; plot mods desired res@cnFillOn = False ; turn on color res@cnFillMode = "RasterFill" ;res@cnLinesOn = False ; turn off contour lines ;res@cnLineLabelsOn = False ; turn off contour lines ;res@cnFillPalette = "amwg" ; set color map res@cnInfoLabelOn = False res@lbLabelBarOn = False ; turn off individual label bars res@gsnDraw = False ; don't draw yet res@gsnFrame = False ; don't advance frame yet ;;res@gsnAddCyclic = True ; Trues is default res@cnLevelSelectionMode = "ManualLevels"; manual set levels so lb consistent res@cnMinLevelValF = 190.0 ; min level res@cnMaxLevelValF = 300.0 ; max level res@cnLevelSpacingF = 10.0 ; contour interval ;res@mpLandFillColor = "white" ; make land white res@gsnCenterString = "Source" plot(0) = gsn_csm_contour_map(wks,x(nt,:,:),res) delete(res@gsnCenterString) plot(1) = gsn_csm_contour_map(wks,xT(nt,:,:),res) plot(2) = gsn_csm_contour_map(wks,xE(nt,:,:),res) ;************************************************ ; create panel ;************************************************ resP = True ; modify the panel plot resP@gsnMaximize = True resP@gsnPanelMainString = "OLR" ; set main title gsn_panel(wks,plot,(/3,1/),resP) ; now draw as one plot ;---Differences diffT = xT-x diffE = xE-x diffT@long_name = "(xT-x): T="+T diffT@units = x@units copy_VarCoords(x, diffT) printMinMax(diffT,0) print("-----") diffE@long_name = "(xE-x): N="+N+": R="+R diffE@units = x@units copy_VarCoords(x, diffE) printMinMax(diffE,0) print("-----") res@mpFillOn = False res@cnFillOn = True ;res@cnFillPalette = "BlAqGrWh2YeOrReVi22" res@cnFillPalette = "MPL_seismic" res@cnLinesOn = False ; turn off contour lines res@cnLineLabelsOn = False ; turn off line labels res@cnMinLevelValF = -20.0 ; min level res@cnMaxLevelValF = 20.0 ; max level res@cnLevelSpacingF = 1.0 ; contour interval resP@gsnPanelLabelBar = True plot(0) = gsn_csm_contour_map(wks,diffT(nt,:,:),res) plot(1) = gsn_csm_contour_map(wks,diffE(nt,:,:),res) gsn_panel(wks,plot(0:1),(/2,1/),resP) ; now draw as one plot