You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@climate.apache.org by jo...@apache.org on 2013/08/15 21:09:49 UTC
svn commit: r1514443 -
/incubator/climate/branches/RefactorInput/ocw/tests/test_dataset_processor.py
Author: joyce
Date: Thu Aug 15 19:09:48 2013
New Revision: 1514443
URL: http://svn.apache.org/r1514443
Log:
CLIMATE-237 - Init bad subregion unit test work.
Modified:
incubator/climate/branches/RefactorInput/ocw/tests/test_dataset_processor.py
Modified: incubator/climate/branches/RefactorInput/ocw/tests/test_dataset_processor.py
URL: http://svn.apache.org/viewvc/incubator/climate/branches/RefactorInput/ocw/tests/test_dataset_processor.py?rev=1514443&r1=1514442&r2=1514443&view=diff
==============================================================================
--- incubator/climate/branches/RefactorInput/ocw/tests/test_dataset_processor.py (original)
+++ incubator/climate/branches/RefactorInput/ocw/tests/test_dataset_processor.py Thu Aug 15 19:09:48 2013
@@ -22,6 +22,9 @@ from ocw import dataset as ds
import numpy as np
import numpy.ma as ma
+import logging
+logging.basicConfig(level=logging.CRITICAL)
+
class CustomAssertions:
# Custom Assertions to handle Numpy Arrays
def assert1DArraysEqual(self, array1, array2):
@@ -161,6 +164,26 @@ class TestSubset(unittest.TestCase):
self.assertEqual(subset.times.shape[0], 37)
self.assertEqual(subset.values.shape, (37, 82, 162))
+ def test_subset_with_bad_subregion(self):
+ target_dataset = ten_year_monthly_dataset()
+
+ subregion = {
+ 'latMin': -91,
+ 'latMax': 81,
+ 'lonMin': -161,
+ 'lonMax': 161,
+ 'start': datetime.datetime(2001, 1, 1),
+ 'end': datetime.datetime(2004, 1, 1)
+ }
+
+ try:
+ subset = dp.subset(subregion, target_dataset)
+ raise self.failureException()
+ except ValueError:
+ # We expect a value error to be raised since latMin is out of bounds
+ pass
+
+
def ten_year_monthly_dataset():
lats = np.array(range(-89, 90, 2))
lons = np.array(range(-179, 180, 2))