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