climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From huiky...@apache.org
Subject [1/3] climate git commit: CLIMATE-672 - Update the input validation function for OCW datasets
Date Fri, 25 Sep 2015 15:55:19 GMT
Repository: climate
Updated Branches:
  refs/heads/master 4ad37eb93 -> 0f3e8860e


CLIMATE-672 - Update the input validation function for OCW datasets

- ocw.dataset._validate_inputs considers datasets on curvilinear grids


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

Branch: refs/heads/master
Commit: ea203b2ef11e16bf18fe0aab7490ed8fb0cb5e16
Parents: 9eac1f6
Author: huikyole <huikyole@argo.jpl.nasa.gov>
Authored: Mon Sep 21 17:05:29 2015 -0700
Committer: huikyole <huikyole@argo.jpl.nasa.gov>
Committed: Mon Sep 21 17:05:29 2015 -0700

----------------------------------------------------------------------
 ocw/dataset.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/climate/blob/ea203b2e/ocw/dataset.py
----------------------------------------------------------------------
diff --git a/ocw/dataset.py b/ocw/dataset.py
index e432928..d3d2cb2 100644
--- a/ocw/dataset.py
+++ b/ocw/dataset.py
@@ -182,15 +182,16 @@ class Dataset:
         elif value_dim < 2:
             err_msg = "Value Array should be at least 2 dimensional.  %s dimensions found."
% value_dim
         # Finally check that the Values array conforms to the proper shape
-        if value_dim == 2 and values.shape != (lat_count, lon_count):
-            err_msg = """Value Array must be of shape (times, lats, lons).
-    Expected shape (%s, %s) but received (%s, %s)""" % (lat_count,
+        if value_dim == 2:
+            if values.shape[0] != time_count and values.shape != (lat_count, lon_count):
+                err_msg = """Value Array must be of shape (lats, lons) or (times, locations).
+                Expected shape (%s, %s) but received (%s, %s)""" % (lat_count,
                                                                 lon_count,
                                                                 values.shape[0],
                                                                 values.shape[1])
         if value_dim == 3 and values.shape != (time_count, lat_count, lon_count):
             err_msg = """Value Array must be of shape (times, lats, lons).
-    Expected shape (%s, %s, %s) but received (%s, %s, %s)""" % (time_count,
+            Expected shape (%s, %s, %s) but received (%s, %s, %s)""" % (time_count,
                                                                 lat_count,
                                                                 lon_count,
                                                                 values.shape[0],


Mime
View raw message