function taylor_diagram_cam (wks:graphic \ ,RATIO[*][*]:numeric \ , CC[*][*]:numeric \ , BIAS[*][*]:numeric \ ,rOpts:logical) ;-------------------------------------------------------------------- ; This version of taylor_diagram supports "paneling" ; It requires NCL version 4.2.0.a034 because it uses "gsn_create_legend" ;-------------------------------------------------------------------- ; R. Neale added the 'bias' enhancements ;-------------------------------------------------------------------- ; ; Generate a Taylor Diagram: ; Generate Multiple Aspects of Model Performance in a Single Diagram ; Taylor, K. E., J. Geophys. Res., 106, D7, 7183-7192, 2001 ; ; An example: ; http://www.grida.no/climate/ipcc_tar/wg1/fig8-4.htm ; ; This expects one or more datasets. The left dimension ; is the number of datasets. The rightmost is the number of pts. ; ; Markers are at: ; http://www.ncl.ucar.edu/Document/Graphics/Resources/gs.shtml ; ; By default, the function can handle up to 10 variable comparisons.. ; To expand ... modify the 'Colors' and 'Markers' attributes. ; The user can change / add some default settings. ; ; The defaults that the user can modify: ; ; rOpts = True ; ; 'made-up' resources ; rOpts@Colors = (/ "blue" , "red", "green", "cyan", "black" \ ; , "purple", "brown", "yellow"/) ; rOpts@Markers = (/ 2, 3, 6, 14, 9, 12, 7, 4/) ; Marker Indices ; rOpts@markerTxOffset = 0.0175 ; offset for text above marker ; rOpts@stnRad = (/ 1. /) ; (/ 0.50, 0.75, 1.5 /) ; rOpts@centerDiffRMS = False ; True mean draw additional radii from REF ; rOpts@caseLabelsFontHeightF = 0.05 ; rOpts@varLabelsFontHeightF = 0.013 ; rOpts@varLabelsYloc = 0.65 ; rOpts@caseLabelsXYloc = (/ 0.70, 0.80 /) ; rOpts@legendWidth = 0.015 ; rOpts@legendHeight = 0.030*nCase ; rOpts@taylorDraw = True ; rOpts@taylorFrame = True ; ; ; standard NCL resources ; rOpts@tiMainString = "Taylor" ; not using title makes plot bigger ; rOpts@gsMarkerSizeF = 0.0085 ; marker size ; rOpts@gsMarkerThicknessF = 1.0 ; rOpts@txFontHeightF = 0.0125 ; text size ; rOpts@tiMainFontHeightF = 0.0225 ; tiMainString size ; rOpts@tdBiasLabelOn = True or False for adding bias labels ; ; It returns to the user a graphic object containing the ; Taylor background and plotted x/y pts. ; This graphic object contains a simple Taylor background appropriate ; for standardized data and the markers for the datasets. ; ================================================================== ; This version allows paneling: ; The 'cumbersome' "dum" variables were added ; to allow paneling via "gsn_add_?". ; ================================================================== begin dimR = dimsizes(RATIO) nCase = dimR(0) ; # of cases [models] nVar = dimR(1) ; # of variables ; x/y coordinates for plotting X = new ( (/nCase,nVar/) , typeof(RATIO) ) Y = new ( (/nCase,nVar/) , typeof(RATIO) ) do nc=0,nCase-1 angle = acos( CC(nc,:) ) ; array operation X(nc,:) = RATIO(nc,:)*cos( angle ) Y(nc,:) = RATIO(nc,:)*sin( angle ) end do xyMin = -1.65 xyOne = 1.00 xyMax = 1.65 xyMax_Panel = xyMax+ 0.10 ; paneling purposes if (rOpts .and. isatt(rOpts,"txFontHeightF")) then FontHeightF = rOpts@txFontHeightF ; user wants to specify size else FontHeightF = 0.0175 end if ; ---------------------------------------------------------------- ; Part 1: ; base plot: Based upon request of Mark Stevens ; basic x-y and draw the 1.0 observed and the outer curve at 1.65 ; ---------------------------------------------------------------- ;print("============> taylor_diagram: Part 1 ") rxy = True rxy@gsnDraw = False rxy@gsnFrame = False rxy@vpYF = 0.80 ; rxy@vpXF = 0.15*2 rxy@vpHeightF = 0.35 rxy@vpWidthF = 0.75 rxy@tmYLBorderOn = False rxy@tmXBBorderOn = False ; rxy@tiYAxisString = "Standardized Deviations (Normalized)" rxy@tiYAxisFontHeightF= FontHeightF ; default=0.025 rxy@tmXBMode = "Explicit" rxy@tmXBValues = (/-1.5,-1.25,-1.00,-0.75,-0.50,-0.25,0.0,0.25,0.50,0.75,1.00,1.25,1.5/) ; major tm ; default "OBS" or "REF" ;rxy@tmXBLabels = (/"0.00","0.25","0.50","0.75","REF" ,"1.25","1.50"/) rxy@tmXBLabels = (/"-1.50","-1.25","REF" ,"-0.75","-0.50","-0.25"," ","0.25","0.50","0.75","REF" ,"1.25","1.50"/) if (rOpts .and. isatt(rOpts,"OneX") ) then ; eg: rOpts@OneX="1.00" rxy@tmXBLabels = (/"-1.50","-1.25",rOpts@OneX,"-0.75","-0.50","-0.25"," ","0.25","0.50","0.75",rOpts@OneX,"1.25","1.50"/) end if rxy@tmXBMajorLengthF = 0.015 ; default=0.02 for a vpHeightF=0.6 rxy@tmXBLabelFontHeightF = FontHeightF rxy@tmXBMinorOn = False ; rxy@trXMinF = xyMin ; rxy@trXMaxF = xyMax_Panel ; rxy@tmYLMode = "Manual" ; rxy@tmYLMinorOn = False rxy@tmYLMajorLengthF = rxy@tmXBMajorLengthF ; rxy@tmYLLabelFontHeightF = FontHeightF ; rxy@tmYLMode = "Explicit" ; rxy@tmYLValues = (/0.0, .25,0.50, 0.75, 1.00, 1.25, 1.5/) ; major tm ; rxy@tmYLLabels = (/"0.00","0.25","0.50","0.75","1.00","1.25","1.50"/) ;rxy@tmYLLabels = (/" ","0.25","0.50","0.75","1.00","1.25","1.50"/) rxy@trYMaxF = xyMax_Panel ; rxy@tmYLLabelsOn = False rxy@tmYLOn = False rxy@tmYRBorderOn = False rxy@tmYROn = False ; Turn off right tick marks. rxy@tmXTBorderOn = False rxy@tmXTOn = False ; Turn off right tick marks. rxy@xyDashPatterns = (/ 0 /) ; line characteristics (dash,solid) rxy@xyLineThicknesses = (/ 2./) ; choose line thickness rxy@gsnTickMarksPointOutward = False ; "hidden" resource rxy@gsnDraw = False rxy@gsnFrame = False ; Don't advance the frame. ; create outer 'correlation axis' npts = 200 ; arbitrary xx = fspan(xyMin,xyMax,npts) yy = sqrt(xyMax^2 - xx^2 ) ; outer correlation line (xyMax) sLabels = (/" -1.0","-0.99","-0.95","-0.9","-0.8","-0.7","-0.6 ","-0.5 ", \ "-0.4 ","-0.3 ","-0.2 ","-0.1 "," 0.0","0.1", \ " 0.2"," 0.3"," 0.4","0.5","0.6" \ ; correlation labels ,"0.7","0.8","0.9","0.95","0.99","1.0" /); also, major tm cLabels = stringtofloat(sLabels) rad = 4.*atan(1.0)/180. angC = acos(cLabels)/rad ; angles: correlation labels if (rOpts .and. isatt(rOpts,"tiMainString")) then rxy@tiMainString = rOpts@tiMainString ;rxy@tiMainOffsetYF = 0.015 ; default 0.0 if (isatt(rOpts,"tiMainFontHeightF")) then rxy@tiMainFontHeightF = rOpts@tiMainFontHeightF else rxy@tiMainFontHeightF = 0.0225 ; default 0.025 end if end if if (rOpts .and. isatt(rOpts,"gsnCenterString")) then rxy@gsnCenterString = rOpts@gsnCenterString ; only gsn_csm_xy end if taylor = gsn_csm_xy(wks,xx,yy,rxy) ; Create and draw XY plot. delete(xx) delete(yy) rsrRes = True rsrRes@gsLineThicknessF = rxy@xyLineThicknesses(0) ; line thickness rsrRes@gsLineDashPattern = 0 ; solid line pattern ; draw x and y to xyMax ; dum0 = gsn_add_polyline(wks,taylor,(/0., 0. /),(/0.,xyMax/), rsrRes) dum0 = gsn_add_polyline(wks,taylor,(/0., 0. /),(/0.,xyMax/), rsrRes) dum1 = gsn_add_polyline(wks,taylor,(/xyMin,xyMax/),(/0., 0. /), rsrRes) xyOneN= -1.*xyOne xx = fspan(xyOneN, xyOne ,npts) ; draw 1.0 standard radius yy = sqrt(xyOne - xx^2) rsrRes@gsLineDashPattern = 1 ; dashed line pattern rsrRes@gsLineThicknessF = rxy@xyLineThicknesses(0) ; line thickness dum2 = gsn_add_polyline(wks,taylor,xx,yy, rsrRes) delete(xx) delete(yy) if (rOpts .and. isatt(rOpts,"stnRad") ) then rsrRes@gsLineThicknessF = 1 ; rxy@xyLineThicknesses(0) nStnRad = dimsizes(rOpts@stnRad) dum3 = new(nStnRad,graphic) do n=0,nStnRad-1 rr = rOpts@stnRad(n) xx = fspan(xyMin, rr ,npts) yy = sqrt(rr^2 - xx^2) dum3(n) = gsn_add_polyline(wks,taylor,xx,yy, rsrRes) end do taylor@$unique_string("dum")$ = dum3 delete(xx) delete(yy) end if getvalues taylor ; get style info from taylor "tmYLLabelFont" : tmYLLabelFont ; use for correlation axis "tmYLLabelFontHeightF" : tmYLLabelFontHeightF end getvalues ; ---------------------------------------------------------------- ; Part 2: ; Correlation labels ; ---------------------------------------------------------------- ;print("============> taylor_diagram: Part 2 ") radC = xyMax ; for correlat/ion labels txRes = True ; text mods desired txRes@txFontHeightF = FontHeightF ; match YL txRes@tmYLLabelFont = tmYLLabelFont ; match YL txRes@txAngleF = -50. if (.not.isatt(rOpts,"drawCorLabel") .or. rOpts@drawCorLabel) then dum4 = gsn_add_text(wks,taylor,"Correlation",1.45,1.20,txRes) taylor@$unique_string("dum")$ = dum4 end if txRes@txAngleF = 0.0 txRes@txFontHeightF = FontHeightF*0.50 ; bit smaller ;;dum0 = gsn_add_text(wks,taylor,"OBSERVED",1.00,0.075,txRes) plRes = True plRes@gsLineThicknessF = 2. txRes@txJust = "CenterLeft" ; Default="CenterCenter". txRes@txFontHeightF = FontHeightF ; match YL ;txRes@txBackgroundFillColor = "white" tmEnd = 0.975 radTM = xyMax*tmEnd ; radius end: major TM xTM = new( 2 , "float") yTM = new( 2 , "float") dum5 = new(dimsizes(sLabels),graphic) dum6 = dum5 do i=0,dimsizes(sLabels)-1 ; Loop to draw strings xC = radC*cos(angC*rad) + 0.02*cos(rad*angC) yC = radC*sin(angC*rad) + 0.077*sin(rad*angC) if(i.eq.12.or.i.eq.13.or.i.eq.14.or.i.eq.15) ; print(xC(i)+" "+yC(i)) xC(i) = xC(i)-0.1/2.3 end if if(i.eq.16) xC(i) = xC(i)-0.1/2.7 end if txRes@txAngleF = angC(i) if(i.le.11) txRes@txAngleF = angC(i)+180 ; ; xC = radC*cos(angC*rad)+ 0.35*cos(rad*angC) if(i.le.2) xC = radC*cos(angC*rad)+ 0.28*cos(rad*angC) yC = radC*sin(angC*rad)+ 0.15*sin(rad*angC) else if(i.gt.2.and.i.le.6) xC = radC*cos(angC*rad)+ 0.25*cos(rad*angC) yC = radC*sin(angC*rad)+ 0.09*sin(rad*angC) else if(i.gt.6.and.i.le.9) ; rrmk xC = radC*cos(angC*rad)+ 0.3*cos(rad*angC) yC = radC*sin(angC*rad)- 0.039*sin(rad*angC) else xC = radC*cos(angC*rad)+ 0.37*cos(rad*angC) yC = radC*sin(angC*rad)- 0.039*sin(rad*angC) end if end if end if end if dum5(i) = gsn_add_text(wks, taylor, sLabels(i),xC(i),yC(i),txRes) ; cor label xTM(0) = xyMax*cos(angC(i)*rad) ; major tickmarks at yTM(0) = xyMax*sin(angC(i)*rad) ; correlation labels xTM(1) = radTM*cos(angC(i)*rad) yTM(1) = radTM*sin(angC(i)*rad) dum6(i) = gsn_add_polyline(wks,taylor,xTM,yTM,plRes) end do ; minor tm locations mTM1 = (/0.05,0.15,0.25,0.35,0.45,0.55,0.65 \ ,0.75,0.85,0.91,0.92,0.93,0.94,0.96,0.97,0.98 /) mTM2 = -1.*mTM1(::-1) mTM = new(2*dimsizes(mTM1),float) mTM(0:dimsizes(mTM1)-1) = mTM2 mTM(dimsizes(mTM1):2*dimsizes(mTM2)-1) = mTM1 angmTM = acos(mTM)/rad ; angles: correlation labels radmTM = xyMax*(1.-(1.-tmEnd)*0.5) ; radius end: minor TM dum7 = new(dimsizes(mTM),graphic) do i=0,dimsizes(mTM)-1 ; manually add tm xTM(0) = xyMax*cos(angmTM(i)*rad) ; minor tickmarks yTM(0) = xyMax*sin(angmTM(i)*rad) xTM(1) = radmTM*cos(angmTM(i)*rad) yTM(1) = radmTM*sin(angmTM(i)*rad) dum7(i) = gsn_add_polyline(wks,taylor,xTM,yTM,plRes) end do ; added for Wanli if (rOpts .and. isatt(rOpts,"ccRays") ) then angRL = acos(rOpts@ccRays)/rad ; angles: radial lines rlRes = True rlRes@gsLineDashPattern= 2 ; line pattern rlRes@gsLineThicknessF = 1 ; choose line thickness if (isatt(rOpts,"ccRays_color")) then rlRes@gsLineColor = rOpts@ccRays_color end if dum8 = new(dimsizes(angRL),graphic) do i=0,dimsizes(angRL)-1 xRL = xyMax*cos(angRL(i)*rad) yRL = xyMax*sin(angRL(i)*rad) dum8(i) = gsn_add_polyline(wks,taylor,(/0, xRL /),(/0, yRL /),rlRes) end do taylor@$unique_string("dum")$ = dum8 end if ; ---------------------------------------------------------------- ; Part 3: ; Concentric about 1.0 on XB axis ; ---------------------------------------------------------------- ;print("============> taylor_diagram: Part 3 ") if (rOpts .and. isatt(rOpts,"centerDiffRMS") \ .and. rOpts@centerDiffRMS) then respl = True ; polyline mods desired respl@xyLineThicknessF = 1.0 ; line thickness respl@xyLineDashPattern = 2 ; short dash lines respl@gsLineColor = "Black" ; line color if (isatt(rOpts,"centerDiffRMS_color")) then respl@gsLineColor = "LightGray" end if dx = 0.25 ncon = 10 ; 0.75, 0.50, 0.25, 0.0 npts = 100 ; arbitrary ang = fspan(180,360,npts)*rad dum9 = new(ncon,graphic) nnm = (/0.77,0.61,.52,0.44,0.37,0.3,.23,.14/) do n=1,ncon rr = n*dx ; radius from 1.0 [OBS] abscissa xx = 1. + rr*cos(ang) yy = fabs( rr*sin(ang) ) if (n.le.2) then dum9(n-1) = gsn_add_polyline(wks,taylor,xx,yy,respl) else nN= floattointeger(nnm(n-3)*npts) dum9(n-1) = gsn_add_polyline(wks,taylor,xx(0:nN),yy(0:nN),respl) end if end do delete([/ang,xx,yy,nnm,nN/]) taylor@$unique_string("dum")$ = dum9 end if ; --------------------------------------------------------------- ; Part 4: ; generic resources that will be applied to all users data points ; of course, these can be changed ; http://www.ncl.ucar.edu/Document/Graphics/Resources/gs.shtml ; --------------------------------------------------------------- ;print("============> taylor_diagram: Part 4 ") if (rOpts .and. isatt(rOpts,"Markers")) then Markers = rOpts@Markers else ;;Markers = (/ 4, 6, 8, 0, 9, 12, 7, 2, 11, 16/) ; Marker Indices Markers = (/ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7/) ; Marker Indices end if if (rOpts .and. isatt(rOpts,"Colors")) then Colors = rOpts@Colors else Colors = (/ "red", "blue", "green", "cyan", "orange" \ , "purple", "brown", "yellow", "purple", "black"/) end if if (rOpts .and. isatt(rOpts,"gsMarkerThicknessF")) then gsMarkerThicknessF = rOpts@gsMarkerThicknessF else gsMarkerThicknessF = 1.0 end if if (rOpts .and. isatt(rOpts,"gsMarkerSizeF")) then gsMarkerSizeF = rOpts@gsMarkerSizeF else gsMarkerSizeF = 0.0085 ; Default: 0.007 end if gsRes = True gsRes@gsMarkerThicknessF = gsMarkerThicknessF ; default=1.0 gsRes@gsMarkerSizeF = gsMarkerSizeF ; Default: 0.007 ptRes = True ; text options for points ptRes@txJust = "BottomCenter"; Default="CenterCenter". ptRes@txFontThicknessF = 1.2 ; default=1.00 ptRes@txFontHeightF = 0.0125 ; default=0.05 if (rOpts .and. isatt(rOpts,"txFontHeightF")) then ptRes@txFontHeightF = rOpts@txFontHeightF end if ; id rmm markerTxYOffset = 0.0175 ; default if (rOpts .and. isatt(rOpts,"markerTxYOffset")) then markerTxYOffset = rOpts@markerTxYOffset ; user defined offset end if dum10 = new((nCase*nVar),graphic) dum11 = dum10 dum12 = dum10 ;; Up-front info. for bias labelling. ; id rmm ; BiasMarkerScale = (/1.0,0.75,1.0,1.25,1.50/) ; BiasLabels = (/"<1%","1-5%","5-10%","10-20%",">20%"/) ; BiasLevels = (/1.,5.,10.,20./) BiasMarkerScale = (/0.60,0.85,1.10,1.35,1.60/)-0.10 BiasLabels = (/"<5%","5-10%","10-15%","15-20%",">20%"/) BiasLevels = (/5.,10.,15.,20./) ;-------------------------------------------------------------------- ; R. Neale added the 'bias' enhancements ;-------------------------------------------------------------------- do n=0,nCase-1 ; gsRes@gsMarkerIndex = Markers(n) ; marker style gsRes@txFontColor = Colors(n) ; marker color ptRes@txFontColor = Colors(n) ; make font same color gsRes@gsMarkerColor = Colors(n) do i=0,nVar-1 ; Marker type (index) gsRes@gsMarkerColor = Colors(i) ; id rmm if (.not.ismissing(BIAS(n,i))) then if (BIAS(n,i).ge.0) then ; % gsRes@gsMarkerIndex = 7 ; up-triangle end if ;if (BIAS(n,i).lt.1.) then if (BIAS(n,i).lt.0) then ; % gsRes@gsMarkerIndex = 8 ; down-triangle end if scaleMarkerSize = BiasMarkerScale(0) ; For the 'near obs.' classification. if (abs(BIAS(n,i)).gt.BiasLevels(0) .and. abs(BIAS(n,i)).le.BiasLevels(1)) then scaleMarkerSize = BiasMarkerScale(1) end if if (abs(BIAS(n,i)).gt.BiasLevels(1) .and. abs(BIAS(n,i)).le.BiasLevels(2)) then scaleMarkerSize = BiasMarkerScale(2) end if if (abs(BIAS(n,i)).gt.BiasLevels(2) .and. abs(BIAS(n,i)).le.BiasLevels(3)) then scaleMarkerSize = BiasMarkerScale(3) end if if (abs(BIAS(n,i)).gt.BiasLevels(3)) then scaleMarkerSize = BiasMarkerScale(4) end if gsRes@gsMarkerSizeF = gsMarkerSizeF*scaleMarkerSize ;print(sprintf("%6.2f",BIAS(n,i))+" "+gsRes@gsMarkerIndex \ ; +" "+sprintf("%6.4f",gsRes@gsMarkerSizeF) \ ; +" "+scaleMarkerSize) ptRes@txPerimOn = False ; if (abs(BIAS(n,i)).eq.min(abs(BIAS(0:nCase-1,i)))) then ; ptRes@txPerimSpaceF = 0.2 ; ptRes@txPerimThicknessF = 0.2 ; id rmm ; ptRes@txBackgroundFillColor = Colors(n) ; ptRes@txFontColor = "White" ; end if dum11(n*nVar+i) = gsn_add_polymarker(wks,taylor,X(n,i),Y(n,i),gsRes) ; dum12(n*nVar+i) = gsn_add_text(wks,taylor,(i+1),X(n,i),Y(n,i)+markerTxYOffset,ptRes) ptRes@txFontColor = Colors(n) ptRes@txBackgroundFillColor = "Transparent" end if ; .not.ismissing(BIAS(n,1)) end do end do ; --------------------------------------------------------------- ; Part 4a: add bias legend ; --------------------------------------------------------------- ; Add bias sizing key to plot if(rOpts.and.isatt(rOpts,"tdBiasLabelOn").and.rOpts@tdBiasLabelOn)then ; useful for multi-plots lgres = True lgres@lgPerimOn = False ; turn off perimeter lgres@lgMonoMarkerSize = False lgres@lgMonoMarkerColor = True lgres@vpWidthF = 0.12 lgres@vpHeightF = 0.24 lgres@lgMarkerColor = "Black" ; colors of markers lgres@lgMarkerIndexes = (/8,8,8,8,8/) ; Markers lgres@lgMarkerSizes = BiasMarkerScale*gsMarkerSizeF ; Marker size lgres@lgItemType = "Markers" ; draw markers only lgres@lgLabelFontHeightF = 0.055*4 ; font height of legend case labels lgres@lgTitleFontHeightF = 0.01*3 ; lgres@lgTitleFont = 26 ; lgres@lgTitleOffsetF = lgres@lgLabelOffsetF = -0.5 lgres@lgTitleString = " - +" lgres@lgLabelsOn = False ; Down triangles - no text lbid = gsn_create_legend(wks,5,BiasLabels,lgres) amres = True ; amres@amTrackData = False ;id rmm amres@amParallelPosF = -0.45 amres@amOrthogonalPosF = -0.28 if (rOpts .and. isatt(rOpts,"tdBiasLabelPP")) then amres@amParallelPosF = rOpts@tdBiasLabelPP ; id rmm end if if (rOpts .and. isatt(rOpts,"tdBiasLabelOP")) then amres@amOrthogonalPosF = rOpts@tdBiasLabelOP ; id rmm end if annoid1 = gsn_add_annotation(taylor,lbid,amres) ; add legend to plot ; Up triangles - with text lgres@lgLabelsOn = True lgres@lgTitleString = " Bias " ; id rmm ; lgres@lgMarkerIndexes(1:4) = lgres@lgMarkerIndexes(1:4)-1 lgres@lgMarkerIndexes = lgres@lgMarkerIndexes-1 ;=>7,7,7... lbid = gsn_create_legend(wks,5,BiasLabels,lgres) amres@amParallelPosF = -0.38 if (rOpts .and. isatt(rOpts,"tdBiasLabelOP")) then amres@amParallelPosF = 0.12+rOpts@tdBiasLabelPP end if annoid2 = gsn_add_annotation(taylor,lbid,amres) ; add legend to plot delete(lgres) end if ; --------------------------------------------------------------- ; Part 5: add case legend and variable labels ; --------------------------------------------------------------- ;print("============> taylor_diagram: Part 5 ") if (rOpts .and. isatt(rOpts,"caseLabels")) then if (isatt(rOpts,"caseLabelsXYloc")) then caseXloc = rOpts@caseLabelsXYloc(0) caseYloc = rOpts@caseLabelsXYloc(1) else caseXloc = 0.70 ; default ndc caseYloc = 0.80 end if if (isatt(rOpts,"caseLabelsFontHeightF")) then caseLabelsFontHeightF = rOpts@caseLabelsFontHeightF else caseLabelsFontHeightF = 0.05 end if larr = dimsizes(Markers) lrd = ispan(0,larr-1,1) lgres = True lgres@lgMarkerColors = Colors ; colors of markers lgres@lgLabelFontColor = Colors ; lgres@lgItemOrder = lrd(::-1); id rmm lgres@lgMarkerIndexes = Markers ; Markers lgres@lgMarkerSizeF = gsMarkerSizeF ; Marker size lgres@lgItemType = "Markers" ; draw markers only lgres@lgLabelFontHeightF = caseLabelsFontHeightF ; font height of legend case labels if (isatt(rOpts,"legendWidth")) then lgres@vpWidthF = rOpts@legendWidth else lgres@vpWidthF = 0.3 ; width of legend (NDC) end if lgres@lgLabelPosition = "Center" if (isatt(rOpts,"legendHeight")) then lgres@vpHeightF = rOpts@legendHeight else lgres@vpHeightF = 0.030*nCase ; height of legend (NDC) end if lgres@lgPerimOn = False ; turn off perimeter lbid = gsn_create_legend(wks,nCase," "+rOpts@caseLabels,lgres) amres = True amres@amParallelPosF = 0.28 amres@amOrthogonalPosF = -0.40 ;id rmm if (isatt(rOpts,"tdLegendOn").and.rOpts@tdLegendOn) then annoid3 = gsn_add_annotation(taylor,lbid,amres) ; add legend to plot end if end if ;id rmm var labels if (rOpts .and. isatt(rOpts,"varLabelsOn").and.rOpts@varLabelsOn) then if (rOpts .and. isatt(rOpts,"varLabels")) then nVar = dimsizes(rOpts@varLabels) if (isatt(rOpts,"varLabelsFontHeightF")) then varLabelsFontHeightF = rOpts@varLabelsFontHeightF else varLabelsFontHeightF = 0.013 end if txres = True txres@txFontHeightF = varLabelsFontHeightF txres@txJust = "CenterLeft" ; justify to the center left ;delta_y = 0.02 if (rOpts .and. isatt(rOpts,"varLabelsXloc")) then xs = rOpts@varLabelsXloc ; user specified else xs = 0.06 end if delta_y = 0.02 if (rOpts .and. isatt(rOpts,"varLabelsYloc")) then ys = rOpts@varLabelsYloc ; user specified else ys = max( (/nVar*delta_y , 0.30/) ) end if ; id rmm text changes do i = 1,nVar if (i.eq.1) then dum13 = new(nVar,graphic) end if ; id rmm txres@txFontColor = Colors(i-1) gsn_text_ndc(wks,rOpts@varLabels(i-1),xs,ys,txres) ; gsn_text_ndc(wks,i+" - "+rOpts@varLabels(i-1),xs,ys,txres) ; dum13(i-1) = gsn_add_text(wks,taylor,i+" - "+rOpts@varLabels(i-1), xs,ys,txres) ys = ys- delta_y end do ; taylor@$unique_string("dum")$ = dum13 end if end if ;print("============> taylor_diagram: Part 5 ") taylor@$unique_string("dum")$ = dum0 ; x-axis taylor@$unique_string("dum")$ = dum1 ; y-axis taylor@$unique_string("dum")$ = dum2 ; 1.0 std curve taylor@$unique_string("dum")$ = dum5 ; labels [COR] taylor@$unique_string("dum")$ = dum6 ; major tm [COR] taylor@$unique_string("dum")$ = dum7 ; minor tm taylor@$unique_string("dum")$ = dum10 ; markers taylor@$unique_string("dum")$ = dum11 ; best case markers ; taylor@$unique_string("dum")$ = dum12 ; case markers ; taylor@$unique_string("dum")$ = dum13 ; text ;print("============> taylor_diagram: Part 6 ") if (.not.isatt(rOpts,"taylorDraw") .or. \ (isatt(rOpts,"taylorDraw") .and. rOpts@taylorDraw)) then draw(taylor) end if ;print("============> taylor_diagram: Part 7 ") if (.not.isatt(rOpts,"taylorFrame") .or. \ (isatt(rOpts,"taylorFrame") .and. rOpts@taylorFrame)) then frame(wks) end if ;print("============> taylor_diagram: Part 8: Exit ") return(taylor) end