You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@climate.apache.org by jo...@apache.org on 2013/09/10 18:01:49 UTC

svn commit: r1521534 - /incubator/climate/trunk/ocw/metrics.py

Author: joyce
Date: Tue Sep 10 16:01:49 2013
New Revision: 1521534

URL: http://svn.apache.org/r1521534
Log:
CLIMATE-285 - Add UnaryMetric Abstract 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=1521534&r1=1521533&r2=1521534&view=diff
==============================================================================
--- incubator/climate/trunk/ocw/metrics.py (original)
+++ incubator/climate/trunk/ocw/metrics.py Tue Sep 10 16:01:49 2013
@@ -51,6 +51,24 @@ class Metric():
         '''
 
 
+class UnaryMetric():
+    '''Abstract Base Class from which all unary metrics inherit.'''
+    __metaclass__ = ABCMeta
+
+    def __init__(self):
+        pass
+
+    @abstactmethod
+    def run(self, target_dataset):
+        '''Run the metric for a given target dataset.
+
+        :param target_dataset: The dataset on which the current metric will
+            be run.
+
+        :returns: The result of evaluating the metric on the target_dataset.
+        '''
+
+
 class Bias(Metric):
     '''Calculate the bias between a reference and target dataset.'''