forrest@0
|
1 |
function taylor_diagram (wks:graphic ,RATIO[*][*]:numeric, CC[*][*]:numeric \
|
forrest@0
|
2 |
,rOpts:logical)
|
forrest@0
|
3 |
;--------------------------------------------------------------------
|
forrest@0
|
4 |
; This version of taylor_diagram supports "paneling"
|
forrest@0
|
5 |
; It requires NCL version 4.2.0.a034 because it uses "gsn_create_legend"
|
forrest@0
|
6 |
;--------------------------------------------------------------------
|
forrest@0
|
7 |
|
forrest@0
|
8 |
;
|
forrest@0
|
9 |
; Generate a Taylor Diagram:
|
forrest@0
|
10 |
; Generate Multiple Aspects of Model Performance in a Single Diagram
|
forrest@0
|
11 |
; Taylor, K. E., J. Geophys. Res., 106, D7, 7183-7192, 2001
|
forrest@0
|
12 |
;
|
forrest@0
|
13 |
; An example:
|
forrest@0
|
14 |
; http://www.grida.no/climate/ipcc_tar/wg1/fig8-4.htm
|
forrest@0
|
15 |
;
|
forrest@0
|
16 |
; This expects one or more datasets. The left dimension
|
forrest@0
|
17 |
; is the number of datasets. The rightmost is the number of pts.
|
forrest@0
|
18 |
;
|
forrest@0
|
19 |
; Markers are at:
|
forrest@0
|
20 |
; http://www.ncl.ucar.edu/Document/Graphics/Resources/gs.shtml
|
forrest@0
|
21 |
;
|
forrest@0
|
22 |
; By default, the function can handle up to 10 variable comparisons..
|
forrest@0
|
23 |
; To expand ... modify the 'Colors' and 'Markers' attributes.
|
forrest@0
|
24 |
; The user can change / add some default settings.
|
forrest@0
|
25 |
;
|
forrest@0
|
26 |
; The defaults that the user can modify:
|
forrest@0
|
27 |
;
|
forrest@0
|
28 |
; rOpts = True
|
forrest@0
|
29 |
; ; 'made-up' resources
|
forrest@0
|
30 |
; rOpts@Colors = (/ "blue" , "red", "green", "cyan", "black" \
|
forrest@0
|
31 |
; , "torquoise", "brown", "yellow"/)
|
forrest@0
|
32 |
; rOpts@Markers = (/ 2, 3, 6, 14, 9, 12, 7, 4/) ; Marker Indices
|
forrest@0
|
33 |
; rOpts@markerTxOffset = 0.0175 ; offset for text above marker
|
forrest@0
|
34 |
; rOpts@stnRad = (/ 1. /) ; (/ 0.50, 0.75, 1.5 /)
|
forrest@0
|
35 |
; rOpts@centerDiffRMS = False ; True mean draw additional radii from REF
|
forrest@0
|
36 |
; rOpts@caseLabelsFontHeightF = 0.05
|
forrest@0
|
37 |
; rOpts@varLabelsFontHeightF = 0.013
|
forrest@0
|
38 |
; rOpts@varLabelsYloc = 0.65
|
forrest@0
|
39 |
; rOpts@legendWidth = 0.015
|
forrest@0
|
40 |
; rOpts@legendHeight = 0.030*nCase
|
forrest@0
|
41 |
; rOpts@taylorDraw = True
|
forrest@0
|
42 |
; rOpts@taylorFrame = True
|
forrest@0
|
43 |
;
|
forrest@0
|
44 |
; ; standard NCL resources
|
forrest@0
|
45 |
; rOpts@tiMainString = "Taylor" ; not using title makes plot bigger
|
forrest@0
|
46 |
; rOpts@gsMarkerSizeF = 0.0085 ; marker size
|
forrest@0
|
47 |
; rOpts@gsMarkerThicknessF = 1.0
|
forrest@0
|
48 |
; rOpts@txFontHeightF = 0.0125 ; text size
|
forrest@0
|
49 |
; rOpts@tiMainFontHeightF = 0.0225 ; tiMainString size
|
forrest@0
|
50 |
;
|
forrest@0
|
51 |
; It returns to the user a graphic object containing the
|
forrest@0
|
52 |
; Taylor background and plotted x/y pts.
|
forrest@0
|
53 |
; This graphic object contains a simple Taylor background appropriate
|
forrest@0
|
54 |
; for standardized data and the markers for the datasets.
|
forrest@0
|
55 |
; ==================================================================
|
forrest@0
|
56 |
; This version allows paneling:
|
forrest@0
|
57 |
; The 'cumbersome' "dum" variables were added by
|
forrest@0
|
58 |
; Adam Phillips to allow paneling via "gsn_add_?".
|
forrest@0
|
59 |
; ==================================================================
|
forrest@0
|
60 |
begin
|
forrest@0
|
61 |
dimR = dimsizes(RATIO)
|
forrest@0
|
62 |
nCase = dimR(0) ; # of cases [models]
|
forrest@0
|
63 |
nVar = dimR(1) ; # of variables
|
forrest@0
|
64 |
|
forrest@0
|
65 |
; x/y coordinates for plotting
|
forrest@0
|
66 |
X = new ( (/nCase,nVar/) , typeof(RATIO) )
|
forrest@0
|
67 |
Y = new ( (/nCase,nVar/) , typeof(RATIO) )
|
forrest@0
|
68 |
|
forrest@0
|
69 |
do nc=0,nCase-1
|
forrest@0
|
70 |
angle = acos( CC(nc,:) ) ; array operation
|
forrest@0
|
71 |
X(nc,:) = RATIO(nc,:)*cos( angle )
|
forrest@0
|
72 |
Y(nc,:) = RATIO(nc,:)*sin( angle )
|
forrest@0
|
73 |
end do
|
forrest@0
|
74 |
|
forrest@0
|
75 |
xyMin = 0.
|
forrest@0
|
76 |
xyOne = 1.00
|
forrest@0
|
77 |
xyMax = 1.65
|
forrest@0
|
78 |
xyMax_Panel = xyMax+ 0.10 ; paneling purposes
|
forrest@0
|
79 |
|
forrest@0
|
80 |
if (rOpts .and. isatt(rOpts,"txFontHeightF")) then
|
forrest@0
|
81 |
FontHeightF = rOpts@txFontHeightF ; user wants to specify size
|
forrest@0
|
82 |
else
|
forrest@0
|
83 |
FontHeightF = 0.0175
|
forrest@0
|
84 |
end if
|
forrest@0
|
85 |
|
forrest@0
|
86 |
; ----------------------------------------------------------------
|
forrest@0
|
87 |
; Part 1:
|
forrest@0
|
88 |
; base plot: Based upon request of Mark Stevens
|
forrest@0
|
89 |
; basic x-y and draw the 1.0 observed and the outer curve at 1.65
|
forrest@0
|
90 |
; ----------------------------------------------------------------
|
forrest@0
|
91 |
|
forrest@0
|
92 |
rxy = True
|
forrest@0
|
93 |
rxy@gsnDraw = False
|
forrest@0
|
94 |
rxy@gsnFrame = False
|
forrest@0
|
95 |
rxy@vpHeightF = 0.65
|
forrest@0
|
96 |
rxy@vpWidthF = 0.65
|
forrest@0
|
97 |
rxy@tmYLBorderOn = False
|
forrest@0
|
98 |
rxy@tmXBBorderOn = False
|
forrest@0
|
99 |
|
forrest@0
|
100 |
; rxy@tiYAxisString = "Standardized Deviations (Normalized)"
|
forrest@0
|
101 |
rxy@tiYAxisString = "Standardized Deviations"
|
forrest@0
|
102 |
rxy@tiYAxisFontHeightF= FontHeightF ; default=0.025
|
forrest@0
|
103 |
|
forrest@0
|
104 |
rxy@tmXBMode = "Explicit"
|
forrest@0
|
105 |
rxy@tmXBValues = (/0.0,0.25,0.50,0.75,1.00,1.25,1.5/) ; major tm
|
forrest@0
|
106 |
; default "OBS" or "REF"
|
forrest@0
|
107 |
;rxy@tmXBLabels = (/"0.00","0.25","0.50","0.75","REF" ,"1.25","1.50"/)
|
forrest@0
|
108 |
rxy@tmXBLabels = (/" ","0.25","0.50","0.75","REF" ,"1.25","1.50"/)
|
forrest@0
|
109 |
if (rOpts .and. isatt(rOpts,"OneX") ) then ; eg: rOpts@OneX="1.00"
|
forrest@0
|
110 |
;rxy@tmXBLabels = (/"0.00","0.25","0.50","0.75",rOpts@OneX,"1.25","1.50"/)
|
forrest@0
|
111 |
rxy@tmXBLabels = (/" ","0.25","0.50","0.75",rOpts@OneX,"1.25","1.50"/)
|
forrest@0
|
112 |
end if
|
forrest@0
|
113 |
|
forrest@0
|
114 |
rxy@tmXBMajorLengthF = 0.015 ; default=0.02 for a vpHeightF=0.6
|
forrest@0
|
115 |
rxy@tmXBLabelFontHeightF = FontHeightF
|
forrest@0
|
116 |
rxy@tmXBMinorOn = False
|
forrest@0
|
117 |
rxy@trXMaxF = xyMax_Panel
|
forrest@0
|
118 |
|
forrest@0
|
119 |
rxy@tmYLMode = "Manual"
|
forrest@0
|
120 |
rxy@tmYLMinorOn = False
|
forrest@0
|
121 |
rxy@tmYLMajorLengthF = rxy@tmXBMajorLengthF
|
forrest@0
|
122 |
rxy@tmYLLabelFontHeightF = FontHeightF
|
forrest@0
|
123 |
rxy@tmYLMode = "Explicit"
|
forrest@0
|
124 |
rxy@tmYLValues = (/0.0, .25,0.50, 0.75, 1.00, 1.25, 1.5/) ; major tm
|
forrest@0
|
125 |
rxy@tmYLLabels = (/"0.00","0.25","0.50","0.75","1.00","1.25","1.50"/)
|
forrest@0
|
126 |
;rxy@tmYLLabels = (/" ","0.25","0.50","0.75","1.00","1.25","1.50"/)
|
forrest@0
|
127 |
rxy@trYMaxF = xyMax_Panel
|
forrest@0
|
128 |
|
forrest@0
|
129 |
rxy@tmYRBorderOn = False
|
forrest@0
|
130 |
rxy@tmYROn = False ; Turn off right tick marks.
|
forrest@0
|
131 |
|
forrest@0
|
132 |
rxy@tmXTBorderOn = False
|
forrest@0
|
133 |
rxy@tmXTOn = False ; Turn off right tick marks.
|
forrest@0
|
134 |
|
forrest@0
|
135 |
rxy@xyDashPatterns = (/ 0 /) ; line characteristics (dash,solid)
|
forrest@0
|
136 |
rxy@xyLineThicknesses = (/ 2./) ; choose line thickness
|
forrest@0
|
137 |
|
forrest@0
|
138 |
rxy@gsnFrame = False ; Don't advance the frame.
|
forrest@0
|
139 |
|
forrest@0
|
140 |
; create outer 'correlation axis'
|
forrest@0
|
141 |
npts = 200 ; arbitrary
|
forrest@0
|
142 |
xx = fspan(xyMin,xyMax,npts)
|
forrest@0
|
143 |
yy = sqrt(xyMax^2 - xx^2 ) ; outer correlation line (xyMax)
|
forrest@0
|
144 |
|
forrest@0
|
145 |
sLabels = (/"0.0","0.1","0.2","0.3","0.4","0.5","0.6" \ ; correlation labels
|
forrest@0
|
146 |
,"0.7","0.8","0.9","0.95","0.99","1.0" /); also, major tm
|
forrest@0
|
147 |
cLabels = stringtofloat(sLabels)
|
forrest@0
|
148 |
rad = 4.*atan(1.0)/180.
|
forrest@0
|
149 |
angC = acos(cLabels)/rad ; angles: correlation labels
|
forrest@0
|
150 |
|
forrest@0
|
151 |
if (rOpts .and. isatt(rOpts,"tiMainString")) then
|
forrest@0
|
152 |
rxy@tiMainString = rOpts@tiMainString
|
forrest@0
|
153 |
;rxy@tiMainOffsetYF = 0.015 ; default 0.0
|
forrest@0
|
154 |
if (isatt(rOpts,"tiMainFontHeightF")) then
|
forrest@0
|
155 |
rxy@tiMainFontHeightF = rOpts@tiMainFontHeightF
|
forrest@0
|
156 |
else
|
forrest@0
|
157 |
rxy@tiMainFontHeightF = 0.0225 ; default 0.025
|
forrest@0
|
158 |
end if
|
forrest@0
|
159 |
end if
|
forrest@0
|
160 |
;;if (rOpts .and. isatt(rOpts,"gsnCenterString")) then
|
forrest@0
|
161 |
;; rxy@gsnCenterString = rOpts@gsnCenterString ; only gsn_csm_xy
|
forrest@0
|
162 |
;;end if
|
forrest@0
|
163 |
|
forrest@0
|
164 |
taylor = gsn_xy(wks,xx,yy,rxy) ; Create and draw XY plot.
|
forrest@0
|
165 |
|
forrest@0
|
166 |
rsrRes = True
|
forrest@0
|
167 |
rsrRes@gsLineThicknessF = rxy@xyLineThicknesses(0) ; line thickness
|
forrest@0
|
168 |
rsrRes@gsLineDashPattern = 0 ; solid line pattern
|
forrest@0
|
169 |
; draw x and y to xyMax
|
forrest@0
|
170 |
dum0 = gsn_add_polyline(wks,taylor,(/0., 0. /),(/0.,xyMax/), rsrRes)
|
forrest@0
|
171 |
dum1 = gsn_add_polyline(wks,taylor,(/0.,xyMax/),(/0., 0. /), rsrRes)
|
forrest@0
|
172 |
|
forrest@0
|
173 |
xx = fspan(xyMin, xyOne ,npts) ; draw 1.0 standard radius
|
forrest@0
|
174 |
yy = sqrt(xyOne - xx^2)
|
forrest@0
|
175 |
rsrRes@gsLineDashPattern = 1 ; dashed line pattern
|
forrest@0
|
176 |
rsrRes@gsLineThicknessF = rxy@xyLineThicknesses(0) ; line thickness
|
forrest@0
|
177 |
dum2 = gsn_add_polyline(wks,taylor,xx,yy, rsrRes)
|
forrest@0
|
178 |
delete(xx)
|
forrest@0
|
179 |
delete(yy)
|
forrest@0
|
180 |
|
forrest@0
|
181 |
if (rOpts .and. isatt(rOpts,"stnRad") ) then
|
forrest@0
|
182 |
rsrRes@gsLineThicknessF = 1 ; rxy@xyLineThicknesses(0)
|
forrest@0
|
183 |
nStnRad = dimsizes(rOpts@stnRad)
|
forrest@0
|
184 |
|
forrest@0
|
185 |
dum3 = new(nStnRad,graphic)
|
forrest@0
|
186 |
do n=0,nStnRad-1
|
forrest@0
|
187 |
rr = rOpts@stnRad(n)
|
forrest@0
|
188 |
xx = fspan(xyMin, rr ,npts)
|
forrest@0
|
189 |
yy = sqrt(rr^2 - xx^2)
|
forrest@0
|
190 |
dum3(n) = gsn_add_polyline(wks,taylor,xx,yy, rsrRes)
|
forrest@0
|
191 |
end do
|
forrest@0
|
192 |
taylor@$unique_string("dum")$ = dum3
|
forrest@0
|
193 |
|
forrest@0
|
194 |
delete(xx)
|
forrest@0
|
195 |
delete(yy)
|
forrest@0
|
196 |
end if
|
forrest@0
|
197 |
|
forrest@0
|
198 |
getvalues taylor ; get style info from taylor
|
forrest@0
|
199 |
"tmYLLabelFont" : tmYLLabelFont ; use for correlation axis
|
forrest@0
|
200 |
"tmYLLabelFontHeightF" : tmYLLabelFontHeightF
|
forrest@0
|
201 |
end getvalues
|
forrest@0
|
202 |
|
forrest@0
|
203 |
; ----------------------------------------------------------------
|
forrest@0
|
204 |
; Part 2:
|
forrest@0
|
205 |
; Correlation labels
|
forrest@0
|
206 |
; ----------------------------------------------------------------
|
forrest@0
|
207 |
radC = xyMax ; for correlation labels
|
forrest@0
|
208 |
xC = radC*cos(angC*rad)
|
forrest@0
|
209 |
yC = radC*sin(angC*rad)
|
forrest@0
|
210 |
; added to get some separation
|
forrest@0
|
211 |
xC = xC + 0.020*cos(rad*angC)
|
forrest@0
|
212 |
yC = yC + 0.060*sin(rad*angC)
|
forrest@0
|
213 |
|
forrest@0
|
214 |
txRes = True ; text mods desired
|
forrest@0
|
215 |
txRes@txFontHeightF = FontHeightF ; match YL
|
forrest@0
|
216 |
txRes@tmYLLabelFont = tmYLLabelFont ; match YL
|
forrest@0
|
217 |
txRes@txAngleF = -45.
|
forrest@0
|
218 |
if (.not.isatt(rOpts,"drawCorLabel") .or. rOpts@drawCorLabel) then
|
forrest@0
|
219 |
dum4 = gsn_add_text(wks,taylor,"Correlation",1.30,1.30,txRes)
|
forrest@0
|
220 |
taylor@$unique_string("dum")$ = dum4
|
forrest@0
|
221 |
end if
|
forrest@0
|
222 |
txRes@txAngleF = 0.0
|
forrest@0
|
223 |
txRes@txFontHeightF = FontHeightF*0.50 ; bit smaller
|
forrest@0
|
224 |
|
forrest@0
|
225 |
;;dum0 = gsn_add_text(wks,taylor,"OBSERVED",1.00,0.075,txRes)
|
forrest@0
|
226 |
|
forrest@0
|
227 |
plRes = True
|
forrest@0
|
228 |
plRes@gsLineThicknessF = 2.
|
forrest@0
|
229 |
|
forrest@0
|
230 |
txRes@txJust = "CenterLeft" ; Default="CenterCenter".
|
forrest@0
|
231 |
txRes@txFontHeightF = FontHeightF ; match YL
|
forrest@0
|
232 |
;txRes@txBackgroundFillColor = "white"
|
forrest@0
|
233 |
|
forrest@0
|
234 |
tmEnd = 0.975
|
forrest@0
|
235 |
radTM = xyMax*tmEnd ; radius end: major TM
|
forrest@0
|
236 |
xTM = new( 2 , "float")
|
forrest@0
|
237 |
yTM = new( 2 , "float")
|
forrest@0
|
238 |
|
forrest@0
|
239 |
dum5 = new(dimsizes(sLabels),graphic)
|
forrest@0
|
240 |
dum6 = dum5
|
forrest@0
|
241 |
|
forrest@0
|
242 |
do i=0,dimsizes(sLabels)-1 ; Loop to draw strings
|
forrest@0
|
243 |
txRes@txAngleF = angC(i)
|
forrest@0
|
244 |
dum5(i) = gsn_add_text(wks, taylor, sLabels(i),xC(i),yC(i),txRes) ; cor label
|
forrest@0
|
245 |
xTM(0) = xyMax*cos(angC(i)*rad) ; major tickmarks at
|
forrest@0
|
246 |
yTM(0) = xyMax*sin(angC(i)*rad) ; correlation labels
|
forrest@0
|
247 |
xTM(1) = radTM*cos(angC(i)*rad)
|
forrest@0
|
248 |
yTM(1) = radTM*sin(angC(i)*rad)
|
forrest@0
|
249 |
dum6(i) = gsn_add_polyline(wks,taylor,xTM,yTM,plRes)
|
forrest@0
|
250 |
end do
|
forrest@0
|
251 |
; minor tm locations
|
forrest@0
|
252 |
mTM = (/0.05,0.15,0.25,0.35,0.45,0.55,0.65 \
|
forrest@0
|
253 |
,0.75,0.85,0.91,0.92,0.93,0.94,0.96,0.97,0.98 /)
|
forrest@0
|
254 |
angmTM = acos(mTM)/rad ; angles: correlation labels
|
forrest@0
|
255 |
radmTM = xyMax*(1.-(1.-tmEnd)*0.5) ; radius end: minor TM
|
forrest@0
|
256 |
|
forrest@0
|
257 |
dum7 = new(dimsizes(mTM),graphic)
|
forrest@0
|
258 |
|
forrest@0
|
259 |
do i=0,dimsizes(mTM)-1 ; manually add tm
|
forrest@0
|
260 |
xTM(0) = xyMax*cos(angmTM(i)*rad) ; minor tickmarks
|
forrest@0
|
261 |
yTM(0) = xyMax*sin(angmTM(i)*rad)
|
forrest@0
|
262 |
xTM(1) = radmTM*cos(angmTM(i)*rad)
|
forrest@0
|
263 |
yTM(1) = radmTM*sin(angmTM(i)*rad)
|
forrest@0
|
264 |
dum7(i) = gsn_add_polyline(wks,taylor,xTM,yTM,plRes)
|
forrest@0
|
265 |
end do
|
forrest@0
|
266 |
; added for Wanli
|
forrest@0
|
267 |
if (rOpts .and. isatt(rOpts,"ccRays") ) then
|
forrest@0
|
268 |
angRL = acos(rOpts@ccRays)/rad ; angles: radial lines
|
forrest@0
|
269 |
|
forrest@0
|
270 |
rlRes = True
|
forrest@0
|
271 |
rlRes@xyDashPattern = 4 ; line pattern
|
forrest@0
|
272 |
rlRes@xyLineThicknessF = 1 ; choose line thickness
|
forrest@0
|
273 |
|
forrest@0
|
274 |
dum8 = new(dimsizes(angRL),graphic)
|
forrest@0
|
275 |
do i=0,dimsizes(angRL)-1
|
forrest@0
|
276 |
xRL = xyMax*cos(angRL(i)*rad)
|
forrest@0
|
277 |
yRL = xyMax*sin(angRL(i)*rad)
|
forrest@0
|
278 |
dum8(i) = gsn_add_polyline(wks,taylor,(/0, xRL /),(/0, yRL /),rlRes)
|
forrest@0
|
279 |
end do
|
forrest@0
|
280 |
taylor@$unique_string("dum")$ = dum8
|
forrest@0
|
281 |
end if
|
forrest@0
|
282 |
|
forrest@0
|
283 |
; ----------------------------------------------------------------
|
forrest@0
|
284 |
; Part 3:
|
forrest@0
|
285 |
; Concentric about 1.0 on XB axis
|
forrest@0
|
286 |
; I think this is correct. Still test mode.
|
forrest@0
|
287 |
; ----------------------------------------------------------------
|
forrest@0
|
288 |
if (rOpts .and. isatt(rOpts,"centerDiffRMS") \
|
forrest@0
|
289 |
.and. rOpts@centerDiffRMS) then
|
forrest@0
|
290 |
respl = True ; polyline mods desired
|
forrest@0
|
291 |
respl@gsLineThicknessF = 1.0 ; line thickness
|
forrest@0
|
292 |
respl@gsLineColor = "Black" ; line color
|
forrest@0
|
293 |
respl@gsLineDashPattern = 2 ; short dash lines
|
forrest@0
|
294 |
|
forrest@0
|
295 |
dx = 0.25
|
forrest@0
|
296 |
ncon = 4 ; 0.75, 0.50, 0.25, 0.0
|
forrest@0
|
297 |
npts = 100 ; arbitrary
|
forrest@0
|
298 |
ang = fspan(180,360,npts)*rad
|
forrest@0
|
299 |
|
forrest@0
|
300 |
dum9 = new(ncon,graphic)
|
forrest@0
|
301 |
|
forrest@0
|
302 |
do n=1,ncon
|
forrest@0
|
303 |
rr = n*dx ; radius from 1.0 [OBS] abscissa
|
forrest@0
|
304 |
xx = 1. + rr*cos(ang)
|
forrest@0
|
305 |
yy = fabs( rr*sin(ang) )
|
forrest@0
|
306 |
if (n.le.2) then
|
forrest@0
|
307 |
dum9(n-1) = gsn_add_polyline(wks,taylor,xx,yy,respl)
|
forrest@0
|
308 |
end if
|
forrest@0
|
309 |
if (n.eq.3) then
|
forrest@0
|
310 |
n3 = floattointeger( 0.77*npts )
|
forrest@0
|
311 |
dum9(n-1) = gsn_add_polyline(wks,taylor,xx(0:n3),yy(0:n3),respl)
|
forrest@0
|
312 |
end if
|
forrest@0
|
313 |
if (n.eq.4) then
|
forrest@0
|
314 |
n4 = floattointeger( 0.61*npts )
|
forrest@0
|
315 |
dum9(n-1) = gsn_add_polyline(wks,taylor,xx(0:n4),yy(0:n4),respl)
|
forrest@0
|
316 |
end if
|
forrest@0
|
317 |
end do
|
forrest@0
|
318 |
delete(ang)
|
forrest@0
|
319 |
delete(xx)
|
forrest@0
|
320 |
delete(yy)
|
forrest@0
|
321 |
taylor@$unique_string("dum")$ = dum9
|
forrest@0
|
322 |
|
forrest@0
|
323 |
end if
|
forrest@0
|
324 |
; ---------------------------------------------------------------
|
forrest@0
|
325 |
; Part 4:
|
forrest@0
|
326 |
; generic resources that will be applied to all users data points
|
forrest@0
|
327 |
; of course, these can be changed
|
forrest@0
|
328 |
; http://www.ncl.ucar.edu/Document/Graphics/Resources/gs.shtml
|
forrest@0
|
329 |
; ---------------------------------------------------------------
|
forrest@0
|
330 |
if (rOpts .and. isatt(rOpts,"Markers")) then
|
forrest@0
|
331 |
Markers = rOpts@Markers
|
forrest@0
|
332 |
else
|
forrest@0
|
333 |
Markers = (/ 4, 6, 8, 0, 9, 12, 7, 2, 11, 16/) ; Marker Indices
|
forrest@0
|
334 |
end if
|
forrest@0
|
335 |
|
forrest@0
|
336 |
if (rOpts .and. isatt(rOpts,"Colors")) then
|
forrest@0
|
337 |
Colors = rOpts@Colors
|
forrest@0
|
338 |
else
|
forrest@0
|
339 |
Colors = (/ "red", "blue", "green", "cyan", "orange" \
|
forrest@0
|
340 |
, "torquoise", "brown", "yellow", "purple", "black"/)
|
forrest@0
|
341 |
end if
|
forrest@0
|
342 |
|
forrest@0
|
343 |
if (rOpts .and. isatt(rOpts,"gsMarkerThicknessF")) then
|
forrest@0
|
344 |
gsMarkerThicknessF = rOpts@gsMarkerThicknessF
|
forrest@0
|
345 |
else
|
forrest@0
|
346 |
gsMarkerThicknessF = 1.0
|
forrest@0
|
347 |
end if
|
forrest@0
|
348 |
|
forrest@0
|
349 |
if (rOpts .and. isatt(rOpts,"gsMarkerSizeF")) then
|
forrest@0
|
350 |
gsMarkerSizeF = rOpts@gsMarkerSizeF
|
forrest@0
|
351 |
else
|
forrest@0
|
352 |
gsMarkerSizeF = 0.0085 ; Default: 0.007
|
forrest@0
|
353 |
end if
|
forrest@0
|
354 |
|
forrest@0
|
355 |
gsRes = True
|
forrest@0
|
356 |
gsRes@gsMarkerThicknessF = gsMarkerThicknessF ; default=1.0
|
forrest@0
|
357 |
gsRes@gsMarkerSizeF = gsMarkerSizeF ; Default: 0.007
|
forrest@0
|
358 |
|
forrest@0
|
359 |
ptRes = True ; text options for points
|
forrest@0
|
360 |
ptRes@txJust = "BottomCenter"; Default="CenterCenter".
|
forrest@0
|
361 |
ptRes@txFontThicknessF = 1.2 ; default=1.00
|
forrest@0
|
362 |
ptRes@txFontHeightF = 0.0125 ; default=0.05
|
forrest@0
|
363 |
if (rOpts .and. isatt(rOpts,"txFontHeightF")) then
|
forrest@0
|
364 |
ptRes@txFontHeightF = rOpts@txFontHeightF
|
forrest@0
|
365 |
end if
|
forrest@0
|
366 |
|
forrest@0
|
367 |
markerTxYOffset = 0.0175 ; default
|
forrest@0
|
368 |
if (rOpts .and. isatt(rOpts,"markerTxYOffset")) then
|
forrest@0
|
369 |
markerTxYOffset = rOpts@markerTxYOffset ; user defined offset
|
forrest@0
|
370 |
end if
|
forrest@0
|
371 |
|
forrest@0
|
372 |
dum10 = new((nCase*nVar),graphic)
|
forrest@0
|
373 |
dum11 = dum10
|
forrest@0
|
374 |
|
forrest@0
|
375 |
do n=0,nCase-1
|
forrest@0
|
376 |
gsRes@gsMarkerIndex = Markers(n) ; marker style (+)
|
forrest@0
|
377 |
gsRes@gsMarkerColor = Colors(n) ; marker color
|
forrest@0
|
378 |
ptRes@txFontColor = gsRes@gsMarkerColor
|
forrest@0
|
379 |
do i=0,nVar-1
|
forrest@0
|
380 |
dum10(n*nVar+i) = gsn_add_polymarker(wks,taylor,X(n,i),Y(n,i),gsRes)
|
forrest@0
|
381 |
dum11(n*nVar+i) = gsn_add_text(wks,taylor,(i+1),X(n,i),Y(n,i)+markerTxYOffset,ptRes)
|
forrest@0
|
382 |
end do
|
forrest@0
|
383 |
end do
|
forrest@0
|
384 |
|
forrest@0
|
385 |
; ---------------------------------------------------------------
|
forrest@0
|
386 |
; Part 5: ; add case legend and variable labels
|
forrest@0
|
387 |
; ---------------------------------------------------------------
|
forrest@0
|
388 |
|
forrest@0
|
389 |
if (rOpts .and. isatt(rOpts,"caseLabels")) then
|
forrest@0
|
390 |
|
forrest@0
|
391 |
if (isatt(rOpts,"caseLabelsFontHeightF")) then
|
forrest@0
|
392 |
caseLabelsFontHeightF = rOpts@caseLabelsFontHeightF
|
forrest@0
|
393 |
else
|
forrest@0
|
394 |
caseLabelsFontHeightF = 0.05
|
forrest@0
|
395 |
end if
|
forrest@0
|
396 |
|
forrest@0
|
397 |
lgres = True
|
forrest@0
|
398 |
lgres@lgMarkerColors = Colors ; colors of markers
|
forrest@0
|
399 |
lgres@lgMarkerIndexes = Markers ; Markers
|
forrest@0
|
400 |
lgres@lgMarkerSizeF = gsMarkerSizeF ; Marker size
|
forrest@0
|
401 |
lgres@lgItemType = "Markers" ; draw markers only
|
forrest@0
|
402 |
lgres@lgLabelFontHeightF = caseLabelsFontHeightF ; font height of legend case labels
|
forrest@0
|
403 |
|
forrest@0
|
404 |
if (isatt(rOpts,"legendWidth")) then
|
forrest@0
|
405 |
lgres@vpWidthF = rOpts@legendWidth
|
forrest@0
|
406 |
else
|
forrest@0
|
407 |
lgres@vpWidthF = 0.15 ; width of legend (NDC)
|
forrest@0
|
408 |
end if
|
forrest@0
|
409 |
|
forrest@0
|
410 |
if (isatt(rOpts,"legendHeight")) then
|
forrest@0
|
411 |
lgres@vpHeightF = rOpts@legendHeight
|
forrest@0
|
412 |
else
|
forrest@0
|
413 |
lgres@vpHeightF = 0.030*nCase ; height of legend (NDC)
|
forrest@0
|
414 |
end if
|
forrest@0
|
415 |
|
forrest@0
|
416 |
lgres@lgPerimOn = False ; turn off perimeter
|
forrest@0
|
417 |
nModel = dimsizes( rOpts@caseLabels )
|
forrest@0
|
418 |
lbid = gsn_create_legend(wks,nModel,rOpts@caseLabels,lgres)
|
forrest@0
|
419 |
|
forrest@0
|
420 |
amres = True
|
forrest@0
|
421 |
amres@amParallelPosF = 0.35
|
forrest@0
|
422 |
amres@amOrthogonalPosF = -0.35
|
forrest@0
|
423 |
annoid1 = gsn_add_annotation(taylor,lbid,amres) ; add legend to plot
|
forrest@0
|
424 |
end if
|
forrest@0
|
425 |
|
forrest@0
|
426 |
if (rOpts .and. isatt(rOpts,"varLabels")) then
|
forrest@0
|
427 |
nVar = dimsizes(rOpts@varLabels)
|
forrest@0
|
428 |
|
forrest@0
|
429 |
if (isatt(rOpts,"varLabelsFontHeightF")) then
|
forrest@0
|
430 |
varLabelsFontHeightF = rOpts@varLabelsFontHeightF
|
forrest@0
|
431 |
else
|
forrest@0
|
432 |
varLabelsFontHeightF = 0.013
|
forrest@0
|
433 |
end if
|
forrest@0
|
434 |
|
forrest@0
|
435 |
txres = True
|
forrest@0
|
436 |
txres@txFontHeightF = varLabelsFontHeightF
|
forrest@0
|
437 |
txres@txJust = "CenterLeft" ; justify to the center left
|
forrest@0
|
438 |
|
forrest@0
|
439 |
;delta_y = 0.02
|
forrest@0
|
440 |
delta_y = 0.06
|
forrest@0
|
441 |
if (rOpts .and. isatt(rOpts,"varLabelsYloc")) then
|
forrest@0
|
442 |
ys = rOpts@varLabelsYloc ; user specified
|
forrest@0
|
443 |
else
|
forrest@0
|
444 |
ys = max( (/nVar*delta_y , 0.30/) )
|
forrest@0
|
445 |
end if
|
forrest@0
|
446 |
|
forrest@0
|
447 |
|
forrest@0
|
448 |
do i = 1,nVar
|
forrest@0
|
449 |
if (i.eq.1) then
|
forrest@0
|
450 |
dum12 = new(nVar,graphic)
|
forrest@0
|
451 |
end if
|
forrest@0
|
452 |
|
forrest@0
|
453 |
dum12(i-1) = gsn_add_text(wks,taylor,i+" - "+rOpts@varLabels(i-1), .125,ys,txres)
|
forrest@0
|
454 |
ys = ys- delta_y
|
forrest@0
|
455 |
end do
|
forrest@0
|
456 |
|
forrest@0
|
457 |
taylor@$unique_string("dum")$ = dum12
|
forrest@0
|
458 |
end if
|
forrest@0
|
459 |
|
forrest@0
|
460 |
taylor@$unique_string("dum")$ = dum0 ; x-axis
|
forrest@0
|
461 |
taylor@$unique_string("dum")$ = dum1 ; y-axis
|
forrest@0
|
462 |
taylor@$unique_string("dum")$ = dum2 ; 1.0 std curve
|
forrest@0
|
463 |
taylor@$unique_string("dum")$ = dum5 ; labels [COR]
|
forrest@0
|
464 |
taylor@$unique_string("dum")$ = dum6 ; major tm [COR]
|
forrest@0
|
465 |
taylor@$unique_string("dum")$ = dum7 ; minor tm
|
forrest@0
|
466 |
taylor@$unique_string("dum")$ = dum10 ; markers
|
forrest@0
|
467 |
taylor@$unique_string("dum")$ = dum11 ; text
|
forrest@0
|
468 |
|
forrest@0
|
469 |
if (.not.isatt(rOpts,"taylorDraw") .or. \
|
forrest@0
|
470 |
(isatt(rOpts,"taylorDraw") .and. rOpts@taylorDraw)) then
|
forrest@0
|
471 |
draw(taylor)
|
forrest@0
|
472 |
end if
|
forrest@0
|
473 |
if (.not.isatt(rOpts,"taylorFrame") .or. \
|
forrest@0
|
474 |
(isatt(rOpts,"taylorFrame") .and. rOpts@taylorFrame)) then
|
forrest@0
|
475 |
frame(wks)
|
forrest@0
|
476 |
end if
|
forrest@0
|
477 |
return(taylor)
|
forrest@0
|
478 |
end
|
forrest@0
|
479 |
|