load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" begin ;;;;;;;;;;;;;;;;;;;;; ;directory containing data data_dir=(/"$HOME/climatology/"/) ;name and location of plot plot_location="$HOME/climatology/" ;;;;;;;;;;;;;;;;;;;;; plotname=plot_location + "temp_ccscenaio" ;;;;read in model data temperature ;************************************************************ file4=data_dir + (/"cahpa.03236.ccscenario.nc"/) f4 = addfile(file4,"r") varnam=getfilevarnames(f4) t4=f4->$varnam(4)$ delete(varnam) q0=new((/360/),float) do i=0,359 q0(i)=avg(t4(i,:,:)) end do file5=data_dir + (/"cahpb.03236.ccscenario.nc"/) f5 = addfile(file5,"r") varnam=getfilevarnames(f5) t5=f5->$varnam(4)$ delete(varnam) echam5=new((/360/),float) do i=0,359 echam5(i)=avg(t5(i,:,:)) end do ;;;put data into a single array for plotting ;******************************************************* data_a=(/q0,echam5/) x= ispan(0,360,1) ;setup x axis ;;;;;;;;;;;;;;; setup plot window and colour map ;****************************************************************** wks_type = "png" wks_type@wkWidth = 900 wks_type@wkHeight = 800 wks = gsn_open_wks(wks_type, plotname) gsn_define_colormap(wks,"BlAqGrYeOrReVi200") plot = new(1,graphic) ;;;;;;;;;;;;begin plot modifications ;********************************************************* res = True res@vpHeightF = 0.6 ; set plot width res@vpWidthF = 1.0 ; set plot height res@gsnMaximize = True ; maximise plot size, useful res@xyLineColors = (/2,60/) ; Define line colors. res@xyLineThicknesses = (/1.1,1.1/) ; Define line thicknesses 1 is default res@xyMonoDashPattern = True ; needs to be set for dashpatterns to work ;res@xyLineDashPattern = 0 ; set line dash pattern 0 is solid res@tiMainString = "temp scenario" ; Title for the XY plot res@tiXAxisString = "years" ; Label for the X axis res@tiYAxisString = "deg C" ; Label for the Y axis res@tiMainFont = "Helvetica" ; Font for title res@tiXAxisFont = "Helvetica" ; Font for X axis label res@tiYAxisFont = "Helvetica" ; Font for Y axis label res@pmLegendDisplayMode = "Always" ;turn on legend display res@pmLegendWidthF = 0.3 ; Change width and res@pmLegendHeightF = 0.37 ; height of legend res@lgItemOrder =(/1,0/) ; order of legend res@xyExplicitLegendLabels = (/"Q0","ECHAM5"/) ;labels for legend res@pmLegendSide = "Right" ; Change location of legend res@lgPerimOn = False ; turn off perimeter res@tmXBMode = "Explicit" ; explicit labels res@tmXBValues = (/47,107,167,227,287,347/) ; location of labels res@tmXBLabels = (/2025,2030,2035,2040,2045,2050/) ; labels themselves res@tmLabelAutoStride = True ;res@gsnDraw = False ; don't draw, important ;res@gsnFrame = False ; don't advance frame, important res@tmXTOn = False ; turns off top X tickmarks ;;;;;;;Start plotting ;*********************************************************** plot = gsn_xy(wks,x,data_a,res) end