import unittest
import netCDF4

# test accessing data over http with opendap.

URL = 'http://test.opendap.org/opendap/hyrax/data/nc/bears.nc'
firstvarname = 'shot'
firstvarmin = 2
firstvarmax = 7
firstvarshape = (2,3)

class DapTestCase(unittest.TestCase):

    def setUp(self):
        pass

    def tearDown(self):
        pass

    def runTest(self):
        """testing access of data over http using opendap"""
        ncfile = netCDF4.Dataset(URL)
        assert firstvarname in ncfile.variables.keys()
        firstvar = ncfile.variables[firstvarname]
        assert firstvar.shape == firstvarshape
        data = firstvar[:]
        assert data.min() == firstvarmin
        assert data.max() == firstvarmax
        ncfile.close()

if __name__ == '__main__':
    unittest.main()

@@ -23,16 +23,68 @@
  netCDF4
+%0Afrom numpy.testing import assert_array_almost_equal
 %0A%0A# test
@@ -134,92 +134,98 @@
 L = 
-'
+%22
 http://
-test.opendap.org/opendap/hyrax/data/nc/bears.nc'%0Afirstvarname = 'shot'%0Afirst
+remotetest.unidata.ucar.edu/thredds/dodsC/testdods/testData.nc%22%0Avarname = 'Z_sfc'%0A
 varm
@@ -233,15 +233,10 @@
 n = 
-2%0Afirst
+0%0A
 varm
@@ -244,15 +244,13 @@
 x = 
-7%0Afirst
+3292%0A
 vars
@@ -261,11 +261,16 @@
  = (
-2,3
+1,95,135
 )%0A%0Ac
@@ -517,21 +517,16 @@
  assert 
-first
 varname 
@@ -560,21 +560,16 @@
         
-first
 var = nc
@@ -583,21 +583,16 @@
 riables%5B
-first
 varname%5D
@@ -607,21 +607,16 @@
  assert 
-first
 var.shap
@@ -620,21 +620,16 @@
 hape == 
-first
 varshape
@@ -644,21 +644,16 @@
  data = 
-first
 var%5B:%5D%0A 
@@ -661,25 +661,44 @@
       assert
- 
+_array_almost_equal(
 data.min() =
@@ -699,23 +699,16 @@
 in()
- == first
+,
 varmin
+)
 %0A   
@@ -718,17 +718,36 @@
   assert
- 
+_array_almost_equal(
 data.max
@@ -752,23 +752,16 @@
 ax()
- == first
+,
 varmax
+)
 %0A   

use different dap test server (a more reliable one)