Modified: websites/staging/climate/trunk/content/api/current/ocw/evaluation.html
==============================================================================
--- websites/staging/climate/trunk/content/api/current/ocw/evaluation.html
(original)
+++ websites/staging/climate/trunk/content/api/current/ocw/evaluation.html Mon
Apr 24 21:37:01 2017
@@ -6,7 +6,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Evaluation Module — Apache Open Climate Workbench 1.1.0
documentation</title>
+ <title>Evaluation Module — Apache Open Climate Workbench 1.2.0
documentation</title>
<link rel="stylesheet" href="../_static/alabaster.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
@@ -14,7 +14,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
- VERSION: '1.1.0',
+ VERSION: '1.2.0',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@@ -23,36 +23,20 @@
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
- <link rel="top" title="Apache Open Climate Workbench 1.1.0 documentation"
href="../index.html" />
+ <link rel="index" title="Index" href="../genindex.html" />
+ <link rel="search" title="Search" href="../search.html" />
+ <link rel="top" title="Apache Open Climate Workbench 1.2.0 documentation"
href="../index.html" />
<link rel="next" title="Metrics Module" href="metrics.html" />
<link rel="prev" title="Dataset Processor Module"
href="dataset_processor.html" />
+ <link rel="stylesheet" href="../_static/custom.css" type="text/css" />
- <meta name="viewport" content="width=device-width, initial-scale=0.9,
maximum-scale=0.9">
+
+ <meta name="viewport" content="width=device-width, initial-scale=0.9,
maximum-scale=0.9" />
</head>
<body role="document">
- <div class="related" role="navigation" aria-label="related navigation">
- <h3>Navigation</h3>
- <ul>
- <li class="right" style="margin-right: 10px">
- <a href="../genindex.html" title="General Index"
- accesskey="I">index</a></li>
- <li class="right" >
- <a href="../http-routingtable.html" title="HTTP Routing Table"
- >routing table</a> |</li>
- <li class="right" >
- <a href="../py-modindex.html" title="Python Module Index"
- >modules</a> |</li>
- <li class="right" >
- <a href="metrics.html" title="Metrics Module"
- accesskey="N">next</a> |</li>
- <li class="right" >
- <a href="dataset_processor.html" title="Dataset Processor Module"
- accesskey="P">previous</a> |</li>
- <li class="nav-item nav-item-0"><a href="../index.html">Apache Open
Climate Workbench 1.1.0 documentation</a> »</li>
- </ul>
- </div>
+
<div class="document">
<div class="documentwrapper">
@@ -65,13 +49,13 @@
<dt id="evaluation.Evaluation">
<em class="property">class </em><code
class="descclassname">evaluation.</code><code
class="descname">Evaluation</code><span
class="sig-paren">(</span><em>reference</em>, <em>targets</em>,
<em>metrics</em>, <em>subregions=None</em><span class="sig-paren">)</span><a
class="headerlink" href="#evaluation.Evaluation" title="Permalink to this
definition">¶</a></dt>
<dd><p>Container for running an evaluation</p>
-<p>An <em>Evaluation</em> is the running of one or more metrics on one or more
+<p>An <em>Evaluation</em> is the running of one or more metrics on one or more
target datasets and a (possibly optional) reference dataset. Evaluation
can handle two types of metrics, <code class="docutils literal"><span
class="pre">unary</span></code> and <code class="docutils literal"><span
class="pre">binary</span></code>. The validity
of an Evaluation is dependent upon the number and type of metrics as well
as the number of datasets.</p>
<p>A <code class="docutils literal"><span class="pre">unary</span></code>
metric is a metric that runs over a single dataset. If you add
-a <code class="docutils literal"><span class="pre">unary</span></code> metric
to the Evaluation you are only required to add a
+a <code class="docutils literal"><span class="pre">unary</span></code> metric
to the Evaluation you are only required to add a
reference dataset or a target dataset. If there are multiple datasets
in the evaluation then the <code class="docutils literal"><span
class="pre">unary</span></code> metric is run over all of them.</p>
<p>A <code class="docutils literal"><span class="pre">binary</span></code>
metric is a metric that runs over a reference dataset and
@@ -87,11 +71,11 @@ Evaluation.</p>
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td
class="field-body"><ul class="first simple">
<li><strong>reference</strong> (<a class="reference internal"
href="dataset.html#dataset.Dataset" title="dataset.Dataset"><code class="xref
py py-class docutils literal"><span
class="pre">dataset.Dataset</span></code></a>) – The reference Dataset
for the evaluation.</li>
-<li><strong>targets</strong> (<a class="reference external"
href="http://docs.python.org/2/library/functions.html#list" title="(in Python
v2.7)"><code class="xref py py-class docutils literal"><span
class="pre">list</span></code></a> of <a class="reference internal"
href="dataset.html#dataset.Dataset" title="dataset.Dataset"><code class="xref
py py-class docutils literal"><span
class="pre">dataset.Dataset</span></code></a>) – A list of one or more
target datasets for the
+<li><strong>targets</strong> (<a class="reference external"
href="https://docs.python.org/2/library/functions.html#list" title="(in Python
v2.7)"><code class="xref py py-class docutils literal"><span
class="pre">list</span></code></a> of <a class="reference internal"
href="dataset.html#dataset.Dataset" title="dataset.Dataset"><code class="xref
py py-class docutils literal"><span
class="pre">dataset.Dataset</span></code></a>) – A list of one or more
target datasets for the
evaluation.</li>
-<li><strong>metrics</strong> (<a class="reference external"
href="http://docs.python.org/2/library/functions.html#list" title="(in Python
v2.7)"><code class="xref py py-class docutils literal"><span
class="pre">list</span></code></a> of <a class="reference internal"
href="metrics.html#module-metrics" title="metrics"><code class="xref py py-mod
docutils literal"><span class="pre">metrics</span></code></a>) – A list
of one or more Metric instances to run
+<li><strong>metrics</strong> (<a class="reference external"
href="https://docs.python.org/2/library/functions.html#list" title="(in Python
v2.7)"><code class="xref py py-class docutils literal"><span
class="pre">list</span></code></a> of <a class="reference internal"
href="metrics.html#module-metrics" title="metrics"><code class="xref py py-mod
docutils literal"><span class="pre">metrics</span></code></a>) – A list
of one or more Metric instances to run
in the evaluation.</li>
-<li><strong>subregions</strong> (<a class="reference external"
href="http://docs.python.org/2/library/functions.html#list" title="(in Python
v2.7)"><code class="xref py py-class docutils literal"><span
class="pre">list</span></code></a> of <a class="reference internal"
href="dataset.html#dataset.Bounds" title="dataset.Bounds"><code class="xref py
py-class docutils literal"><span class="pre">dataset.Bounds</span></code></a>)
– (Optional) Subregion information to use in the
+<li><strong>subregions</strong> (<a class="reference external"
href="https://docs.python.org/2/library/functions.html#list" title="(in Python
v2.7)"><code class="xref py py-class docutils literal"><span
class="pre">list</span></code></a> of <a class="reference internal"
href="dataset.html#dataset.Bounds" title="dataset.Bounds"><code class="xref py
py-class docutils literal"><span class="pre">dataset.Bounds</span></code></a>)
– (Optional) Subregion information to use in the
evaluation. A subregion is specified with a Bounds object.</li>
</ul>
</td>
@@ -105,7 +89,7 @@ evaluation. A subregion is specified wit
<dt id="evaluation.Evaluation.add_dataset">
<code class="descname">add_dataset</code><span
class="sig-paren">(</span><em>target_dataset</em><span
class="sig-paren">)</span><a class="headerlink"
href="#evaluation.Evaluation.add_dataset" title="Permalink to this
definition">¶</a></dt>
<dd><p>Add a Dataset to the Evaluation.</p>
-<p>A target Dataset is compared against the reference dataset when the
+<p>A target Dataset is compared against the reference dataset when the
Evaluation is run with one or more metrics.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
@@ -113,8 +97,7 @@ Evaluation is run with one or more metri
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td
class="field-body"><strong>target_dataset</strong> (<a class="reference
internal" href="dataset.html#dataset.Dataset" title="dataset.Dataset"><code
class="xref py py-class docutils literal"><span
class="pre">dataset.Dataset</span></code></a>) – The target Dataset to
add to the Evaluation.</td>
</tr>
-<tr class="field-even field"><th class="field-name" colspan="2">Raises
ValueError:</th></tr>
-<tr class="field-even field"><td> </td><td class="field-body">If a
dataset to add isn’t an instance of Dataset.</td>
+<tr class="field-even field"><th class="field-name">Raises:</th><td
class="field-body"><strong>ValueError</strong> – If a dataset to add
isn’t an instance of Dataset.</td>
</tr>
</tbody>
</table>
@@ -128,11 +111,10 @@ Evaluation is run with one or more metri
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
-<tr class="field-odd field"><th class="field-name">Parameters:</th><td
class="field-body"><strong>target_datasets</strong> (<a class="reference
external" href="http://docs.python.org/2/library/functions.html#list"
title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span
class="pre">list</span></code></a> of <a class="reference internal"
href="dataset.html#dataset.Dataset" title="dataset.Dataset"><code class="xref
py py-class docutils literal"><span
class="pre">dataset.Dataset</span></code></a>) – The list of datasets
that should be added to
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td
class="field-body"><strong>target_datasets</strong> (<a class="reference
external" href="https://docs.python.org/2/library/functions.html#list"
title="(in Python v2.7)"><code class="xref py py-class docutils literal"><span
class="pre">list</span></code></a> of <a class="reference internal"
href="dataset.html#dataset.Dataset" title="dataset.Dataset"><code class="xref
py py-class docutils literal"><span
class="pre">dataset.Dataset</span></code></a>) – The list of datasets
that should be added to
the Evaluation.</td>
</tr>
-<tr class="field-even field"><th class="field-name" colspan="2">Raises
ValueError:</th></tr>
-<tr class="field-even field"><td> </td><td class="field-body">If a
dataset to add isn’t an instance of Dataset.</td>
+<tr class="field-even field"><th class="field-name">Raises:</th><td
class="field-body"><strong>ValueError</strong> – If a dataset to add
isn’t an instance of Dataset.</td>
</tr>
</tbody>
</table>
@@ -149,8 +131,7 @@ the Evaluation.</td>
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td
class="field-body"><strong>metric</strong> (<a class="reference internal"
href="metrics.html#module-metrics" title="metrics"><code class="xref py py-mod
docutils literal"><span class="pre">metrics</span></code></a>) – The
metric instance to add to the Evaluation.</td>
</tr>
-<tr class="field-even field"><th class="field-name" colspan="2">Raises
ValueError:</th></tr>
-<tr class="field-even field"><td> </td><td class="field-body">If the
metric to add isn’t a class that inherits
+<tr class="field-even field"><th class="field-name">Raises:</th><td
class="field-body"><strong>ValueError</strong> – If the metric to add
isn’t a class that inherits
from metrics.Metric.</td>
</tr>
</tbody>
@@ -166,10 +147,9 @@ from metrics.Metric.</td>
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
-<tr class="field-odd field"><th class="field-name">Parameters:</th><td
class="field-body"><strong>metrics</strong> (<a class="reference external"
href="http://docs.python.org/2/library/functions.html#list" title="(in Python
v2.7)"><code class="xref py py-class docutils literal"><span
class="pre">list</span></code></a> of <a class="reference internal"
href="metrics.html#module-metrics" title="metrics"><code class="xref py py-mod
docutils literal"><span class="pre">metrics</span></code></a>) – The list
of metric instances to add to the Evaluation.</td>
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td
class="field-body"><strong>metrics</strong> (<a class="reference external"
href="https://docs.python.org/2/library/functions.html#list" title="(in Python
v2.7)"><code class="xref py py-class docutils literal"><span
class="pre">list</span></code></a> of <a class="reference internal"
href="metrics.html#module-metrics" title="metrics"><code class="xref py py-mod
docutils literal"><span class="pre">metrics</span></code></a>) – The list
of metric instances to add to the Evaluation.</td>
</tr>
-<tr class="field-even field"><th class="field-name" colspan="2">Raises
ValueError:</th></tr>
-<tr class="field-even field"><td> </td><td class="field-body">If a metric
to add isn’t a class that inherits
+<tr class="field-even field"><th class="field-name">Raises:</th><td
class="field-body"><strong>ValueError</strong> – If a metric to add
isn’t a class that inherits
from metrics.Metric.</td>
</tr>
</tbody>
@@ -242,13 +222,15 @@ evaluations. The shape of unary_results
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="../index.html">
<img class="logo"
src="../_static/ocw-logo-variant-sm-01-01-new.png" alt="Logo"/>
- </a></p>
- <h4>Previous topic</h4>
- <p class="topless"><a href="dataset_processor.html"
- title="previous chapter">Dataset Processor
Module</a></p>
- <h4>Next topic</h4>
- <p class="topless"><a href="metrics.html"
- title="next chapter">Metrics Module</a></p>
+ </a></p><div class="relations">
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="../index.html">Documentation overview</a><ul>
+ <li>Previous: <a href="dataset_processor.html" title="previous
chapter">Dataset Processor Module</a></li>
+ <li>Next: <a href="metrics.html" title="next chapter">Metrics
Module</a></li>
+ </ul></li>
+</ul>
+</div>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
@@ -259,14 +241,11 @@ evaluations. The shape of unary_results
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
- <input type="text" name="q" />
- <input type="submit" value="Go" />
+ <div><input type="text" name="q" /></div>
+ <div><input type="submit" value="Go" /></div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
- <p class="searchtip" style="font-size: 90%">
- Enter search terms or a module, class or function name.
- </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
@@ -277,12 +256,12 @@ evaluations. The shape of unary_results
©2016, Apache Software Foundation.
|
- Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
- & <a href="https://github.com/bitprophet/alabaster">Alabaster
0.7.4</a>
+ Powered by <a href="http://sphinx-doc.org/">Sphinx 1.4.8</a>
+ & <a href="https://github.com/bitprophet/alabaster">Alabaster
0.7.9</a>
|
<a href="../_sources/ocw/evaluation.txt"
- rel="nofollow">Page source</a></li>
+ rel="nofollow">Page source</a>
</div>
Modified: websites/staging/climate/trunk/content/api/current/ocw/metrics.html
==============================================================================
--- websites/staging/climate/trunk/content/api/current/ocw/metrics.html
(original)
+++ websites/staging/climate/trunk/content/api/current/ocw/metrics.html Mon Apr
24 21:37:01 2017
@@ -6,7 +6,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Metrics Module — Apache Open Climate Workbench 1.1.0
documentation</title>
+ <title>Metrics Module — Apache Open Climate Workbench 1.2.0
documentation</title>
<link rel="stylesheet" href="../_static/alabaster.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
@@ -14,7 +14,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
- VERSION: '1.1.0',
+ VERSION: '1.2.0',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@@ -23,36 +23,20 @@
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
- <link rel="top" title="Apache Open Climate Workbench 1.1.0 documentation"
href="../index.html" />
+ <link rel="index" title="Index" href="../genindex.html" />
+ <link rel="search" title="Search" href="../search.html" />
+ <link rel="top" title="Apache Open Climate Workbench 1.2.0 documentation"
href="../index.html" />
<link rel="next" title="Plotter Module" href="plotter.html" />
<link rel="prev" title="Evaluation Module" href="evaluation.html" />
+ <link rel="stylesheet" href="../_static/custom.css" type="text/css" />
- <meta name="viewport" content="width=device-width, initial-scale=0.9,
maximum-scale=0.9">
+
+ <meta name="viewport" content="width=device-width, initial-scale=0.9,
maximum-scale=0.9" />
</head>
<body role="document">
- <div class="related" role="navigation" aria-label="related navigation">
- <h3>Navigation</h3>
- <ul>
- <li class="right" style="margin-right: 10px">
- <a href="../genindex.html" title="General Index"
- accesskey="I">index</a></li>
- <li class="right" >
- <a href="../http-routingtable.html" title="HTTP Routing Table"
- >routing table</a> |</li>
- <li class="right" >
- <a href="../py-modindex.html" title="Python Module Index"
- >modules</a> |</li>
- <li class="right" >
- <a href="plotter.html" title="Plotter Module"
- accesskey="N">next</a> |</li>
- <li class="right" >
- <a href="evaluation.html" title="Evaluation Module"
- accesskey="P">previous</a> |</li>
- <li class="nav-item nav-item-0"><a href="../index.html">Apache Open
Climate Workbench 1.1.0 documentation</a> »</li>
- </ul>
- </div>
+
<div class="document">
<div class="documentwrapper">
@@ -91,7 +75,7 @@ reference dataset in this metric run.</l
<tr class="field-even field"><th class="field-name">Returns:</th><td
class="field-body"><p class="first">The difference between the reference and
target datasets.</p>
</td>
</tr>
-<tr class="field-odd field"><th class="field-name">Return type:</th><td
class="field-body"><p class="first last"><a class="reference external"
href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray"
title="(in NumPy v1.11)"><code class="xref py py-class docutils literal"><span
class="pre">numpy.ndarray</span></code></a></p>
+<tr class="field-odd field"><th class="field-name">Return type:</th><td
class="field-body"><p class="first last"><a class="reference external"
href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html#numpy.ndarray"
title="(in NumPy v1.12)"><code class="xref py py-class docutils literal"><span
class="pre">numpy.ndarray</span></code></a></p>
</td>
</tr>
</tbody>
@@ -404,9 +388,9 @@ be run.</td>
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td
class="field-body"><ul class="first simple">
-<li><strong>target_array</strong>
(<em>:class:’numpy.ma.core.MaskedArray’</em>) – an array to
be evaluated, as model output</li>
-<li><strong>reference_array</strong>
(<em>:class:’numpy.ma.core.MaskedArray’</em>) – an array of
reference dataset</li>
-<li><strong>average_over_time</strong> (<em>‘bool’</em>) –
if True, calculated bias is averaged for the axis=0</li>
+<li><strong>target_array</strong>
(<em>:class:'numpy.ma.core.MaskedArray'</em>) – an array to be evaluated,
as model output</li>
+<li><strong>reference_array</strong>
(<em>:class:'numpy.ma.core.MaskedArray'</em>) – an array of reference
dataset</li>
+<li><strong>average_over_time</strong> (<em>'bool'</em>) – if True,
calculated bias is averaged for the axis=0</li>
</ul>
</td>
</tr>
@@ -429,8 +413,8 @@ be run.</td>
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td
class="field-body"><ul class="first simple">
-<li><strong>target_array</strong>
(<em>:class:’numpy.ma.core.MaskedArray’</em>) – an array to
be evaluated, as model output</li>
-<li><strong>reference_array</strong>
(<em>:class:’numpy.ma.core.MaskedArray’</em>) – an array of
reference dataset</li>
+<li><strong>target_array</strong>
(<em>:class:'numpy.ma.core.MaskedArray'</em>) – an array to be evaluated,
as model output</li>
+<li><strong>reference_array</strong>
(<em>:class:'numpy.ma.core.MaskedArray'</em>) – an array of reference
dataset</li>
</ul>
</td>
</tr>
@@ -445,6 +429,30 @@ be run.</td>
</dd></dl>
<dl class="function">
+<dt id="metrics.calc_histogram_overlap">
+<code class="descclassname">metrics.</code><code
class="descname">calc_histogram_overlap</code><span
class="sig-paren">(</span><em>hist1</em>, <em>hist2</em><span
class="sig-paren">)</span><a class="headerlink"
href="#metrics.calc_histogram_overlap" title="Permalink to this
definition">¶</a></dt>
+<dd><p>from Lee et al. (2014)
+:param hist1: a histogram array
+:type hist1: :class:’numpy.ndarray’
+:param hist2: a histogram array with the same size as hist1
+:type hist2: :class:’numpy.ndarray’</p>
+</dd></dl>
+
+<dl class="function">
+<dt id="metrics.calc_joint_histogram">
+<code class="descclassname">metrics.</code><code
class="descname">calc_joint_histogram</code><span
class="sig-paren">(</span><em>data_array1</em>, <em>data_array2</em>,
<em>bins_for_data1</em>, <em>bins_for_data2</em><span
class="sig-paren">)</span><a class="headerlink"
href="#metrics.calc_joint_histogram" title="Permalink to this
definition">¶</a></dt>
+<dd><p>Calculate a joint histogram of two variables in data_array1 and
data_array2
+:param data_array1: the first variable
+:type data_array1: :class:’numpy.ma.core.MaskedArray’
+:param data_array2: the second variable
+:type data_array2: :class:’numpy.ma.core.MaskedArray’
+:param bins_for_data1: histogram bin edges for data_array1
+:type bins_for_data1: :class:’numpy.ndarray’
+:param bins_for_data2: histogram bin edges for data_array2
+:type bins_for_data2: :class:’numpy.ndarray’</p>
+</dd></dl>
+
+<dl class="function">
<dt id="metrics.calc_rmse">
<code class="descclassname">metrics.</code><code
class="descname">calc_rmse</code><span
class="sig-paren">(</span><em>target_array</em>, <em>reference_array</em><span
class="sig-paren">)</span><a class="headerlink" href="#metrics.calc_rmse"
title="Permalink to this definition">¶</a></dt>
<dd><p>Calculate ratio of standard deivations of the two arrays</p>
@@ -453,9 +461,9 @@ be run.</td>
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td
class="field-body"><ul class="first simple">
-<li><strong>target_array</strong>
(<em>:class:’numpy.ma.core.MaskedArray’</em>) – an array to
be evaluated, as model output</li>
-<li><strong>reference_array</strong>
(<em>:class:’numpy.ma.core.MaskedArray’</em>) – an array of
reference dataset</li>
-<li><strong>average_over_time</strong> (<em>‘bool’</em>) –
if True, calculated bias is averaged for the axis=0</li>
+<li><strong>target_array</strong>
(<em>:class:'numpy.ma.core.MaskedArray'</em>) – an array to be evaluated,
as model output</li>
+<li><strong>reference_array</strong>
(<em>:class:'numpy.ma.core.MaskedArray'</em>) – an array of reference
dataset</li>
+<li><strong>average_over_time</strong> (<em>'bool'</em>) – if True,
calculated bias is averaged for the axis=0</li>
</ul>
</td>
</tr>
@@ -478,8 +486,8 @@ be run.</td>
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td
class="field-body"><ul class="first simple">
-<li><strong>array</strong>
(<em>:class:’numpy.ma.core.MaskedArray’</em>) – an array to
calculate sample standard deviation</li>
-<li><strong>axis</strong> (<em>‘int’</em>) – Axis along
which the sample standard deviation is computed.</li>
+<li><strong>array</strong> (<em>:class:'numpy.ma.core.MaskedArray'</em>)
– an array to calculate sample standard deviation</li>
+<li><strong>axis</strong> (<em>'int'</em>) – Axis along which the sample
standard deviation is computed.</li>
</ul>
</td>
</tr>
@@ -502,9 +510,9 @@ be run.</td>
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td
class="field-body"><ul class="first simple">
-<li><strong>target_array</strong>
(<em>:class:’numpy.ma.core.MaskedArray’</em>) – an array to
be evaluated, as model output</li>
-<li><strong>reference_array</strong>
(<em>:class:’numpy.ma.core.MaskedArray’</em>) – an array of
reference dataset</li>
-<li><strong>average_over_time</strong> (<em>‘bool’</em>) –
if True, calculated bias is averaged for the axis=0</li>
+<li><strong>target_array</strong>
(<em>:class:'numpy.ma.core.MaskedArray'</em>) – an array to be evaluated,
as model output</li>
+<li><strong>reference_array</strong>
(<em>:class:'numpy.ma.core.MaskedArray'</em>) – an array of reference
dataset</li>
+<li><strong>average_over_time</strong> (<em>'bool'</em>) – if True,
calculated bias is averaged for the axis=0</li>
</ul>
</td>
</tr>
@@ -518,6 +526,26 @@ be run.</td>
</table>
</dd></dl>
+<dl class="function">
+<dt id="metrics.wet_spell_analysis">
+<code class="descclassname">metrics.</code><code
class="descname">wet_spell_analysis</code><span
class="sig-paren">(</span><em>reference_array</em>, <em>threshold=0.1</em>,
<em>nyear=1</em>, <em>dt=3.0</em><span class="sig-paren">)</span><a
class="headerlink" href="#metrics.wet_spell_analysis" title="Permalink to this
definition">¶</a></dt>
+<dd><p>Characterize wet spells using sub-daily (hourly) data</p>
+<table class="docutils field-list" frame="void" rules="none">
+<col class="field-name" />
+<col class="field-body" />
+<tbody valign="top">
+<tr class="field-odd field"><th class="field-name">Parameters:</th><td
class="field-body"><ul class="first last simple">
+<li><strong>reference_array</strong>
(<em>:class:'numpy.ma.core.MaskedArray'</em>) – an array to be
analyzed</li>
+<li><strong>threshold</strong> (<em>'float'</em>) – the minimum amount
of rainfall [mm/hour]</li>
+<li><strong>nyear</strong> (<em>'int'</em>) – the number of discontinous
periods</li>
+<li><strong>dt</strong> (<em>'float'</em>) – the temporal resolution of
reference_array</li>
+</ul>
+</td>
+</tr>
+</tbody>
+</table>
+</dd></dl>
+
</div>
@@ -528,13 +556,15 @@ be run.</td>
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="../index.html">
<img class="logo"
src="../_static/ocw-logo-variant-sm-01-01-new.png" alt="Logo"/>
- </a></p>
- <h4>Previous topic</h4>
- <p class="topless"><a href="evaluation.html"
- title="previous chapter">Evaluation Module</a></p>
- <h4>Next topic</h4>
- <p class="topless"><a href="plotter.html"
- title="next chapter">Plotter Module</a></p>
+ </a></p><div class="relations">
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="../index.html">Documentation overview</a><ul>
+ <li>Previous: <a href="evaluation.html" title="previous
chapter">Evaluation Module</a></li>
+ <li>Next: <a href="plotter.html" title="next chapter">Plotter
Module</a></li>
+ </ul></li>
+</ul>
+</div>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
@@ -545,14 +575,11 @@ be run.</td>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
- <input type="text" name="q" />
- <input type="submit" value="Go" />
+ <div><input type="text" name="q" /></div>
+ <div><input type="submit" value="Go" /></div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
- <p class="searchtip" style="font-size: 90%">
- Enter search terms or a module, class or function name.
- </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
@@ -563,12 +590,12 @@ be run.</td>
©2016, Apache Software Foundation.
|
- Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
- & <a href="https://github.com/bitprophet/alabaster">Alabaster
0.7.4</a>
+ Powered by <a href="http://sphinx-doc.org/">Sphinx 1.4.8</a>
+ & <a href="https://github.com/bitprophet/alabaster">Alabaster
0.7.9</a>
|
<a href="../_sources/ocw/metrics.txt"
- rel="nofollow">Page source</a></li>
+ rel="nofollow">Page source</a>
</div>
Modified: websites/staging/climate/trunk/content/api/current/ocw/overview.html
==============================================================================
--- websites/staging/climate/trunk/content/api/current/ocw/overview.html
(original)
+++ websites/staging/climate/trunk/content/api/current/ocw/overview.html Mon
Apr 24 21:37:01 2017
@@ -6,7 +6,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Overview — Apache Open Climate Workbench 1.1.0
documentation</title>
+ <title>Overview — Apache Open Climate Workbench 1.2.0
documentation</title>
<link rel="stylesheet" href="../_static/alabaster.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
@@ -14,7 +14,7 @@
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
- VERSION: '1.1.0',
+ VERSION: '1.2.0',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
@@ -23,36 +23,20 @@
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
- <link rel="top" title="Apache Open Climate Workbench 1.1.0 documentation"
href="../index.html" />
+ <link rel="index" title="Index" href="../genindex.html" />
+ <link rel="search" title="Search" href="../search.html" />
+ <link rel="top" title="Apache Open Climate Workbench 1.2.0 documentation"
href="../index.html" />
<link rel="next" title="Dataset Module" href="dataset.html" />
<link rel="prev" title="Welcome to Apache Open Climate Workbenchâs
documentation!" href="../index.html" />
+ <link rel="stylesheet" href="../_static/custom.css" type="text/css" />
- <meta name="viewport" content="width=device-width, initial-scale=0.9,
maximum-scale=0.9">
+
+ <meta name="viewport" content="width=device-width, initial-scale=0.9,
maximum-scale=0.9" />
</head>
<body role="document">
- <div class="related" role="navigation" aria-label="related navigation">
- <h3>Navigation</h3>
- <ul>
- <li class="right" style="margin-right: 10px">
- <a href="../genindex.html" title="General Index"
- accesskey="I">index</a></li>
- <li class="right" >
- <a href="../http-routingtable.html" title="HTTP Routing Table"
- >routing table</a> |</li>
- <li class="right" >
- <a href="../py-modindex.html" title="Python Module Index"
- >modules</a> |</li>
- <li class="right" >
- <a href="dataset.html" title="Dataset Module"
- accesskey="N">next</a> |</li>
- <li class="right" >
- <a href="../index.html" title="Welcome to Apache Open Climate
Workbenchâs documentation!"
- accesskey="P">previous</a> |</li>
- <li class="nav-item nav-item-0"><a href="../index.html">Apache Open
Climate Workbench 1.1.0 documentation</a> »</li>
- </ul>
- </div>
+
<div class="document">
<div class="documentwrapper">
@@ -71,15 +55,15 @@
</ol>
<div class="section" id="common-data-abstraction">
<h2>Common Data Abstraction<a class="headerlink"
href="#common-data-abstraction" title="Permalink to this headline">¶</a></h2>
-<p>The OCW <a class="reference internal" href="dataset.html#dataset.Dataset"
title="dataset.Dataset"><code class="xref py py-class docutils literal"><span
class="pre">dataset.Dataset</span></code></a> class is the primary data
abstraction used throughout OCW. It facilitates the uniform handling of data
throughout the toolkit and provides a few useful helper functions such as <a
class="reference internal"
href="dataset.html#dataset.Dataset.spatial_boundaries"
title="dataset.Dataset.spatial_boundaries"><code class="xref py py-func
docutils literal"><span
class="pre">dataset.Dataset.spatial_boundaries()</span></code></a> and <a
class="reference internal" href="dataset.html#dataset.Dataset.time_range"
title="dataset.Dataset.time_range"><code class="xref py py-func docutils
literal"><span class="pre">dataset.Dataset.time_range()</span></code></a>.
Creating a new dataset object is straightforward but generally you will want to
use an OCW data source to load the data for you.</p>
+<p>The OCW <a class="reference internal" href="dataset.html#dataset.Dataset"
title="dataset.Dataset"><code class="xref py py-class docutils literal"><span
class="pre">dataset.Dataset</span></code></a> class is the primary data
abstraction used throughout OCW. It facilitates the uniform handling of data
throughout the toolkit and provides a few useful helper functions such as <a
class="reference internal"
href="dataset.html#dataset.Dataset.spatial_boundaries"
title="dataset.Dataset.spatial_boundaries"><code class="xref py py-func
docutils literal"><span
class="pre">dataset.Dataset.spatial_boundaries()</span></code></a> and <a
class="reference internal"
href="dataset.html#dataset.Dataset.temporal_boundaries"
title="dataset.Dataset.temporal_boundaries"><code class="xref py py-func
docutils literal"><span
class="pre">dataset.Dataset.temporal_boundaries()</span></code></a>. Creating a
new dataset object is straightforward but generally you will want to use an OCW
data source to load the
data for you.</p>
</div>
<div class="section" id="data-sources">
<h2>Data Sources<a class="headerlink" href="#data-sources" title="Permalink to
this headline">¶</a></h2>
-<p>OCW data sources allow users to easily load <a class="reference internal"
href="dataset.html#dataset.Dataset" title="dataset.Dataset"><code class="xref
py py-class docutils literal"><span
class="pre">dataset.Dataset</span></code></a> objects from a number of places.
These data sources help with step 1 of an evaluation above. In general the
primary file format that is supported is NetCDF. For instance, the <a
class="reference internal" href="../data_source/data_sources.html#module-local"
title="local"><code class="xref py py-mod docutils literal"><span
class="pre">local</span></code></a>, <a class="reference internal"
href="../data_source/data_sources.html#module-dap" title="dap"><code
class="xref py py-mod docutils literal"><span class="pre">dap</span></code></a>
and <a class="reference internal"
href="../data_source/data_sources.html#module-esgf" title="esgf"><code
class="xref py py-mod docutils literal"><span
class="pre">esgf</span></code></a> data sources only support loading
NetCDF files from your local machine, an OpenDAP URL, and the ESGF
respectively. Some data sources, such as <a class="reference internal"
href="../data_source/data_sources.html#module-rcmed" title="rcmed"><code
class="xref py py-mod docutils literal"><span
class="pre">rcmed</span></code></a>, point to externally supported data
sources. In the case of the RCMED data source, the Regional Climate Model
Evaluation Database is run by NASA’s Jet Propulsion Laboratory.</p>
+<p>OCW data sources allow users to easily load <a class="reference internal"
href="dataset.html#dataset.Dataset" title="dataset.Dataset"><code class="xref
py py-class docutils literal"><span
class="pre">dataset.Dataset</span></code></a> objects from a number of places.
These data sources help with step 1 of an evaluation above. In general the
primary file format that is supported is NetCDF. For instance, the <a
class="reference internal" href="../data_source/data_sources.html#module-local"
title="local"><code class="xref py py-mod docutils literal"><span
class="pre">local</span></code></a>, <code class="xref py py-mod docutils
literal"><span class="pre">dap</span></code> and <code class="xref py py-mod
docutils literal"><span class="pre">esgf</span></code> data sources only
support loading NetCDF files from your local machine, an OpenDAP URL, and the
ESGF respectively. Some data sources, such as <a class="reference internal"
href="../data_source/data_sources.html#module-rcmed" title
="rcmed"><code class="xref py py-mod docutils literal"><span
class="pre">rcmed</span></code></a>, point to externally supported data
sources. In the case of the RCMED data source, the Regional Climate Model
Evaluation Database is run by NASA’s Jet Propulsion Laboratory.</p>
<p>Adding additional data sources is quite simple. The only API limitation
that we have on a data source is that it returns a valid <a class="reference
internal" href="dataset.html#dataset.Dataset" title="dataset.Dataset"><code
class="xref py py-class docutils literal"><span
class="pre">dataset.Dataset</span></code></a> object. Please feel free to send
patches for adding more data sources.</p>
<p>A simple example using the <a class="reference internal"
href="../data_source/data_sources.html#module-local" title="local"><code
class="xref py py-mod docutils literal"><span
class="pre">local</span></code></a> data source to load a NetCDF file from your
local machine:</p>
-<div class="highlight-python"><div class="highlight"><pre><span
class="gp">>>> </span><span class="kn">import</span> <span
class="nn">ocw.data_source.local</span> <span class="kn">as</span> <span
class="nn">local</span>
-<span class="gp">>>> </span><span class="n">ds</span> <span
class="o">=</span> <span class="n">local</span><span class="o">.</span><span
class="n">load_file</span><span class="p">(</span><span
class="s">'/tmp/some_dataset.nc'</span><span class="p">,</span> <span
class="s">'SomeVarInTheDataset'</span><span class="p">)</span>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span
class="gp">>>> </span><span class="kn">import</span> <span
class="nn">ocw.data_source.local</span> <span class="k">as</span> <span
class="nn">local</span>
+<span class="gp">>>> </span><span class="n">ds</span> <span
class="o">=</span> <span class="n">local</span><span class="o">.</span><span
class="n">load_file</span><span class="p">(</span><span
class="s1">'/tmp/some_dataset.nc'</span><span class="p">,</span> <span
class="s1">'SomeVarInTheDataset'</span><span class="p">)</span>
</pre></div>
</div>
</div>
@@ -87,17 +71,17 @@
<h2>Dataset Manipulations<a class="headerlink" href="#dataset-manipulations"
title="Permalink to this headline">¶</a></h2>
<p>All <a class="reference internal" href="dataset.html#dataset.Dataset"
title="dataset.Dataset"><code class="xref py py-class docutils literal"><span
class="pre">dataset.Dataset</span></code></a> manipulations are handled by the
<a class="reference internal"
href="dataset_processor.html#module-dataset_processor"
title="dataset_processor"><code class="xref py py-mod docutils literal"><span
class="pre">dataset_processor</span></code></a> module. In general, an
evaluation will include calls to <a class="reference internal"
href="dataset_processor.html#dataset_processor.subset"
title="dataset_processor.subset"><code class="xref py py-func docutils
literal"><span class="pre">dataset_processor.subset()</span></code></a>, <a
class="reference internal"
href="dataset_processor.html#dataset_processor.spatial_regrid"
title="dataset_processor.spatial_regrid"><code class="xref py py-func docutils
literal"><span
class="pre">dataset_processor.spatial_regrid()</span></code></a>, and <a
class="refe
rence internal" href="dataset_processor.html#dataset_processor.temporal_rebin"
title="dataset_processor.temporal_rebin"><code class="xref py py-func docutils
literal"><span class="pre">dataset_processor.temporal_rebin()</span></code></a>
to ensure that the datasets can actually be compared. <a class="reference
internal" href="dataset_processor.html#module-dataset_processor"
title="dataset_processor"><code class="xref py py-mod docutils literal"><span
class="pre">dataset_processor</span></code></a> functions take a <a
class="reference internal" href="dataset.html#dataset.Dataset"
title="dataset.Dataset"><code class="xref py py-class docutils literal"><span
class="pre">dataset.Dataset</span></code></a> object and some various
parameters and return a modified <a class="reference internal"
href="dataset.html#dataset.Dataset" title="dataset.Dataset"><code class="xref
py py-class docutils literal"><span
class="pre">dataset.Dataset</span></code></a> object. The original dataset is
never ma
nipulated in the process.</p>
<p>Subsetting is a great way to speed up your processing and keep useless data
out of your plots. Notice that we’re using a <a class="reference
internal" href="dataset.html#dataset.Bounds" title="dataset.Bounds"><code
class="xref py py-class docutils literal"><span
class="pre">dataset.Bounds</span></code></a> objec to represent the area of
interest:</p>
-<div class="highlight-python"><div class="highlight"><pre><span
class="gp">>>> </span><span class="kn">import</span> <span
class="nn">ocw.dataset_processor</span> <span class="kn">as</span> <span
class="nn">dsp</span>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span
class="gp">>>> </span><span class="kn">import</span> <span
class="nn">ocw.dataset_processor</span> <span class="k">as</span> <span
class="nn">dsp</span>
<span class="gp">>>> </span><span class="n">new_bounds</span> <span
class="o">=</span> <span class="n">Bounds</span><span class="p">(</span><span
class="n">min_lat</span><span class="p">,</span> <span
class="n">max_lat</span><span class="p">,</span> <span
class="n">min_lon</span><span class="p">,</span> <span
class="n">max_lon</span><span class="p">,</span> <span
class="n">start_time</span><span class="p">,</span> <span
class="n">end_time</span><span class="p">)</span>
-<span class="gp">>>> </span><span class="n">knmi_dataset</span> <span
class="o">=</span> <span class="n">dsp</span><span class="o">.</span><span
class="n">subset</span><span class="p">(</span><span
class="n">new_bounds</span><span class="p">,</span> <span
class="n">knmi_dataset</span><span class="p">)</span>
+<span class="gp">>>> </span><span class="n">knmi_dataset</span> <span
class="o">=</span> <span class="n">dsp</span><span class="o">.</span><span
class="n">subset</span><span class="p">(</span><span
class="n">knmi_dataset</span><span class="p">,</span> <span
class="n">new_bounds</span><span class="p">)</span>
</pre></div>
</div>
<p>Temporally re-binning a dataset is great when the time step of the data is
too fine grain for the desired use. For instance, perhaps we want to see a
yearly trend but we have daily data. We would need to make the following call
to adjust our dataset:</p>
-<div class="highlight-python"><div class="highlight"><pre><span
class="gp">>>> </span><span class="n">knmi_dataset</span> <span
class="o">=</span> <span class="n">dsp</span><span class="o">.</span><span
class="n">temporal_rebin</span><span class="p">(</span><span
class="n">knmi_dataset</span><span class="p">,</span> <span
class="n">datetime</span><span class="o">.</span><span
class="n">timedelta</span><span class="p">(</span><span
class="n">days</span><span class="o">=</span><span class="mi">365</span><span
class="p">))</span>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span
class="gp">>>> </span><span class="n">knmi_dataset</span> <span
class="o">=</span> <span class="n">dsp</span><span class="o">.</span><span
class="n">temporal_rebin</span><span class="p">(</span><span
class="n">knmi_dataset</span><span class="p">,</span> <span
class="n">datetime</span><span class="o">.</span><span
class="n">timedelta</span><span class="p">(</span><span
class="n">days</span><span class="o">=</span><span class="mi">365</span><span
class="p">))</span>
</pre></div>
</div>
<p>It is critically necessary for our datasets to be on the same lat/lon grid
before we try to compare them. That’s where spatial re-gridding comes in
helpful. Here we re-grid our example dataset onto a 1-degree lat/lon grid
within the range that we subsetted the dataset previously:</p>
-<div class="highlight-python"><div class="highlight"><pre><span
class="gp">>>> </span><span class="n">new_lons</span> <span
class="o">=</span> <span class="n">np</span><span class="o">.</span><span
class="n">arange</span><span class="p">(</span><span
class="n">min_lon</span><span class="p">,</span> <span
class="n">max_lon</span><span class="p">,</span> <span class="mi">1</span><span
class="p">)</span>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span
class="gp">>>> </span><span class="n">new_lons</span> <span
class="o">=</span> <span class="n">np</span><span class="o">.</span><span
class="n">arange</span><span class="p">(</span><span
class="n">min_lon</span><span class="p">,</span> <span
class="n">max_lon</span><span class="p">,</span> <span class="mi">1</span><span
class="p">)</span>
<span class="gp">>>> </span><span class="n">new_lats</span> <span
class="o">=</span> <span class="n">np</span><span class="o">.</span><span
class="n">arange</span><span class="p">(</span><span
class="n">min_lat</span><span class="p">,</span> <span
class="n">max_lat</span><span class="p">,</span> <span class="mi">1</span><span
class="p">)</span>
<span class="gp">>>> </span><span class="n">knmi_dataset</span> <span
class="o">=</span> <span class="n">dsp</span><span class="o">.</span><span
class="n">spatial_regrid</span><span class="p">(</span><span
class="n">knmi_dataset</span><span class="p">,</span> <span
class="n">new_lats</span><span class="p">,</span> <span
class="n">new_lons</span><span class="p">)</span>
</pre></div>
@@ -106,19 +90,19 @@
<div class="section" id="metrics">
<h2>Metrics<a class="headerlink" href="#metrics" title="Permalink to this
headline">¶</a></h2>
<p>Metrics are the backbone of an evaluation. You’ll find a number of
(hopefully) useful “default” metrics in the <a class="reference
internal" href="metrics.html#module-metrics" title="metrics"><code class="xref
py py-mod docutils literal"><span class="pre">metrics</span></code></a> module
in the toolkit. In general you won’t be too likely to use a metric
outside of an evaluation, however you could run a metric manually if you so
desired.:</p>
-<div class="highlight-python"><div class="highlight"><pre><span
class="gp">>>> </span><span class="kn">import</span> <span
class="nn">ocw.metrics</span>
-<span class="gp">>>> </span><span class="c"># Load 2 datasets</span>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span
class="gp">>>> </span><span class="kn">import</span> <span
class="nn">ocw.metrics</span>
+<span class="gp">>>> </span><span class="c1"># Load 2 datasets</span>
<span class="gp">>>> </span><span class="n">bias</span> <span
class="o">=</span> <span class="n">ocw</span><span class="o">.</span><span
class="n">metrics</span><span class="o">.</span><span
class="n">Bias</span><span class="p">()</span>
-<span class="gp">>>> </span><span class="k">print</span> <span
class="n">bias</span><span class="o">.</span><span class="n">run</span><span
class="p">(</span><span class="n">dataset1</span><span class="p">,</span> <span
class="n">dataset2</span><span class="p">)</span>
+<span class="gp">>>> </span><span class="nb">print</span> <span
class="n">bias</span><span class="o">.</span><span class="n">run</span><span
class="p">(</span><span class="n">dataset1</span><span class="p">,</span> <span
class="n">dataset2</span><span class="p">)</span>
</pre></div>
</div>
<p>While this might be exactly what you need to get the job done, it is far
more likely that you’ll need to run a number of metrics over a number of
datasets. That’s where running an evaluation comes in, but we’ll
get to that shortly.</p>
<p>There are two “types” of metrics that the toolkit supports. A
unary metric acts on a single dataset and returns a result. A binary metric
acts on a target and reference dataset and returns a result. This is helpful to
know if you decide that the included metrics aren’t sufficient.
We’ve attempted to make adding a new metric as simple as possible. You
simply create a new class that inherits from either the unary or binary base
classes and override the <cite>run</cite> function. At this point your metric
will behave exactly like the included metrics in the toolkit. Below is an
example of how one of the included metrics is implemented. If you need further
assistance with your own metrics be sure to email the project’s mailing
list!:</p>
-<div class="highlight-python"><div class="highlight"><pre><span
class="gp">>>> </span><span class="k">class</span> <span
class="nc">Bias</span><span class="p">(</span><span
class="n">BinaryMetric</span><span class="p">):</span>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span
class="gp">>>> </span><span class="k">class</span> <span
class="nc">Bias</span><span class="p">(</span><span
class="n">BinaryMetric</span><span class="p">):</span>
<span class="gp">>>> </span> <span
class="sd">'''Calculate the bias between a reference and target
dataset.'''</span>
<span class="go">>>></span>
<span class="gp">>>> </span> <span class="k">def</span> <span
class="nf">run</span><span class="p">(</span><span class="bp">self</span><span
class="p">,</span> <span class="n">ref_dataset</span><span class="p">,</span>
<span class="n">target_dataset</span><span class="p">):</span>
-<span class="gp">>>> </span> <span
class="s">'''Calculate the bias between a reference and target
dataset.</span>
+<span class="gp">>>> </span> <span
class="s1">'''Calculate the bias between a reference and target
dataset.</span>
<span class="go">>>></span>
<span class="gp">>>> </span> <span class="o">..</span> <span
class="n">note</span><span class="p">::</span>
<span class="gp">>>> </span> <span
class="n">Overrides</span> <span class="n">BinaryMetric</span><span
class="o">.</span><span class="n">run</span><span class="p">()</span>
@@ -131,18 +115,18 @@
<span class="go">>>></span>
<span class="gp">>>> </span> <span class="p">:</span><span
class="n">returns</span><span class="p">:</span> <span class="n">The</span>
<span class="n">difference</span> <span class="n">between</span> <span
class="n">the</span> <span class="n">reference</span> <span
class="ow">and</span> <span class="n">target</span> <span
class="n">datasets</span><span class="o">.</span>
<span class="gp">>>> </span> <span class="p">:</span><span
class="n">rtype</span><span class="p">:</span> <span class="n">Numpy</span>
<span class="n">Array</span>
-<span class="gp">>>> </span> <span
class="s">'''</span>
-<span class="gp">>>> </span><span class="s"> return
ref_dataset.values - target_dataset.values</span>
+<span class="gp">>>> </span> <span
class="s1">'''</span>
+<span class="gp">>>> </span><span class="s1"> return
ref_dataset.values - target_dataset.values</span>
</pre></div>
</div>
<p>While this might look a bit scary at first, if we take out all the
documentation you’ll see that it’s really extremely simple.:</p>
-<div class="highlight-python"><div class="highlight"><pre><span
class="gp">>>> </span><span class="c"># Our new Bias metric inherits
from the Binary Metric base class</span>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span
class="gp">>>> </span><span class="c1"># Our new Bias metric inherits
from the Binary Metric base class</span>
<span class="gp">>>> </span><span class="k">class</span> <span
class="nc">Bias</span><span class="p">(</span><span
class="n">BinaryMetric</span><span class="p">):</span>
-<span class="gp">>>> </span> <span class="c"># Since our new
metric is a binary metric we need to override</span>
-<span class="gp">>>> </span> <span class="c"># the run funtion in
the BinaryMetric base class.</span>
+<span class="gp">>>> </span> <span class="c1"># Since our new
metric is a binary metric we need to override</span>
+<span class="gp">>>> </span> <span class="c1"># the run funtion in
the BinaryMetric base class.</span>
<span class="gp">>>> </span> <span class="k">def</span> <span
class="nf">run</span><span class="p">(</span><span class="bp">self</span><span
class="p">,</span> <span class="n">ref_dataset</span><span class="p">,</span>
<span class="n">target_dataset</span><span class="p">):</span>
-<span class="gp">>>> </span> <span class="c"># To implement
the bias metric we simply return the difference</span>
-<span class="gp">>>> </span> <span class="c"># between the
reference and target dataset's values arrays.</span>
+<span class="gp">>>> </span> <span class="c1"># To implement
the bias metric we simply return the difference</span>
+<span class="gp">>>> </span> <span class="c1"># between the
reference and target dataset's values arrays.</span>
<span class="gp">>>> </span> <span class="k">return</span>
<span class="n">ref_dataset</span><span class="o">.</span><span
class="n">values</span> <span class="o">-</span> <span
class="n">target_dataset</span><span class="o">.</span><span
class="n">values</span>
</pre></div>
</div>
@@ -151,66 +135,66 @@
<div class="section" id="handling-an-evaluation">
<h2>Handling an Evaluation<a class="headerlink" href="#handling-an-evaluation"
title="Permalink to this headline">¶</a></h2>
<p>We saw above that it is easy enough to run a metric over a few datasets
manually. However, when we have a lot of datasets and/or a lot of metrics to
run that can become tedious and error prone. This is where the <a
class="reference internal" href="evaluation.html#evaluation.Evaluation"
title="evaluation.Evaluation"><code class="xref py py-class docutils
literal"><span class="pre">evaluation.Evaluation</span></code></a> class comes
in handy. It ensures that all the metrics that you choose are run over all
combinations of the datasets that you input. Consider the following simple
example:</p>
-<div class="highlight-python"><div class="highlight"><pre><span
class="gp">>>> </span><span class="kn">import</span> <span
class="nn">ocw.evaluation</span> <span class="kn">as</span> <span
class="nn">eval</span>
-<span class="gp">>>> </span><span class="kn">import</span> <span
class="nn">ocw.data_source.local</span> <span class="kn">as</span> <span
class="nn">local</span>
-<span class="gp">>>> </span><span class="kn">import</span> <span
class="nn">ocw.metrics</span> <span class="kn">as</span> <span
class="nn">metrics</span>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span
class="gp">>>> </span><span class="kn">import</span> <span
class="nn">ocw.evaluation</span> <span class="k">as</span> <span
class="nn">eval</span>
+<span class="gp">>>> </span><span class="kn">import</span> <span
class="nn">ocw.data_source.local</span> <span class="k">as</span> <span
class="nn">local</span>
+<span class="gp">>>> </span><span class="kn">import</span> <span
class="nn">ocw.metrics</span> <span class="k">as</span> <span
class="nn">metrics</span>
<span class="go">>>></span>
-<span class="gp">>>> </span><span class="c"># Load a few
datasets</span>
+<span class="gp">>>> </span><span class="c1"># Load a few
datasets</span>
<span class="gp">>>> </span><span class="n">ref_dataset</span> <span
class="o">=</span> <span class="n">local</span><span class="o">.</span><span
class="n">load_file</span><span class="p">(</span><span
class="o">...</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">target1</span> <span
class="o">=</span> <span class="n">local</span><span class="o">.</span><span
class="n">load_file</span><span class="p">(</span><span
class="o">...</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">target2</span> <span
class="o">=</span> <span class="n">local</span><span class="o">.</span><span
class="n">load_file</span><span class="p">(</span><span
class="o">...</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">target_datasets</span>
<span class="o">=</span> <span class="p">[</span><span
class="n">target1</span><span class="p">,</span> <span
class="n">target2</span><span class="p">]</span>
<span class="go">>>></span>
-<span class="gp">>>> </span><span class="c"># Do some dataset
manipulations here such as subsetting and regridding</span>
+<span class="gp">>>> </span><span class="c1"># Do some dataset
manipulations here such as subsetting and regridding</span>
<span class="go">>>></span>
-<span class="gp">>>> </span><span class="c"># Load a few
metrics</span>
+<span class="gp">>>> </span><span class="c1"># Load a few
metrics</span>
<span class="gp">>>> </span><span class="n">bias</span> <span
class="o">=</span> <span class="n">metrics</span><span class="o">.</span><span
class="n">Bias</span><span class="p">()</span>
<span class="gp">>>> </span><span class="n">tstd</span> <span
class="o">=</span> <span class="n">metrics</span><span class="o">.</span><span
class="n">TemporalStdDev</span><span class="p">()</span>
<span class="gp">>>> </span><span class="n">metrics</span> <span
class="o">=</span> <span class="p">[</span><span class="n">bias</span><span
class="p">,</span> <span class="n">tstd</span><span class="p">]</span>
<span class="go">>>></span>
<span class="gp">>>> </span><span class="n">new_eval</span> <span
class="o">=</span> <span class="nb">eval</span><span class="o">.</span><span
class="n">Evaluation</span><span class="p">(</span><span
class="n">ref_dataset</span><span class="p">,</span> <span
class="n">target_datasets</span><span class="p">,</span> <span
class="n">metrics</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">new_eval</span><span
class="o">.</span><span class="n">run</span><span class="p">()</span>
-<span class="gp">>>> </span><span class="k">print</span> <span
class="n">new_eval</span><span class="o">.</span><span class="n">results</span>
-<span class="gp">>>> </span><span class="k">print</span> <span
class="n">new_eval</span><span class="o">.</span><span
class="n">unary_results</span>
+<span class="gp">>>> </span><span class="nb">print</span> <span
class="n">new_eval</span><span class="o">.</span><span class="n">results</span>
+<span class="gp">>>> </span><span class="nb">print</span> <span
class="n">new_eval</span><span class="o">.</span><span
class="n">unary_results</span>
</pre></div>
</div>
<p>First we load all of our datasets and do any manipulations (which we leave
out for brevity). Then we load the metrics that we want to run, namely Bias and
TemporalStdDev. We then load our evaluation object.:</p>
-<div class="highlight-python"><div class="highlight"><pre><span
class="gp">>>> </span><span class="n">new_eval</span> <span
class="o">=</span> <span class="nb">eval</span><span class="o">.</span><span
class="n">Evaluation</span><span class="p">(</span><span
class="n">ref_dataset</span><span class="p">,</span> <span
class="n">target_datasets</span><span class="p">,</span> <span
class="n">metrics</span><span class="p">)</span>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span
class="gp">>>> </span><span class="n">new_eval</span> <span
class="o">=</span> <span class="nb">eval</span><span class="o">.</span><span
class="n">Evaluation</span><span class="p">(</span><span
class="n">ref_dataset</span><span class="p">,</span> <span
class="n">target_datasets</span><span class="p">,</span> <span
class="n">metrics</span><span class="p">)</span>
</pre></div>
</div>
<p>Notice two things about this. First, we’re splitting the datasets
into a reference dataset (ref_dataset) and a list of target datasets
(target_datasets). Second, one of the metrics that we loaded (<a
class="reference internal" href="metrics.html#metrics.TemporalStdDev"
title="metrics.TemporalStdDev"><code class="xref py py-class docutils
literal"><span class="pre">metrics.TemporalStdDev</span></code></a>) is a unary
metric. The reference/target dataset split is necessary to handling binary
metrics. When an evaluation is run, all the binary metrics are run against
every (reference, target) dataset pair. So the above evaluation could be
replaced with the following calls. Of course this wouldn’t handle the
unary metric, but we’ll get to that in a second.:</p>
-<div class="highlight-python"><div class="highlight"><pre><span
class="gp">>>> </span><span class="n">result1</span> <span
class="o">=</span> <span class="n">bias</span><span class="o">.</span><span
class="n">run</span><span class="p">(</span><span
class="n">ref_dataset</span><span class="p">,</span> <span
class="n">target1</span><span class="p">)</span>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span
class="gp">>>> </span><span class="n">result1</span> <span
class="o">=</span> <span class="n">bias</span><span class="o">.</span><span
class="n">run</span><span class="p">(</span><span
class="n">ref_dataset</span><span class="p">,</span> <span
class="n">target1</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">result2</span> <span
class="o">=</span> <span class="n">bias</span><span class="o">.</span><span
class="n">run</span><span class="p">(</span><span
class="n">ref_dataset</span><span class="p">,</span> <span
class="n">target2</span><span class="p">)</span>
</pre></div>
</div>
<p>Unary metrics are handled slightly differently but they’re still
simple. Each unary metric passed into the evaluation is run against
<em>every</em> dataset in the evaluation. So we could replace the above
evaluation with the following calls:</p>
-<div class="highlight-python"><div class="highlight"><pre><span
class="gp">>>> </span><span class="n">unary_result1</span> <span
class="o">=</span> <span class="n">tstd</span><span class="p">(</span><span
class="n">ref_dataset</span><span class="p">)</span>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span
class="gp">>>> </span><span class="n">unary_result1</span> <span
class="o">=</span> <span class="n">tstd</span><span class="p">(</span><span
class="n">ref_dataset</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">unary_result2</span>
<span class="o">=</span> <span class="n">tstd</span><span
class="p">(</span><span class="n">target1</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">unary_result3</span>
<span class="o">=</span> <span class="n">tstd</span><span
class="p">(</span><span class="n">target2</span><span class="p">)</span>
</pre></div>
</div>
<p>The only other part that we need to explore to fully understand the <code
class="xref py py-class docutils literal"><span
class="pre">evalution.Evaluation</span></code> class is how the results are
stored internally from the run. The <cite>results</cite> list is a
multidimensional array holding all the binary metric results and the
<cite>unary_results</cite> is a list holding all the unary metric results. To
more accurately replace the above evaluation with manual calls we would write
the following:</p>
-<div class="highlight-python"><div class="highlight"><pre><span
class="gp">>>> </span><span class="n">results</span> <span
class="o">=</span> <span class="p">[</span>
-<span class="gp">>>> </span> <span class="c"># Results for
target1</span>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span
class="gp">>>> </span><span class="n">results</span> <span
class="o">=</span> <span class="p">[</span>
+<span class="gp">>>> </span> <span class="c1"># Results for
target1</span>
<span class="gp">>>> </span> <span class="p">[</span>
<span class="gp">>>> </span> <span class="n">bias</span><span
class="o">.</span><span class="n">run</span><span class="p">(</span><span
class="n">ref_dataset</span><span class="p">,</span> <span
class="n">target1</span><span class="p">)</span>
-<span class="gp">>>> </span> <span class="c"># If there were
other binary metrics, the results would be here.</span>
+<span class="gp">>>> </span> <span class="c1"># If there were
other binary metrics, the results would be here.</span>
<span class="gp">>>> </span> <span class="p">],</span>
-<span class="gp">>>> </span> <span class="c"># Results for
target2</span>
+<span class="gp">>>> </span> <span class="c1"># Results for
target2</span>
<span class="gp">>>> </span> <span class="p">[</span>
<span class="gp">>>> </span> <span class="n">bias</span><span
class="o">.</span><span class="n">run</span><span class="p">(</span><span
class="n">ref_dataset</span><span class="p">,</span> <span
class="n">target2</span><span class="p">)</span>
-<span class="gp">>>> </span> <span class="c"># If there were
other binary metrics, the results would be here.</span>
+<span class="gp">>>> </span> <span class="c1"># If there were
other binary metrics, the results would be here.</span>
<span class="gp">>>> </span> <span class="p">]</span>
<span class="gp">>>> </span><span class="p">]</span>
<span class="go">>>></span>
<span class="gp">>>> </span><span class="n">unary_results</span>
<span class="o">=</span> <span class="p">[</span>
-<span class="gp">>>> </span> <span class="c"># Results for
TemporalStdDev</span>
+<span class="gp">>>> </span> <span class="c1"># Results for
TemporalStdDev</span>
<span class="gp">>>> </span> <span class="p">[</span>
<span class="gp">>>> </span> <span class="n">tstd</span><span
class="p">(</span><span class="n">ref_dataset</span><span class="p">),</span>
<span class="gp">>>> </span> <span class="n">tstd</span><span
class="p">(</span><span class="n">target1</span><span class="p">),</span>
<span class="gp">>>> </span> <span class="n">tstd</span><span
class="p">(</span><span class="n">target2</span><span class="p">)</span>
<span class="gp">>>> </span> <span class="p">]</span>
-<span class="gp">>>> </span> <span class="c"># If there were other
unary metrics, the results would be in a list here.</span>
+<span class="gp">>>> </span> <span class="c1"># If there were
other unary metrics, the results would be in a list here.</span>
<span class="gp">>>> </span><span class="p">]</span>
</pre></div>
</div>
@@ -218,13 +202,13 @@
<div class="section" id="plotting">
<h2>Plotting<a class="headerlink" href="#plotting" title="Permalink to this
headline">¶</a></h2>
<p>Plotting can be fairly complicated business. Luckily we have <a
class="reference external"
href="https://cwiki.apache.org/confluence/display/CLIMATE/Guide+to+Plotting+API">pretty
good documentation</a> on the project wiki that can help you out. There are
also fairly simple examples in the project’s example folder with the
remainder of the code such as the following:</p>
-<div class="highlight-python"><div class="highlight"><pre><span
class="gp">>>> </span><span class="c"># Let's grab the values
returned for bias.run(ref_dataset, target1)</span>
+<div class="highlight-default"><div class="highlight"><pre><span></span><span
class="gp">>>> </span><span class="c1"># Let's grab the values
returned for bias.run(ref_dataset, target1)</span>
<span class="gp">>>> </span><span class="n">results</span> <span
class="o">=</span> <span class="n">bias_evaluation</span><span
class="o">.</span><span class="n">results</span><span class="p">[</span><span
class="mi">0</span><span class="p">][</span><span class="mi">0</span><span
class="p">]</span>
<span class="go">>>></span>
-<span class="gp">>>> </span><span class="n">Here</span><span
class="s">'s the same lat/lons we used earlier when we were
re-gridding</span>
+<span class="gp">>>> </span><span class="n">Here</span><span
class="s1">'s the same lat/lons we used earlier when we were
re-gridding</span>
<span class="gp">>>> </span><span class="n">lats</span> <span
class="o">=</span> <span class="n">new_lats</span>
<span class="gp">>>> </span><span class="n">lons</span> <span
class="o">=</span> <span class="n">new_lons</span>
-<span class="gp">>>> </span><span class="n">fname</span> <span
class="o">=</span> <span class="s">'My_Test_Plot'</span>
+<span class="gp">>>> </span><span class="n">fname</span> <span
class="o">=</span> <span class="s1">'My_Test_Plot'</span>
<span class="go">>>></span>
<span class="gp">>>> </span><span class="n">plotter</span><span
class="o">.</span><span class="n">draw_contour_map</span><span
class="p">(</span><span class="n">results</span><span class="p">,</span> <span
class="n">lats</span><span class="p">,</span> <span class="n">lons</span><span
class="p">,</span> <span class="n">fname</span><span class="p">)</span>
</pre></div>
@@ -254,13 +238,15 @@
</ul>
</li>
</ul>
-
- <h4>Previous topic</h4>
- <p class="topless"><a href="../index.html"
- title="previous chapter">Welcome to Apache Open
Climate Workbench’s documentation!</a></p>
- <h4>Next topic</h4>
- <p class="topless"><a href="dataset.html"
- title="next chapter">Dataset Module</a></p>
+<div class="relations">
+<h3>Related Topics</h3>
+<ul>
+ <li><a href="../index.html">Documentation overview</a><ul>
+ <li>Previous: <a href="../index.html" title="previous chapter">Welcome
to Apache Open Climate Workbench’s documentation!</a></li>
+ <li>Next: <a href="dataset.html" title="next chapter">Dataset
Module</a></li>
+ </ul></li>
+</ul>
+</div>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
@@ -271,14 +257,11 @@
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
- <input type="text" name="q" />
- <input type="submit" value="Go" />
+ <div><input type="text" name="q" /></div>
+ <div><input type="submit" value="Go" /></div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
- <p class="searchtip" style="font-size: 90%">
- Enter search terms or a module, class or function name.
- </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
@@ -289,12 +272,12 @@
©2016, Apache Software Foundation.
|
- Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.1</a>
- & <a href="https://github.com/bitprophet/alabaster">Alabaster
0.7.4</a>
+ Powered by <a href="http://sphinx-doc.org/">Sphinx 1.4.8</a>
+ & <a href="https://github.com/bitprophet/alabaster">Alabaster
0.7.9</a>
|
<a href="../_sources/ocw/overview.txt"
- rel="nofollow">Page source</a></li>
+ rel="nofollow">Page source</a>
</div>