climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject [07/16] git commit: CLIMATE-392 - Use new utils helper for lat/lon clean up
Date Sat, 05 Apr 2014 05:05:27 GMT
CLIMATE-392 - Use new utils helper for lat/lon clean up

- Use the utils.normalize_lat_lon_values helper for cleaning up any
  lat/lon problems when creating a new Dataset object.


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

Branch: refs/heads/master
Commit: 6e99a9808b43a6b3d1426a39b6c9eea08d8b5c2a
Parents: 0497913
Author: Michael Joyce <joyce@apache.org>
Authored: Fri Apr 4 20:54:03 2014 -0700
Committer: Michael Joyce <joyce@apache.org>
Committed: Fri Apr 4 20:54:03 2014 -0700

----------------------------------------------------------------------
 ocw/dataset.py | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/climate/blob/6e99a980/ocw/dataset.py
----------------------------------------------------------------------
diff --git a/ocw/dataset.py b/ocw/dataset.py
index f0b61a9..80ab18e 100644
--- a/ocw/dataset.py
+++ b/ocw/dataset.py
@@ -26,6 +26,8 @@ import numpy
 import logging
 import datetime as dt
 
+import ocw.utils as utils
+
 from mpl_toolkits.basemap import shiftgrid
 
 logger = logging.getLogger(__name__)
@@ -54,6 +56,7 @@ class Dataset:
         :raises: ValueError
         '''
         self._validate_inputs(lats, lons, times, values)
+        lats, lons, values = utils.normalize_lat_lon_values(lats, lons, values)
 
         self.lats = lats
         self.lons = lons
@@ -62,16 +65,6 @@ class Dataset:
         self.variable = variable
         self.name = name
 
-        # We want our lon. values to be [-180, 180). If they're out of this
-        # grid then we need to shift them so they're not! Check the Basemap
-        # docs for additional information.
-        # http://matplotlib.org/basemap/api/basemap_api.html
-        if self.lons.max() > 180:
-            self.values, self.lons = shiftgrid(180,
-                                               self.values,
-                                               self.lons,
-                                               start=False)
-
     def spatial_boundaries(self):
         '''Calculate the spatial boundaries.
 


Mime
View raw message