This turorial is for creating Taylor Diagram using UV-CDAT's VCS.

Taylor diagrams are mathematical diagrams designed to graphically indicate which of several approximate representations (or models) of a system, process, or phenomenon is most realistic. This diagram, invented by Karl E. Taylor in 1994 (published in 2001) facilitates the comparative assessment of different models. It is used to quantify the degree of correspondence between the modeled and observed behavior in terms of three statistics: the Pearson correlation coefficient, the root-mean-square error (RMSE) error, and the standard deviation. Taylor diagrams have widely been used to evaluate models designed to study climate and other aspects of Earthâ€™s environment. [See Wiki and Taylor (2001) for details]

Â© Software was developed by Charles Dutriaux and UVCDAT team, and tutorial was written by Charles Dutriaux and Jiwoo Lee. (18 Sep. 2017)

Used environment version in this tutorial:

- uvcdat 2.12
- vcs 2.12
- mesalib 17.2.0

In [1]:

```
import vcs
x = vcs.init()
```

In [2]:

```
# Create dummy 7 data
import MV2
corr = [.2, .5, .7, .85, .9, .95, .99]
std = [1.6, 1.7, 1.5, 1.2 , .8, .9, .98]
data = MV2.array(zip(std, corr))
data.id = "My Taylor Diagram Data"
print 'data:\n', data
print 'data shape:', data.shape
```

Plot the beginning version using VCS module. "vcs.createtaylordiagram" is for creating template.

In [3]:

```
taylor = vcs.createtaylordiagram()
x.plot(data,taylor)
```

Out[3]:

In [4]:

```
# Reference point
taylor.referencevalue=1.2
x.clear()
x.plot(data,taylor)
```

Out[4]:

In [5]:

```
# Markers attributes
ids = ["A1","A2","A3","B1","C1","C2","C3"]
id_sizes = [2., 1.5, 1.5, 1.5, 1.5, 1.5, 1.5,]
id_colors = ["red","orange","green","cyan","blue","purple","black"]
symbols = ["square","dot","circle","triangle_right","triangle_left","triangle_up","triangle_down"]
colors = ["red","orange","green","cyan","blue","purple","black"]
sizes = [2., .5, 2., 2., 2., 2., 2.,]
```

For text strings:

- ids: Data id. It could be model or dataset names
- id_sizes: Size of text string
- id_colors: Color of text string

For symbols:

- symbols: Shape of markers
- colors: Color of markers
- sizes: Size of markers

"id_colors" and "colors" do not need to be identical.

In [6]:

```
taylor = vcs.createtaylordiagram()
for i in range(len(data)):
taylor.addMarker(id=ids[i],
id_size=id_sizes[i],
id_color=id_colors[i],
symbol=symbols[i],
color=colors[i],
size=sizes[i])
x.clear()
x.plot(data,taylor)
```

Out[6]:

Adjust position of text string to avoid overlapping by using "xoffset" and "yoffset", which gives relative position from each of (x, y) points.

In [7]:

```
taylor = vcs.createtaylordiagram()
for i in range(len(data)):
taylor.addMarker(id=ids[i],
id_size=id_sizes[i],
id_color=id_colors[i],
symbol=symbols[i],
color=colors[i],
size=sizes[i],
xoffset=-2.5,
yoffset=2.5)
x.clear()
x.plot(data,taylor)
```

Out[7]:

In [8]:

```
# Other way to set marker attributes
taylor = vcs.createtaylordiagram()
taylor.Marker.id = ids
taylor.Marker.id_size = id_sizes
taylor.Marker.id_color = id_colors
taylor.Marker.symbol = symbols
taylor.Marker.color = colors
taylor.Marker.size = sizes
taylor.Marker.xoffset = [-2.5,]*len(data)
taylor.Marker.yoffset = [2.5]*len(data)
x.clear()
x.plot(data,taylor)
```

Out[8]:

In [9]:

```
taylor.Marker.line = ["tail","line","line","line","line","line","head"]
taylor.Marker.line_type = ["solid",]*len(data)
taylor.Marker.line_color = ["dark grey",]*len(data)
taylor.Marker.line_size = [5.,5.,5.,5.,5.,5.,5.]
x.clear()
x.plot(data,taylor)
```

Out[9]:

In [10]:

```
#let's split the line into 2 set of line with an empty marker in-between
# First line dashed
taylor.Marker.line = ['tail', 'line', 'head', None, 'tail', 'line', 'head']
taylor.Marker.line_type = ["dash","dash","dash","solid","solid","solid","solid"]
x.clear()
x.plot(data,taylor)
```

Out[10]:

In [11]:

```
# Legend postionment for 1 quadran
x.clear()
template = vcs.createtemplate(source="deftaylor")
template.legend.x1 = .5
template.legend.x2 = .6
template.legend.y1 = .2
template.legend.y2 = .65
template.legend.line = "black"
x.plot(data,taylor,template)
```

Out[11]:

(Top)

- You can add aditional isoline to show additional measure of skill.
- See Figure 10 and 11 of "Taylor 2001: Summarizing multiple aspects of model performance in a single diagram, Journal of Geophysical Research, 106(D7): 7183-7192", for details.

In [12]:

```
#Skill scrores
x.clear()
x.plot(data,taylor,skill=taylor.defaultSkillFunction)
```

Out[12]:

In [13]:

```
import numpy
def mySkill(s,r):
return (4*numpy.ma.power(1+r,4))/(numpy.power(s+1./s,2)*numpy.power(1+r*2.,4))
x.clear()
x.plot(data,taylor,skill=mySkill)
```

Out[13]:

(Top)

- When you have negative value for correlation you may want to expend your plot to the other side.
- See Figure 2 of "Taylor 2001: Summarizing multiple aspects of model performance in a single diagram, Journal of Geophysical Research, 106(D7): 7183-7192", for details.

In [14]:

```
# Negative correlation: Two quadrans
taylor.quadrans = 2 # default: 1
# Tweak input data to have negative number
data2 = data.copy()
data2[0,1] = -data2[0,1]
# Plot
x.clear()
x.plot(data2,taylor)
```

Out[14]:

In [15]:

```
taylor = vcs.createtaylordiagram()
taylor.list()
```