Repository: climate
Updated Branches:
  refs/heads/master f4d39668b -> 557a8b3a7


CLIMATE-484 - Remove rebinning metrics

- Drop SpatialStdDevRation, TemporalPatternCorrelation,
  SeasonalSpatialStdDevRation, and SeasonalPatternCorrelation.


Project: http://git-wip-us.apache.org/repos/asf/climate/repo
Commit: http://git-wip-us.apache.org/repos/asf/climate/commit/9102a17c
Tree: http://git-wip-us.apache.org/repos/asf/climate/tree/9102a17c
Diff: http://git-wip-us.apache.org/repos/asf/climate/diff/9102a17c

Branch: refs/heads/master
Commit: 9102a17cbbadca18bf46ba6039dd66fa71421ab1
Parents: f4d3966
Author: Michael Joyce <[email protected]>
Authored: Wed Jul 2 09:51:11 2014 -0700
Committer: Michael Joyce <[email protected]>
Committed: Wed Jul 2 09:51:11 2014 -0700

----------------------------------------------------------------------
 ocw/metrics.py | 121 ----------------------------------------------------
 1 file changed, 121 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/climate/blob/9102a17c/ocw/metrics.py
----------------------------------------------------------------------
diff --git a/ocw/metrics.py b/ocw/metrics.py
index a7dbdc3..8458210 100644
--- a/ocw/metrics.py
+++ b/ocw/metrics.py
@@ -126,40 +126,6 @@ class StdDevRatio(BinaryMetric):
         return target_dataset.values.std() / ref_dataset.values.std()
 
 
-class SpatialStdDevRatio(BinaryMetric):
-    '''Calculate the ratio of spatial standard deviation (model standard
-          deviation)/(observed standard deviation)'''
-
-    def run(self, ref_dataset, target_dataset):
-        '''Calculate the ratio of spatial std. dev. between a reference and
-            target dataset.
-
-        .. note::
-           Overrides BinaryMetric.run()
-
-        :param ref_dataset: The reference dataset to use in this metric run.
-        :type ref_dataset: ocw.dataset.Dataset object
-        :param target_dataset: The target dataset to evaluate against the
-            reference dataset in this metric run.
-        :type target_dataset: ocw.dataset.Dataset object
-
-        :returns: The ratio of standard deviation of the reference and target
-            dataset.
-        '''
-
-        # This is calcClimYear function for ref_dataset
-        reshaped_ref_data = utils.reshape_monthly_to_annually(ref_dataset)
-        ref_t_series = reshaped_ref_data.mean(axis=1)
-        ref_means = ref_t_series.mean(axis=0)
-
-        # This is calcClimYear function for target_dataset
-        reshaped_target_data = 
utils.reshape_monthly_to_annually(target_dataset)
-        target_t_series = reshaped_target_data.mean(axis=1)
-        target_means = target_t_series.mean(axis=0)
-
-        return numpy.std(ref_means) / numpy.std(target_means)
-
-
 class PatternCorrelation(BinaryMetric):
     '''Calculate the correlation coefficient between two datasets'''
 
@@ -183,37 +149,6 @@ class PatternCorrelation(BinaryMetric):
         return stats.pearsonr(ref_dataset.values.flatten(), 
target_dataset.values.flatten())[0]
 
 
-class TemporalPatternCorrelation(BinaryMetric):
-    '''Calculate the spatial correlation'''
-
-    def run(self, ref_dataset, target_dataset):
-        '''Calculate the spatial correlation between a reference and target 
dataset.
-            Using: scipy.stats.pearsonr
-
-        .. note::
-           Overrides BinaryMetric.run()
-
-        :param ref_dataset: The reference dataset to use in this metric run.
-        :type ref_dataset: ocw.dataset.Dataset object
-        :param target_dataset: The target dataset to evaluate against the
-            reference dataset in this metric run.
-        :type target_dataset: ocw.dataset.Dataset object
-
-        :returns: The spatial correlation between a reference and target 
dataset.
-        '''
-        # This is calcClimYear function for ref_dataset
-        reshaped_ref_data = utils.reshape_monthly_to_annually(ref_dataset)
-        ref_t_series = reshaped_ref_data.mean(axis=1)
-        ref_means = ref_t_series.mean(axis=0)
-
-        # This is calcClimYear function for target_dataset
-        reshaped_target_data = 
utils.reshape_monthly_to_annually(target_dataset)
-        target_t_series = reshaped_target_data.mean(axis=1)
-        target_means = target_t_series.mean(axis=0)
-
-        pattern_correlation, p_value = 
stats.pearsonr(target_means.flatten(),ref_means.flatten())
-        return pattern_correlation, p_value
-
 class MeanBias(BinaryMetric):
     '''Calculate the bias averaged over time.'''
 
@@ -238,59 +173,3 @@ class MeanBias(BinaryMetric):
         mean_bias = diff.mean(axis=0)
 
         return mean_bias
-
-class SeasonalSpatialStdDevRatio(BinaryMetric):
-    '''Calculate the seasonal spatial standard deviation ratio.'''
-
-    def __init__(self, month_start=1, month_end=12):
-        self.month_start = month_start
-        self.month_end = month_end
-
-    def run(self, ref_dataset, target_dataset):
-        '''Calculate the seasonal spatial standard deviation ratio.
-
-        .. note::
-           Overrides BinaryMetric.run()
-
-        :param ref_dataset: The reference dataset to use in this metric run.
-        :type ref_dataset: ocw.dataset.Dataset object
-        :param target_dataset: The target dataset to evaluate against the
-            reference dataset in this metric run.
-        :type target_dataset: ocw.dataset.Dataset object
-
-        :returns: The ratio of standard deviation of the reference and target
-            dataset.
-        '''
-
-        ref_t_series, ref_means = 
utils.calc_climatology_season(self.month_start, self.month_end, ref_dataset)
-        target_t_series, target_means = 
utils.calc_climatology_season(self.month_start, self.month_end, target_dataset)
-
-        return numpy.std(ref_means) / numpy.std(target_means)
-
-
-class SeasonalPatternCorrelation(BinaryMetric):
-    '''Calculate the seasonal pattern correlation.'''
-
-    def __init__(self, month_start=1, month_end=12):
-        self.month_start = month_start
-        self.month_end = month_end
-
-    def run(self, ref_dataset, target_dataset):
-        '''Calculate the seasonal pattern correlation.
-
-        .. note::
-           Overrides BinaryMetric.run()
-
-        :param ref_dataset: The reference dataset to use in this metric run.
-        :type ref_dataset: ocw.dataset.Dataset object
-        :param target_dataset: The target dataset to evaluate against the
-            reference dataset in this metric run.
-        :type target_dataset: ocw.dataset.Dataset object
-
-        :returns: The spatial correlation between a reference and target 
dataset.
-        '''
-        ref_t_series, ref_means = 
utils.calc_climatology_season(self.month_start, self.month_end, ref_dataset)
-        target_t_series, target_means = 
utils.calc_climatology_season(self.month_start, self.month_end, target_dataset)
-
-        pattern_correlation, p_value = 
stats.pearsonr(target_means.flatten(),ref_means.flatten())
-        return pattern_correlation, p_value

Reply via email to