climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject svn commit: r1506795 - /incubator/climate/branches/RefactorInput/ocw/metrics.py
Date Thu, 25 Jul 2013 02:24:41 GMT
Author: joyce
Date: Thu Jul 25 02:24:40 2013
New Revision: 1506795

URL: http://svn.apache.org/r1506795
Log:
CLIMATE-217 - Add Bias metric

- Add Bias metric as an example of a "binary" metric implementation.

Modified:
    incubator/climate/branches/RefactorInput/ocw/metrics.py

Modified: incubator/climate/branches/RefactorInput/ocw/metrics.py
URL: http://svn.apache.org/viewvc/incubator/climate/branches/RefactorInput/ocw/metrics.py?rev=1506795&r1=1506794&r2=1506795&view=diff
==============================================================================
--- incubator/climate/branches/RefactorInput/ocw/metrics.py (original)
+++ incubator/climate/branches/RefactorInput/ocw/metrics.py Thu Jul 25 02:24:40 2013
@@ -49,3 +49,22 @@ class Metric():
         :returns: A list containing the results of running the metric.
         :trype: List
         '''
+
+class Bias(Metric):
+    '''Calculate the bias between a reference and target dataset.'''
+
+    def run(self, datasets):
+        '''Calculate the bias between a reference and target dataset.
+
+        .. note::
+           Overrides Metric.run()
+
+        :param datasets: The datasets to use in the current run. The \
+                reference dataset is given in datasets[0] and the target \
+                dataset is given in datasets[1].
+        :type datasets: Tuple
+        :returns: A list containing the difference between the reference \
+                dataset and the target dataset.
+        :rtype: List
+        '''
+        return [datasets[0] - datasets[1]]



Mime
View raw message