forrest@0: ; *********************************************** forrest@0: ; zonal average plot forrest@0: ; *********************************************** forrest@0: load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" forrest@0: load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" forrest@0: load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" forrest@0: ;************************************************ forrest@0: begin forrest@0: forrest@0: ;************************************************ forrest@0: ; read in observed data forrest@0: ;************************************************ forrest@0: forrest@0: a = addfile ("Npp_T42_mean.nc","r") forrest@0: b = addfile ("i01.03cn_1545-1569_ANN_climo.nc","r") forrest@0: c = addfile ("i01.04casa_1605-1629_ANN_climo.nc","r") forrest@0: forrest@0: ta = a->NPP forrest@0: tb = b->NPP forrest@0: tc = c->NPP forrest@0: forrest@0: lon = a->lon forrest@0: lat = a->lat forrest@0: nlon = dimsizes(lon) forrest@0: nlat = dimsizes(lat) forrest@0: forrest@0: s = new ((/3,nlat/), float) forrest@0: forrest@0: ;************************************************ forrest@0: ; set value to 0. at missing point of observed forrest@0: ;************************************************ forrest@0: delta = 0.00000000001 forrest@0: x0 = tb(0,:,:) forrest@0: ta = where(ismissing(ta).and.(ismissing(x0).or.(x0.lt.delta)),0.,ta) forrest@0: forrest@0: s(0,:) = zonalAve(ta(:,:)) forrest@0: delete (ta) forrest@0: forrest@0: ;************************************************ forrest@0: ; for model data forrest@0: ;************************************************ forrest@0: scale_factor = 86400.*365. forrest@0: forrest@0: s(1,:) = zonalAve(tb(0,:,:)) * scale_factor forrest@0: delete (tb) forrest@0: forrest@0: s(2,:) = zonalAve(tc(0,:,:)) * scale_factor forrest@0: delete (tc) forrest@0: forrest@0: s@long_name = "NPP (gC/m2/year)" forrest@0: forrest@0: ;***************************************************** forrest@0: ; create plot forrest@0: ;***************************************************** forrest@0: wks = gsn_open_wks("png","xy") ; create plot forrest@0: i = NhlNewColor(wks,1.0,0.71,0.76) ; add color to colormap forrest@0: j = NhlNewColor(wks,0.64,0.71,0.8) ; ditto forrest@0: forrest@0: res = True ; plot mods desired forrest@0: res@gsnDraw = False ; don't draw yet forrest@0: res@gsnFrame = False ; don't advance frame yet forrest@0: forrest@0: ; res@vpHeightF = 0.4 ; change aspect ratio of plot forrest@0: ; res@vpWidthF = 0.7 forrest@0: forrest@0: ; res@trXMinF = 1890 ; set x-axis minimum forrest@0: forrest@0: res@xyMonoLineColor = "False" ; want colored lines forrest@0: res@xyLineColors = (/"Red","Blue","Black"/) ; colors chosen forrest@0: ; res@xyLineThicknesses = (/3.,3.,4./) ; line thicknesses forrest@0: res@xyLineThicknesses = (/2.,2.,2./) ; line thicknesses forrest@0: res@xyDashPatterns = (/0.,0.,0./) ; make all lines solid forrest@0: forrest@0: res@tiMainString = "Zoanl Average" forrest@0: res@tiYAxisString = "NPP (gC/m2/year)" ; add a axis title forrest@0: res@txFontHeightF = 0.0195 ; change title font heights forrest@0: forrest@0: plot = gsn_csm_xy (wks,lat,s,res) ; create plot forrest@0: forrest@0: ; plot = fill_xy2(wks,plot(0),time,mnmx(2,:),mnmx(3,:),(/0.64,0.71,0.8/),\ forrest@0: ; (/0.64,0.71,0.8/)) forrest@0: ; plot = fill_xy2(wks,plot(0),time,mnmx(0,:),mnmx(1,:),(/1.0,0.71,0.76/),\ forrest@0: ; (/1.0,0.71,0.76/)) forrest@0: ;***************************************************** forrest@0: ; Manually create legend forrest@0: ;***************************************************** forrest@0: res_text = True ; text mods desired forrest@0: res_text@txFontHeightF = 0.015 ; change text size forrest@0: res_text@txJust = "CenterLeft" ; text justification forrest@0: forrest@0: res_lines = True ; polyline mods desired forrest@0: res_lines@gsLineDashPattern = 0. ; solid line forrest@0: res_lines@gsLineThicknessF = 5. ; line thicker forrest@0: res_lines@gsLineColor = "red" ; line color forrest@0: xx = (/-85.,-75./) forrest@0: yy = (/1400.,1400./) forrest@0: gsn_polyline(wks,plot,xx,yy,res_lines) ; add polyline forrest@0: gsn_text(wks,plot,"Observed",-70.,1400.,res_text); add text forrest@0: forrest@0: yy = (/1500.,1500./) forrest@0: res_lines@gsLineColor = "blue" ; change to blue forrest@0: gsn_polyline(wks,plot,xx,yy,res_lines) ; add polyline forrest@0: gsn_text(wks,plot,"Model i01.03cn",-70.,1500.,res_text) ; add text forrest@0: forrest@0: yy = (/1600.,1600./) forrest@0: res_lines@gsLineColor = "black" ; change to black forrest@0: gsn_polyline(wks,plot,xx,yy,res_lines) ; add poly line forrest@0: gsn_text(wks,plot,"Model i01.04casa",-70.,1600.,res_text) ; add text forrest@0: ;***************************************************** forrest@0: ; Manually create titles forrest@0: ;***************************************************** forrest@0: ; res_text@txJust = "CenterCenter" ; change justification forrest@0: ; res_text@txFontHeightF = 0.03 ; change font size forrest@0: ; gsn_text_ndc(wks,"Parallel Climate Model Ensembles",0.55,0.90,res_text) forrest@0: forrest@0: ; res_text@txFontHeightF = 0.02 ; change font size forrest@0: ; gsn_text_ndc(wks,"Global Temperature Anomalies",0.55,0.86,res_text) forrest@0: forrest@0: ; res_text@txFontHeightF = 0.015 ; change font size forrest@0: ; gsn_text_ndc(wks,"from 1890-1919 average",0.55,0.83,res_text) forrest@0: forrest@0: draw(plot) forrest@0: frame(wks) ; advance frame forrest@0: forrest@0: end