climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject [10/16] git commit: CLIMATE-392 - Documentation clarifications
Date Sat, 05 Apr 2014 05:05:30 GMT
CLIMATE-392 - Documentation clarifications


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

Branch: refs/heads/master
Commit: b0a762da4a887cd3eb973f93ddaa18b5214f8dfd
Parents: 6e99a98
Author: Michael Joyce <joyce@apache.org>
Authored: Fri Apr 4 21:32:13 2014 -0700
Committer: Michael Joyce <joyce@apache.org>
Committed: Fri Apr 4 21:32:13 2014 -0700

----------------------------------------------------------------------
 ocw/utils.py | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/climate/blob/b0a762da/ocw/utils.py
----------------------------------------------------------------------
diff --git a/ocw/utils.py b/ocw/utils.py
index 671b2f2..4b8f7fe 100644
--- a/ocw/utils.py
+++ b/ocw/utils.py
@@ -164,18 +164,19 @@ def parse_base_time_string(time_format):
 def normalize_lat_lon_values(lats, lons, values):
     ''' Normalize lat/lon values
 
-    Ensure that lat/lon values are withing [-180, 180)/[-90, 90) as well
-    as monotonically increasing. If they aren't they are adjusted accordingly.
+    Ensure that lat/lon values are within [-180, 180)/[-90, 90) as well
+    as sorted. If the values are off the grid they are shifted into the
+    expected range.
 
-    :param lats: A 1D numpy array of lat values.
+    :param lats: A 1D numpy array of sorted lat values.
     :type lats: Numpy Array
-    :param lons: A 1D numpy array of lon values.
+    :param lons: A 1D numpy array of sorted lon values.
     :type lons: Numpy Array
     :param values: A 3D array of data values.
 
     :returns: A tuple of the form (adjust_lats, adjusted_lons, adjusted_values)
 
-    :raises ValueError: If the lat or lon values are not monotonically increasing.
+    :raises ValueError: If the lat/lon values are not sorted.
     '''
     # Avoid unnecessary shifting if all lons are higher than 180
     if lons.min() > 180:
@@ -190,11 +191,11 @@ def normalize_lat_lon_values(lats, lons, values):
 
     # If the lat values are unsorted then raise an exception
     if not lats_reversed and lats_decreasing.any():
-        raise ValueError('Latitudes must be monotonically increasing.')
+        raise ValueError('Latitudes must be sorted.')
 
     # Perform same checks now for lons
     if not lons_reversed and lons_decreasing.any():
-        raise ValueError('Longitudes must be monotonically increasing.')
+        raise ValueError('Longitudes must be sorted.')
 
     # Also check if lons go from [0, 360), and convert to [-180, 180)
     # if necessary


Mime
View raw message