taylor¶
-
class
vcs.taylor.
Gtd
(name, source='default')[source]¶ The Taylor Diagram graphics method (Gtd) is used to plot Taylor diagrams on a VCS Canvas. Taylor diagrams provide a way of graphically summarizing how closely a pattern matches observations.
-
defaultSkillFunction
(s, R)[source]¶ Provides a default function for determining the skill with which a model predicts observations. This function may be used in the function parameter of
drawSkill()
, although it may be preferable to provide a custom function for determining skill, depending on the application.- Parameters
s (float) – A float representing the standard deviation of a model.
R (float) – A float representing the correlation of a model.
- Returns
The skill of a model, computed using this function.
- Return type
float
-
drawSkill
(canvas, values, function=None)[source]¶ Draw a skill score. Default skill score provided in
defaultSkillFunction()
from Karl taylor, see PCMDI report series 55 for more information on Taylor diagrams and skill .Note
The function parameter must be provided for drawSkill to work. The
defaultSkillFunction()
provided in this module can be used to provide a default skill score. Be aware that, as stated in PCMDI report series 55 section 5, it is not possible to define a single skill score that is appropriate for all models. It may be more suitable to create a custom function for determining the skill score of your model.- Parameters
canvas (vcs.Canvas.Canvas) – A VCS Canvas object on which to draw the skill score.
values (list/tuple) – A list/tuple used to specify the
levels
of anisoline
object.function (function) – A function for determining the skill score of a model.
-
getArc
(value, val1=0.0, val2=90.0, convert=True)[source]¶ Return coordinates to draw an arc from 0 to 90 degrees.
Note
val1 and val2 can be used to limit the arc (in degrees).
- Parameters
value (float) – The radius of the arc to be calculated.
val1 (float) – Lower limit of the arc to compute.
val2 (float) – Upper limit of the arc to compute.
convert (bool) – Boolean flag indicating whether
- Returns
The coordinates for the calculated arc.
- Return type
tuple
-
plot
(data, template='deftaylor', skill=None, bg=0, canvas=None)[source]¶ Plots an instance of a
Taylor diagram
on the provided VCS Canvas.- Parameters
data –
template (str/vcs.template.P) – A
VCS template
or a string name of a VCS template.skill –
bg (bool/int) – A boolean/integer flag indicating whether to plot this object in the background.
canvas (vcs.Canvas.Canvas) – A VCS Canvas object on which the diagram will be plotted.
-
script
(script_filename, mode='a')[source]¶ Saves out a copy of the taylordiagram graphics method, in JSON or Python format to a designated file.
Note
If the the filename has a ‘.py’ at the end, it will produce a Python script. If no extension is given, then by default a .json file containing a JSON serialization of the object’s data will be produced.
Warning
VCS Scripts Deprecated. SCR script files are no longer generated by this function.
- Example
1 2 3 4
>>> a=vcs.init() >>> ex=a.gettaylordiagram() >>> ex.script('filename.py') # append to 'filename.py' >>> ex.script('filename','w') # make/overwrite 'filename.json'
- Parameters
script_filename (str) – Output name of the script file. If no extension is specified, a .json object is created.
mode (str) – Either ‘w’ for replace, or ‘a’ for append. Defaults to ‘a’, if not specified.
-