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:33:31 UTC
svn commit: r1521542 - /incubator/climate/trunk/ocw/metrics.py
Author: joyce
Date: Tue Sep 10 16:33:30 2013
New Revision: 1521542
URL: http://svn.apache.org/r1521542
Log:
CLIMATE-290 - Update TemporalStdDev to use UnaryMetric
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=1521542&r1=1521541&r2=1521542&view=diff
==============================================================================
--- incubator/climate/trunk/ocw/metrics.py (original)
+++ incubator/climate/trunk/ocw/metrics.py Tue Sep 10 16:33:30 2013
@@ -77,27 +77,20 @@ class Bias(BinaryMetric):
return ref_dataset.values - target_dataset.values
-class TemporalStdDev(Metric):
+class TemporalStdDev(UnaryMetric):
'''Calculate the standard deviation over the time.'''
- def __init__(self):
- '''Default constructor.
-
- .. note::
- Overrides Metric.__init__()
- '''
- self.is_unary = True
-
- def run(self, datasets):
+ def run(self, target_dataset):
'''Calculate the temporal std. dev. for a datasets.
.. note::
- Overrides Metric.run()
+ Overrides UnaryMetric.run()
+
+ :param target_dataset: The target_dataset on which to calculate the
+ temporal standard deviation.
+ :type target_dataset: Dataset
- :param datasets: The datasets on which to calculate the temporal
- std. dev. in datasets[0].
- :type datasets: Tuple
- :returns: An array containing the temporal std. dev.
+ :returns: The temporal standard deviation of the target dataset
:rtype: Numpy Array
'''
return datasets[0].values.std(axi=0, ddof=1)