You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@climate.apache.org by hu...@apache.org on 2017/05/11 14:33:42 UTC

[2/3] climate git commit: the unreasonable reshaping of latitude and longitude was replaced by the numpy.meshgrid

the unreasonable reshaping of latitude and longitude was replaced by the numpy.meshgrid


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

Branch: refs/heads/master
Commit: ee5f3c26fb1d4009325028bda4b29536b14a0319
Parents: 6cd5c1d
Author: huikyole <hu...@argo.jpl.nasa.gov>
Authored: Wed May 10 21:45:06 2017 -0700
Committer: huikyole <hu...@argo.jpl.nasa.gov>
Committed: Wed May 10 21:45:06 2017 -0700

----------------------------------------------------------------------
 ocw/tests/test_dataset_processor.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/climate/blob/ee5f3c26/ocw/tests/test_dataset_processor.py
----------------------------------------------------------------------
diff --git a/ocw/tests/test_dataset_processor.py b/ocw/tests/test_dataset_processor.py
index 32fa42d..27af951 100644
--- a/ocw/tests/test_dataset_processor.py
+++ b/ocw/tests/test_dataset_processor.py
@@ -391,10 +391,8 @@ class TestSpatialRegrid(unittest.TestCase):
                           self.regridded_dataset.variable)
 
     def test_two_dimensional_lats_lons(self):
-        self.input_dataset.lats = np.array(range(-89, 90, 2))
-        self.input_dataset.lons = np.array(range(-179, 180, 4))
-        self.input_dataset.lats = self.input_dataset.lats.reshape(2, 45)
-        self.input_dataset.lons = self.input_dataset.lons.reshape(2, 45)
+        self.input_dataset.lons, self.input_dataset.lats = np.meshgrid(
+                                  np.array(range(-179, 180, 2)), np.array(range(-89, 90, 2)))
         new_dataset = dp.spatial_regrid(
             self.input_dataset, self.new_lats, self.new_lons)
         np.testing.assert_array_equal(new_dataset.lats, self.new_lats)