CLIMATE-476 - Add __str__ implementation to Evaluation
Project: http://git-wip-us.apache.org/repos/asf/climate/repo Commit: http://git-wip-us.apache.org/repos/asf/climate/commit/be6b4b85 Tree: http://git-wip-us.apache.org/repos/asf/climate/tree/be6b4b85 Diff: http://git-wip-us.apache.org/repos/asf/climate/diff/be6b4b85 Branch: refs/heads/master Commit: be6b4b85d9a04d2d854feda27ccbaa761f43037a Parents: cf7395a Author: Michael Joyce <[email protected]> Authored: Thu Jun 19 12:49:57 2014 -0700 Committer: Michael Joyce <[email protected]> Committed: Thu Jun 19 12:49:57 2014 -0700 ---------------------------------------------------------------------- ocw/evaluation.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/climate/blob/be6b4b85/ocw/evaluation.py ---------------------------------------------------------------------- diff --git a/ocw/evaluation.py b/ocw/evaluation.py index 9f7dfee..a27a27f 100644 --- a/ocw/evaluation.py +++ b/ocw/evaluation.py @@ -299,3 +299,20 @@ class Evaluation(object): unary_results[-1].append(metric.run(target)) return unary_results + def __str__(self): + formatted_repr = ( + "<Evaluation - ref_dataset: {}, " + "target_dataset(s): {}, " + "binary_metric(s): {}, " + "unary_metric(s): {}, " + "subregion(s): {}>" + ) + + return formatted_repr.format( + str(self._ref_dataset), + [str(ds) for ds in self.target_datasets], + [str(m) for m in self.metrics], + [str(m) for m in self.unary_metrics], + str(self.subregions) + ) +
