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 metrics_table(mfname[1]:string \ ; plot name
17 ,varNames[*]:string \ ; variables
19 ,values[*][*]:numeric \
24 ;;; Output of metrics to a table [grid]
27 if (.not.isatt(opt,"pltType") .or. \
28 (opt@pltType.eq."eps" .or. opt@pltType.eq."png" .or. opt@pltType.eq."gif")) then
29 wks = gsn_open_wks("eps",mfname) ; default
31 wks = gsn_open_wks(opt@pltType,mfname)
34 xbox0 = (/0.0,1.0,1.0,0.0,0.0/) ; Box template.
35 ybox0 = (/0.0,0.0,1.0,1.0,0.0/)
37 nvar = dimsizes(varNames)
38 ncases = dimsizes(cases)
40 dimt = dimsizes(values) ; table dimensions
42 if (ncases.ne.dimt(0)) then
43 print("metrics_table fatal error: Number of case names ("+ncases+ \
44 ") does not match the number of cases passed in ("+dimt(0)+")")
48 if (dimsizes(varNames).ne.dimt(1)) then
49 print("metrics_table fatal error: Number of metric variables names ("+dimsizes(varNames)+ \
50 ") does not match the number of metric variables passed in ("+dimt(1)+")")
55 if (ncolm1.le.12) then
60 if (ncolm1.ge.7.and.ncolm1.le.12) then
68 if (ncolm1.le.20) then
82 if (ncolm1.gt.26.or.dimt(1).gt.63) then
83 print("Warning: Recommended maximium size of array passed into metrics_table is "+ \
84 "26 columns (#cases * #seasons) by 63 rows (#variables), continuing")
90 mv_theight = mn_theight
93 tt_pRes@gsFillColor = "CornflowerBlue" ; background color for + values
96 tt_tRes@txFontHeightF = tt_theight
99 mn_pRes@gsFillColor = "Gray70" ; background color for variable names
102 mn_tRes@txFontHeightF = mn_theight
105 mv_pRes@gsFillColor = "White" ; background color for reference values
108 mv_tRes@txFontHeightF = mn_theight
112 xbox = tt_width*xbox0
113 ybox = 1.-tt_height*ybox0
115 ixtbox = xbox(0)+0.5*(xbox(1)-xbox(0))
116 iytbox = ybox(0)+0.5*(ybox(2)-ybox(0))
118 gsn_polygon_ndc(wks,xbox,ybox,tt_pRes)
119 if (isatt(opt,"tableTitle") ) then
120 gsn_text_ndc(wks, opt@tableTitle ,ixtbox,iytbox, tt_tRes)
122 gsn_text_ndc(wks,"METRICS",ixtbox,iytbox, tt_tRes)
124 gsn_polyline_ndc(wks,xbox,ybox,False)
127 ybox = min(ybox)-(ybox0*mn_height)
128 ixtbox = xbox(0)+0.5*(xbox(1)-xbox(0))
129 iytbox = ybox(0)+0.5*(ybox(2)-ybox(0))
131 gsn_polygon_ndc(wks,xbox,ybox,mn_pRes)
132 gsn_polyline_ndc(wks,xbox,ybox,False)
133 gsn_text_ndc(wks,varNames(im),ixtbox,iytbox, mn_tRes)
136 do icase = 0, ncases-1
137 ; ybox = 1.-0.5*tt_height*ybox0
138 ybox = 1.-tt_height*ybox0
139 xbox = ((1.-tt_width)/ncases)*(xbox0+icase)+tt_width
141 ixtbox = xbox(0)+0.5*(xbox(1)-xbox(0))
142 iytbox = ybox(0)+0.5*(ybox(2)-ybox(0))
143 gsn_polygon_ndc(wks,xbox,ybox,mn_pRes)
144 gsn_polyline_ndc(wks,xbox,ybox,False)
145 gsn_text_ndc(wks,cases(icase),ixtbox,iytbox, mn_tRes)
147 ; do iseas = 0, nseas-1
148 ; ybox = 1.-0.5*tt_height-0.5*tt_height*ybox0
149 ; xbox = xboxi + ((1.-tt_width)/(ncases*nseas))*(xbox0+iseas)
150 ; ixtbox = xbox(0)+0.5*(xbox(1)-xbox(0))
151 ; iytbox = ybox(0)+0.5*(ybox(2)-ybox(0))
152 ; gsn_polygon_ndc(wks,xbox,ybox,mn_pRes)
153 ; gsn_polyline_ndc(wks,xbox,ybox,False)
154 ; gsn_text_ndc(wks,seasons(iseas),ixtbox,iytbox, mn_tRes)
156 if (icase .eq. ncases-1) then
157 mv_pRes@gsFillColor = "Green"
159 mv_pRes@gsFillColor = "White"
164 ybox = 1.-tt_height-mv_height*ybox0
166 ybox = ybox - mv_height
168 ixtbox = xbox(0)+0.5*(xbox(1)-xbox(0)) ; add
169 iytbox = ybox(0)+0.5*(ybox(2)-ybox(0))
171 ; if (icase .gt. 0) then
172 ; if (ismissing(values(icase,im)) .or. \ ; ???
173 ; ismissing(values(icase,im)))then
174 ; ; print ("Missing values skipped")
176 ; if (values(icase,im).le.values(0,im)) then
177 ; if (isatt(opt,"color0")) then
178 ; mv_pRes@gsFillColor = opt@color0
180 ; mv_pRes@gsFillColor = "DarkOliveGreen3"
183 ; if (isatt(opt,"color1")) then
184 ; mv_pRes@gsFillColor = opt@color1
186 ; mv_pRes@gsFillColor = "IndianRed1"
191 gsn_polygon_ndc(wks,xbox,ybox,mv_pRes)
192 gsn_polyline_ndc(wks,xbox,ybox,False)
193 gsn_text_ndc(wks,sprintf("%4.2f",values(icase,im)),ixtbox,iytbox, mv_tRes)
199 ;; activate the ;; lines if this is made a function
200 ;;if (.not.isatt(opt,"gsnFrame") .or. opt@gsnFrame) then
202 ; if png or gif then use convert
203 if (isatt(opt,"pltType") .and. \
204 (opt@pltType.eq."png" .or. opt@pltType.eq."gif")) then
205 system("convert -trim +repage "+mfname+".eps "+mfname+"."+opt@pltType)