1
1
import basetest
2
2
import os
3
+
3
4
try :
4
- os .unlink (os .environ [' HOME' ] + ' /.dodsrc' )
5
- except :
5
+ os .unlink (os .environ [" HOME" ] + " /.dodsrc" )
6
+ except Exception :
6
7
pass
7
- import cdms2
8
8
from cdms2 .cdscan import main as cdscan
9
9
import os
10
- import sys
11
10
import xml .etree .ElementTree as ET
12
11
import cdat_info
13
12
@@ -40,7 +39,7 @@ def diffElements(el1, el2):
40
39
41
40
class TestCDScan (basetest .CDMSBaseTest ):
42
41
def testScan (self ):
43
- argv = ' cdscan -q -d test -x some_junk.xml u_2000.nc u_2001.nc u_2002.nc v_2000.nc v_2001.nc v_2002.nc' .split ()
42
+ argv = " cdscan -q -d test -x some_junk.xml u_2000.nc u_2001.nc u_2002.nc v_2000.nc v_2001.nc v_2002.nc" .split ()
44
43
pth = cdat_info .get_sampledata_path ()
45
44
os .chdir (pth )
46
45
cdscan (argv )
@@ -52,28 +51,6 @@ def testScan(self):
52
51
self .assertIsNone (results )
53
52
os .unlink ("some_junk.xml" )
54
53
55
- def testopenFile (self ):
56
- '''
57
- retrieve value from cdscan
58
- '''
59
- data_file1 = "https://dpesgf03.nccs.nasa.gov/thredds/dodsC/CREATE-IP/reanalysis/NASA-GMAO/GEOS-5/MERRA/mon/atmos/cl/cl_Amon_reanalysis_MERRA_197901-197912.nc"
60
- data_file2 = "https://dpesgf03.nccs.nasa.gov/thredds/dodsC/CREATE-IP/reanalysis/NASA-GMAO/GEOS-5/MERRA/mon/atmos/cl/cl_Amon_reanalysis_MERRA_198001-198012.nc"
61
- f1 = cdms2 .open (data_file1 )
62
- f2 = cdms2 .open (data_file2 )
63
- cl1 = f1 ["cl" ]
64
- cl2 = f2 ["cl" ]
65
-
66
- argv = "cdscan -x test_dap.xml {f1} {f2}" .format (f1 = data_file1 ,
67
- f2 = data_file2 ).split ()
68
- pth = cdat_info .get_sampledata_path ()
69
- os .chdir (pth )
70
- cdscan (argv )
71
- f = cdms2 .open ("test_dap.xml" )
72
- s = f ['cl' ]
73
- self .assertEqual (cl1 [5 , 20 , 80 , 140 ], s [5 , 20 , 80 , 140 ])
74
- self .assertEqual (cl2 [5 , 20 , 80 , 140 ], s [17 , 20 , 80 , 140 ])
75
-
76
- os .unlink ("test_dap.xml" )
77
54
78
55
if __name__ == "__main__" :
79
56
basetest .run ()
0 commit comments