climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject svn commit: r1506161 - /incubator/climate/branches/RefactorInput/ocw/tests/test_evaluation.py
Date Tue, 23 Jul 2013 17:07:38 GMT
Author: joyce
Date: Tue Jul 23 17:07:38 2013
New Revision: 1506161

URL: http://svn.apache.org/r1506161
Log:
CLIMATE-214 - Add add_ref_dataset test.

Modified:
    incubator/climate/branches/RefactorInput/ocw/tests/test_evaluation.py

Modified: incubator/climate/branches/RefactorInput/ocw/tests/test_evaluation.py
URL: http://svn.apache.org/viewvc/incubator/climate/branches/RefactorInput/ocw/tests/test_evaluation.py?rev=1506161&r1=1506160&r2=1506161&view=diff
==============================================================================
--- incubator/climate/branches/RefactorInput/ocw/tests/test_evaluation.py (original)
+++ incubator/climate/branches/RefactorInput/ocw/tests/test_evaluation.py Tue Jul 23 17:07:38
2013
@@ -18,6 +18,8 @@
 '''Unit tests for the Evaluation.py module'''
 
 import unittest
+import numpy as np
+import datetime as dt
 from dataset import Dataset
 from evaluation import Evaluation
 
@@ -30,5 +32,20 @@ class TestEvaluation(unittest.TestCase):
         self.assertEquals(self.eval.target_datasets, [])
         self.assertEquals(self.eval.metrics, [])
 
+    def test_add_ref_dataset(self):
+        # Create an example dataset to add
+        lat = np.array([10, 12, 14, 16, 18])
+        lon = np.array([100, 102, 104, 106, 108])
+        time = np.array([dt.datetime(2000, x, 1) for x in range(1, 13)])
+        flat_array = np.array(range(300))
+        value = flat_array.reshape(12, 5, 5)
+        variable = 'prec'
+        test_dataset = Dataset(lat, lon, time, 
+                                    value, variable)
+
+        self.eval.add_ref_dataset(test_dataset)
+
+        self.assertEqual(self.eval.ref_dataset.variable, 'prec')
+
 if __name__  == '__main__':
     unittest.main()



Mime
View raw message