climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject svn commit: r1521541 - /incubator/climate/trunk/ocw/metrics.py
Date Tue, 10 Sep 2013 16:29:42 GMT
Author: joyce
Date: Tue Sep 10 16:29:41 2013
New Revision: 1521541

URL: http://svn.apache.org/r1521541
Log:
CLIMATE-289 - Update Bias to use BinaryMetric base class

Modified:
    incubator/climate/trunk/ocw/metrics.py

Modified: incubator/climate/trunk/ocw/metrics.py
URL: http://svn.apache.org/viewvc/incubator/climate/trunk/ocw/metrics.py?rev=1521541&r1=1521540&r2=1521541&view=diff
==============================================================================
--- incubator/climate/trunk/ocw/metrics.py (original)
+++ incubator/climate/trunk/ocw/metrics.py Tue Sep 10 16:29:41 2013
@@ -56,32 +56,25 @@ class BinaryMetric():
         '''
 
 
-class Bias(Metric):
+class Bias(BinaryMetric):
     '''Calculate the bias between a reference and target dataset.'''
 
-    def __init__(self):
-        '''Default constructor.
-
-        .. note::
-           Overrides Metric.__init__()
-        '''
-        self.is_unary = False
-
-    def run(self, datasets):
+    def run(self, ref_dataset, target_dataset):
         '''Calculate the bias between a reference and target dataset.
 
         .. note::
-           Overrides Metric.run()
+           Overrides BinaryMetric.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: An array containing the difference between the reference 
-                dataset and the target dataset.
+        :param ref_dataset: The reference dataset to use in this metric run.
+        :type ref_dataset: Dataset.
+        :param target_dataset: The target dataset to evaluate against the
+            reference dataset in this metric run.
+        :type target_dataset: Dataset.
+
+        :returns: The difference between the reference and target datasets.
         :rtype: Numpy Array
         '''
-        return datasets[0].values - datasets[1].values
+        return ref_dataset.values - target_dataset.values
 
 
 class TemporalStdDev(Metric):



Mime
View raw message