You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@climate.apache.org by go...@apache.org on 2014/06/20 17:51:49 UTC

[2/4] git commit: CLIMATE-476 - Add __str__ implementation to Bounds

CLIMATE-476 - Add __str__ implementation to Bounds


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

Branch: refs/heads/master
Commit: cf7395aba2ca7e7a4493d5e9bdd1eb9ccaf13b6f
Parents: a2a072f
Author: Michael Joyce <jo...@apache.org>
Authored: Thu Jun 19 12:37:11 2014 -0700
Committer: Michael Joyce <jo...@apache.org>
Committed: Thu Jun 19 12:37:11 2014 -0700

----------------------------------------------------------------------
 ocw/dataset.py | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/climate/blob/cf7395ab/ocw/dataset.py
----------------------------------------------------------------------
diff --git a/ocw/dataset.py b/ocw/dataset.py
index 0621255..6cb5e24 100644
--- a/ocw/dataset.py
+++ b/ocw/dataset.py
@@ -324,3 +324,21 @@ class Bounds(object):
             raise ValueError(error)
 
         self._end = value
+
+    def __str__(self):
+        lat_range = "({}, {})".format(self._lat_min, self._lon_min)
+        lon_range = "({}, {})".format(self._lon_min, self._lon_min)
+        time_range = "({}, {})".format(self._start, self._end)
+
+        formatted_repr = (
+            "<Bounds - "
+            "lat-range: {}, "
+            "lon-range: {}, "
+            "time_range: {}> "
+        )
+
+        return formatted_repr.format(
+            lat_range,
+            lon_range,
+            time_range,
+        )