Repository: climate Updated Branches: refs/heads/master b08d37940 -> 45779fb98
CLIMATE-659 - Remove SpatialMeanOfTemporalMeanBias - delete: metrics.SpatialMeanOfTemporalMeanBias - new examples will calculate this quantity in a more reasonable way Project: http://git-wip-us.apache.org/repos/asf/climate/repo Commit: http://git-wip-us.apache.org/repos/asf/climate/commit/ee1d860d Tree: http://git-wip-us.apache.org/repos/asf/climate/tree/ee1d860d Diff: http://git-wip-us.apache.org/repos/asf/climate/diff/ee1d860d Branch: refs/heads/master Commit: ee1d860de1bcae74c51ac5b57ac41ed2573c93d0 Parents: d4eeb03 Author: huikyole <[email protected]> Authored: Fri Aug 14 10:06:57 2015 -0700 Committer: huikyole <[email protected]> Committed: Fri Aug 14 10:06:57 2015 -0700 ---------------------------------------------------------------------- ocw/metrics.py | 24 ------------------------ ocw/tests/test_metrics.py | 29 ----------------------------- 2 files changed, 53 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/climate/blob/ee1d860d/ocw/metrics.py ---------------------------------------------------------------------- diff --git a/ocw/metrics.py b/ocw/metrics.py index 9b9aad6..3d7c536 100644 --- a/ocw/metrics.py +++ b/ocw/metrics.py @@ -219,30 +219,6 @@ class TemporalMeanBias(BinaryMetric): return mean_bias -class SpatialMeanOfTemporalMeanBias(BinaryMetric): - '''Calculate the bias averaged over time and domain.''' - - def run(self, reference_dataset, target_dataset): - '''Calculate the bias averaged over time and domain. - - .. note:: - Overrides BinaryMetric.run() - - :param reference_dataset: The reference dataset to use in this metric - run - :type reference_dataset: :class:`dataset.Dataset` - - :param target_dataset: The target dataset to evaluate against the - reference dataset in this metric run - :type target_dataset: :class:`dataset.Dataset` - - :returns: The bias averaged over time and domain - ''' - - bias = target_dataset.values - reference_dataset.values - return ma.mean(bias) - - class RMSError(BinaryMetric): '''Calculate the Root Mean Square Difference (RMS Error), with the mean calculated over time and space.''' http://git-wip-us.apache.org/repos/asf/climate/blob/ee1d860d/ocw/tests/test_metrics.py ---------------------------------------------------------------------- diff --git a/ocw/tests/test_metrics.py b/ocw/tests/test_metrics.py index 8edeaff..9ee19e2 100644 --- a/ocw/tests/test_metrics.py +++ b/ocw/tests/test_metrics.py @@ -215,35 +215,6 @@ class TestTemporalMeanBias(unittest.TestCase): np.testing.assert_array_equal(self.mean_bias.run(self.reference_dataset, self.target_dataset, True), expected_result) -class TestSpatialMeanOfTemporalMeanBias(unittest.TestCase): - '''Test the metrics.SpatialMeanOfTemporalMeanBias metric.''' - def setUp(self): - # Set metric. - self.metric = metrics.SpatialMeanOfTemporalMeanBias() - # Initialize reference dataset. - self.ref_lats = np.array([10, 20, 30, 40, 50]) - self.ref_lons = np.array([5, 15, 25, 35, 45]) - self.ref_times = np.array([dt.datetime(2000, x, 1) - for x in range(1, 13)]) - self.ref_values = np.array(range(300)).reshape(12, 5, 5) - self.ref_variable = "ref" - self.ref_dataset = Dataset(self.ref_lats, self.ref_lons, - self.ref_times, self.ref_values, self.ref_variable) - # Initialize target dataset. - self.tgt_lats = np.array([10, 20, 30, 40, 50]) - self.tgt_lons = np.array([5, 15, 25, 35, 45]) - self.tgt_times = np.array([dt.datetime(2000, x, 1) - for x in range(1, 13)]) - self.tgt_values = np.array(range(299, -1, -1)).reshape(12, 5, 5) - self.tgt_variable = "tgt" - self.tgt_dataset = Dataset(self.tgt_lats, self.tgt_lons, - self.tgt_times, self.tgt_values, self.tgt_variable) - - def test_function_run(self): - result = self.metric.run(self.ref_dataset, self.tgt_dataset) - self.assertEqual(result, 0.0) - - class TestRMSError(unittest.TestCase): '''Test the metrics.RMSError metric.''' def setUp(self):
