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/09/24 17:26:33 UTC

svn commit: r1525923 - /incubator/climate/trunk/ocw/tests/test_local.py

Author: joyce
Date: Tue Sep 24 15:26:32 2013
New Revision: 1525923

URL: http://svn.apache.org/r1525923
Log:
CLIMATE-308 - Make test_local download necessary NetCDF file

Modified:
    incubator/climate/trunk/ocw/tests/test_local.py

Modified: incubator/climate/trunk/ocw/tests/test_local.py
URL: http://svn.apache.org/viewvc/incubator/climate/trunk/ocw/tests/test_local.py?rev=1525923&r1=1525922&r2=1525923&view=diff
==============================================================================
--- incubator/climate/trunk/ocw/tests/test_local.py (original)
+++ incubator/climate/trunk/ocw/tests/test_local.py Tue Sep 24 15:26:32 2013
@@ -19,6 +19,7 @@ import unittest
 import numpy
 import numpy.ma as ma
 import os
+import urllib
 import netCDF4
 import datetime
 import inspect
@@ -64,16 +65,17 @@ class test_load_file(unittest.TestCase):
         self.assertTrue(numpy.allclose(local.load_file(self.file_path, "value").values, new_values))
 
 class test_get_netcdf_variable_names(unittest.TestCase):
-    path_leader = inspect.getfile(test_local).split('ocw/')
+    file_path = "http://zipper.jpl.nasa.gov/dist/"
+    test_model = "AFRICA_KNMI-RACMO2.2b_CTL_ERAINT_MM_50km_1989-2008_tasmax.nc"
 
     def setUp(self):
-        file_path = os.path.join(self.path_leader[0], "examples/AFRICA_KNMI-RACMO2.2b_CTL_ERAINT_MM_50km_1989-2008_tasmax.nc")
-        self.netcdf_path = os.path.abspath(file_path)
+        urllib.urlretrieve(self.file_path + self.test_model, self.test_model)
         self.invalid_netcdf_path = create_invalid_dimensions_netcdf_object()
-        self.netcdf = netCDF4.Dataset(self.netcdf_path, mode='r')
+        self.netcdf = netCDF4.Dataset(self.test_model, mode='r')
 
     def tearDown(self):
         os.remove(self.invalid_netcdf_path)
+        os.remove(self.test_model)
 
     def test_valid_latitude(self):
         self.lat = local._get_netcdf_variable_name(