Modifications to scoring and graphics production for the final version of code for the C-LAMP paper in GCB.
1 ;*******************************************************************
2 ; procedure to draw the Taylor Diagram Metrics Table
9 ; mfname : name of the output table
10 ; varNames : variable names [metrics]
11 ; cases : case (model) names
12 ; seasons : season names
13 ; values : array containing the values to be plotted
14 ; opt : used to pass optional arguments
16 procedure taylor_metrics_table(mfname[1]:string \ ; plot name
17 ,varNames[*]:string \ ; variables
20 ,values[*][*][*]:numeric \
25 ;;; Output of metrics to a table [grid]
28 if (.not.isatt(opt,"pltType") .or. \
29 (opt@pltType.eq."eps" .or. opt@pltType.eq."png" .or. opt@pltType.eq."gif")) then
30 wks = gsn_open_wks("eps",mfname) ; default
32 wks = gsn_open_wks(opt@pltType,mfname)
35 xbox0 = (/0.0,1.0,1.0,0.0,0.0/) ; Box template.
36 ybox0 = (/0.0,0.0,1.0,1.0,0.0/)
38 nvar = dimsizes(varNames)
39 ncases = dimsizes(cases)
40 nseas = dimsizes(seasons)
42 dimt = dimsizes(values) ; table dimensions
44 if (ncases.ne.dimt(0)) then
45 print("taylor_metrics_table fatal error: Number of case names ("+ncases+ \
46 ") does not match the number of cases passed in ("+dimt(0)+")")
49 if (nseas.ne.dimt(1)) then
50 print("taylor_metrics_table fatal error: Number of season names ("+nseas+ \
51 ") does not match the number of seasons passed in ("+dimt(1)+")")
54 if (dimsizes(varNames).ne.dimt(2)) then
55 print("taylor_metrics_table fatal error: Number of metric variables names ("+dimsizes(varNames)+ \
56 ") does not match the number of metric variables passed in ("+dimt(2)+")")
60 ncolm1 = dimt(0)*dimt(1)
61 if (ncolm1.le.12) then
65 if (ncolm1.ge.7.and.ncolm1.le.12) then
73 if (ncolm1.le.20) then
87 if (ncolm1.gt.26.or.dimt(2).gt.63) then
88 print("Warning: Recommended maximium size of array passed into taylor_metrics_table is "+ \
89 "26 columns (#cases * #seasons) by 63 rows (#variables), continuing")
95 mv_theight = mn_theight
98 tt_pRes@gsFillColor = "CornflowerBlue" ; background color for + values
101 tt_tRes@txFontHeightF = tt_theight
104 mn_pRes@gsFillColor = "Gray70" ; background color for variable names
107 mn_tRes@txFontHeightF = mn_theight
110 mv_pRes@gsFillColor = "White" ; background color for reference values
113 mv_tRes@txFontHeightF = mn_theight
117 xbox = tt_width*xbox0
118 ybox = 1.-tt_height*ybox0
120 ixtbox = xbox(0)+0.5*(xbox(1)-xbox(0))
121 iytbox = ybox(0)+0.5*(ybox(2)-ybox(0))
123 gsn_polygon_ndc(wks,xbox,ybox,tt_pRes)
124 if (isatt(opt,"tableTitle") ) then
125 gsn_text_ndc(wks, opt@tableTitle ,ixtbox,iytbox, tt_tRes)
127 gsn_text_ndc(wks,"CAM METRICS",ixtbox,iytbox, tt_tRes)
129 gsn_polyline_ndc(wks,xbox,ybox,False)
132 ybox = min(ybox)-(ybox0*mn_height)
133 ixtbox = xbox(0)+0.5*(xbox(1)-xbox(0))
134 iytbox = ybox(0)+0.5*(ybox(2)-ybox(0))
136 gsn_polygon_ndc(wks,xbox,ybox,mn_pRes)
137 gsn_polyline_ndc(wks,xbox,ybox,False)
138 gsn_text_ndc(wks,varNames(im),ixtbox,iytbox, mn_tRes)
141 do icase = 0, ncases-1
142 ybox = 1.-0.5*tt_height*ybox0
143 xbox = ((1.-tt_width)/ncases)*(xbox0+icase)+tt_width
145 ixtbox = xbox(0)+0.5*(xbox(1)-xbox(0))
146 iytbox = ybox(0)+0.5*(ybox(2)-ybox(0))
147 gsn_polygon_ndc(wks,xbox,ybox,mn_pRes)
148 gsn_polyline_ndc(wks,xbox,ybox,False)
149 gsn_text_ndc(wks,cases(icase),ixtbox,iytbox, mn_tRes)
151 do iseas = 0, nseas-1
152 ybox = 1.-0.5*tt_height-0.5*tt_height*ybox0
153 xbox = xboxi + ((1.-tt_width)/(ncases*nseas))*(xbox0+iseas)
154 ixtbox = xbox(0)+0.5*(xbox(1)-xbox(0))
155 iytbox = ybox(0)+0.5*(ybox(2)-ybox(0))
156 gsn_polygon_ndc(wks,xbox,ybox,mn_pRes)
157 gsn_polyline_ndc(wks,xbox,ybox,False)
158 gsn_text_ndc(wks,seasons(iseas),ixtbox,iytbox, mn_tRes)
162 ybox = 1.-tt_height-mv_height*ybox0
164 ybox = ybox - mv_height
166 iytbox = ybox(0)+0.5*(ybox(2)-ybox(0))
167 mv_pRes@gsFillColor = "White"
168 if (icase .gt. 0) then
169 if (ismissing(values(icase,iseas,im)) .or. \ ; ???
170 ismissing(values(icase,iseas,im)))then
171 ; print ("Missing values skipped")
173 if (values(icase,iseas,im).le.values(0,iseas,im)) then
174 if (isatt(opt,"color0")) then
175 mv_pRes@gsFillColor = opt@color0
177 mv_pRes@gsFillColor = "DarkOliveGreen3"
180 if (isatt(opt,"color1")) then
181 mv_pRes@gsFillColor = opt@color1
183 mv_pRes@gsFillColor = "IndianRed1"
188 gsn_polygon_ndc(wks,xbox,ybox,mv_pRes)
189 gsn_polyline_ndc(wks,xbox,ybox,False)
190 gsn_text_ndc(wks,sprintf("%4.3f",values(icase,iseas,im)),ixtbox,iytbox, mv_tRes)
196 ;; activate the ;; lines if this is made a function
197 ;;if (.not.isatt(opt,"gsnFrame") .or. opt@gsnFrame) then
199 ; if png or gif then use convert
200 if (isatt(opt,"pltType") .and. \
201 (opt@pltType.eq."png" .or. opt@pltType.eq."gif")) then
202 system("convert -trim +repage "+mfname+".eps "+mfname+"."+opt@pltType)