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 + "precip_JJAS_mean" ;;;;read in model data ;************************************************************ file1=data_dir +(/"cahpaa.JJAS.mean.baseline.05216.mmday.nc"/) f1 = addfile(file1,"r") varnam=getfilevarnames(f1) t1=f1->$varnam(4)$ delete(varnam) file2=data_dir +(/"cahpba.JJAS.mean.baseline.05216.mmday.nc"/) f2 = addfile(file2,"r") varnam=getfilevarnames(f2) t2=f2->$varnam(4)$ delete(varnam) dims=dimsizes(t1) ;;finds dimensions of array (latxlon) nlat=dims(1) nlon=dims(2) ;;;;read in observation data ;************************************************************ file3=data_dir +(/"aphro.JJAS.mean.baseline.05216.nc"/) f3 = addfile(file3,"r") varnam=getfilevarnames(f3) t3=f3->$varnam(5)$ delete(varnam) dims_obs=dimsizes(t3) ;;finds dimensions of array (latxlon) nlat_obs=dims_obs(1) nlon_obs=dims_obs(2) ;;;;;;;;;;;;;;; setup plot window and colour map ;************************************************************** wks_type = "png" wks_type@wkWidth = 1000 wks_type@wkHeight = 1000 wks = gsn_open_wks(wks_type, plotname) ;rgb =(/"WhiteBLue"/) cols = (/"gold","lightgoldenrod1","lightyellow","lightskyblue1","lightskyblue","deepskyblue","deepskyblue3","dodgerblue4","navyblue"/) rgb = span_named_colors(cols,False) gsn_define_colormap(wks,rgb) ;number of plots in window plot = new(3,graphic) ;;;;;;;;;;;;;;;;;;;;; Set up model plots ;***************************************************************** res = True ; plot mods desired res@cnFillOn = True ; turn on color res@cnLinesOn = False ; no contour lines res@cnFillMode = "CellFill" ;"CellFill" res@cnLevelSelectionMode = "ManualLevels" ; set manual contour levels res@cnMinLevelValF = 0 ; set min contour level res@cnMaxLevelValF = 36 ; set max contour level res@cnLevelSpacingF = 2 ; contour spacing res@gsnSpreadColors = True ; use full color map res@gsnSpreadColorEnd = -3 ; don't use added grey ;res@lbOrientation ="vertical" ; vertical label bar res@lbLabelBarOn = False ; Turns off the individual colour bars res@cnLineLabelsOn = False ; Turns off contour labels res@mpDataBaseVersion = "Ncarg4_1" ; use finer database res@pmTickMarkDisplayMode = "Never" ; turn on tickmarks ; res@gsnAddCyclic = False ; regional data, don't add pt ; Since the Y-Axis of these data goes from north to south, the Y-Axis ; needs to be reversed to plot it correctly in a "native" projection. res@trYReverse = True res@mpCenterLonF = 180.0+289 res@mpCenterLatF = 90.0-75 res@mpOutlineBoundarySets = "National" ;Turn on country outline res@mpLimitMode = "Corners" ; method to zoom res@mpLeftCornerLatF = f1->latitude(dims(1)-1,0) res@mpLeftCornerLonF = f1->longitude(dims(1)-1,0) res@mpRightCornerLatF = f1->latitude(0,dims(2)-1) res@mpRightCornerLonF = f1->longitude(0,dims(2)-1) res@gsnAddCyclic = False ;stops pointless error message res@mpGridAndLimbOn = True res@mpGridLineDashPattern = 2 res@tfDoNDCOverlay = True ; do not transform data res@gsnDraw = False ; don't draw, important res@gsnFrame = False ; don't advance frame, important ;;;;OBSERVATION plot setup ;*************************************************************************** res_obs = True ; plot mods desired res_obs@cnFillOn = True ; turn on color res_obs@cnLinesOn = False ; no contour lines res_obs@cnFillMode = "CellFill" ;many many options available res_obs@cnLevelSelectionMode = "ManualLevels" ; set manual contour levels res_obs@cnMinLevelValF = 0 ; set min contour level res_obs@cnMaxLevelValF = 20 ; set max contour level res_obs@cnLevelSpacingF = 2 ; contour spacing res_obs@gsnSpreadColors = True ; use full color map res_obs@gsnSpreadColorEnd = -3 ; don't use added grey ;res_obs@lbOrientation ="vertical" ; label bar orientation res_obs@lbLabelBarOn = False ; Turns off the individual colour bars res_obs@cnLineLabelsOn = False ; Turns off contour labels res_obs@mpDataBaseVersion = "Ncarg4_1" ; use finer database res_obs@pmTickMarkDisplayMode = "Never" ; turn on tickmarks res_obs@mpGridAndLimbOn = True res_obs@mpGridLineDashPattern = 2 res_obs@mpOutlineBoundarySets = "National" ;Turn on country outlines res_obs@mpLimitMode = "LatLon" ; method to zoom res_obs@mpMinLatF = f3->latitude(0) res_obs@mpMaxLatF = f3->latitude(nlat_obs-1) res_obs@mpMinLonF = f3->longitude(0) res_obs@mpMaxLonF = f3->longitude(nlon_obs-1) res_obs@gsnAddCyclic = False ; stops pointless error message res_obs@tfDoNDCOverlay = True ; do not transform data res_obs@gsnDraw = False ; don't draw, important res_obs@gsnFrame = False ; don't advance frame, important ;;;;;;;Start plotting ;*********************************************************** res@gsnRightString = "" ;left title res@gsnLeftString = "Q0" ;right title plot(0) = gsn_csm_contour_map_ce(wks,t1(0,:,:),res) res@gsnLeftString = "ECHAM5" ;right title plot(1) = gsn_csm_contour_map_ce(wks,t2(0,:,:),res) res_obs@gsnLeftString = "APHRO" ;right title plot(2) = gsn_csm_contour_map_ce(wks,t3(0,:,:),res_obs) ;;;;;;;;;;;; create panel ;************************************************ resP = True ; modify the panel plot resP@gsnMaximize = True ; must include w/ Paper Orientation resP@gsnPaperOrientation = "portrait" ;change to auto to maximise plot size resP@txString = "JJAS mean precipitation mm/day (1961-1990)" resP@gsnPanelLabelBar = True ; add common colorbar resP@lbLabelFontHeightF = 0.007 ; make labels smaller gsn_panel(wks,plot,(/2,2/),resP) ; now draw as one 2x3 plot end