source: inundation/pyvolution/test_most2nc.py @ 2126

Last change on this file since 2126 was 1123, checked in by prow, 19 years ago

adding most2nc and tests. It is working.

File size: 768 bytes
Line 
1import unittest
2from Numeric import allclose, asarray
3import most2nc
4from Scientific.IO.NetCDF import NetCDFFile
5
6class Test_most2nc(unittest.TestCase):
7    def setUp(self):
8        pass
9
10    def tearDown(self):
11        pass
12
13    def test_small_nxn(self):
14        most2nc.most2nc(input_file='small.txt',output_file='test.nc'\
15                        ,inverted_bathymetry = False,verbose = False)
16
17        fid = NetCDFFile('test.nc')
18        elevation = fid.variables['ELEVATION'][:]
19        fid.close()
20
21        z=[[-13., -14., -15., -16.]\
22           ,[-9., -10., -11., -12.]\
23           ,[-5.,  -6.,  -7.,  -8.]\
24           ,[-1.,  -2.,  -3.,  -4.]]
25        z = asarray(z)
26
27        assert allclose(z,elevation)
28        import os
29        os.remove('test.nc')
30       
Note: See TracBrowser for help on using the repository browser.