Changeset 5398
- Timestamp:
- Jun 10, 2008, 4:12:17 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/utilities/test_system_tools.py
r5219 r5398 4 4 import unittest 5 5 from Numeric import zeros, array, allclose, Float 6 from Scientific.IO.NetCDF import NetCDFFile7 6 import zlib 8 7 from os.path import join, split, sep … … 76 75 # Binary NetCDF File X 2 (use mktemp's name) 77 76 78 test_array = array([[7.0, 3.14], [-31.333, 0.0]]) 77 try: 78 from Scientific.IO.NetCDF import NetCDFFile 79 except ImportError: 80 # This code is also used by EQRM which does not require NetCDF 81 pass 82 else: 83 test_array = array([[7.0, 3.14], [-31.333, 0.0]]) 79 84 80 # First file81 filename1 = mktemp(suffix='.nc', dir='.')82 fid = NetCDFFile(filename1, 'w')83 fid.createDimension('two', 2)84 fid.createVariable('test_array', Float,85 ('two', 'two'))86 fid.variables['test_array'][:] = test_array87 fid.close()88 89 # Second file90 filename2 = mktemp(suffix='.nc', dir='.')91 fid = NetCDFFile(filename2, 'w')92 fid.createDimension('two', 2)93 fid.createVariable('test_array', Float,94 ('two', 'two'))95 fid.variables['test_array'][:] = test_array96 fid.close()97 98 99 checksum1 = compute_checksum(filename1)100 checksum2 = compute_checksum(filename2)101 assert checksum1 == checksum285 # First file 86 filename1 = mktemp(suffix='.nc', dir='.') 87 fid = NetCDFFile(filename1, 'w') 88 fid.createDimension('two', 2) 89 fid.createVariable('test_array', Float, 90 ('two', 'two')) 91 fid.variables['test_array'][:] = test_array 92 fid.close() 93 94 # Second file 95 filename2 = mktemp(suffix='.nc', dir='.') 96 fid = NetCDFFile(filename2, 'w') 97 fid.createDimension('two', 2) 98 fid.createVariable('test_array', Float, 99 ('two', 'two')) 100 fid.variables['test_array'][:] = test_array 101 fid.close() 102 103 104 checksum1 = compute_checksum(filename1) 105 checksum2 = compute_checksum(filename2) 106 assert checksum1 == checksum2 102 107 103 108 104 os.remove(filename1)105 os.remove(filename2)109 os.remove(filename1) 110 os.remove(filename2) 106 111 107 112
Note: See TracChangeset
for help on using the changeset viewer.