ctbtodev
Last change
on this file since ff99eae was
efdb01a,
checked in by Anne Philipp <anne.philipp@…>, 6 years ago
|
whole bunch of modifications due to new structure of ECMWFDATA, added basics of documentation, minor programming corrections
|
-
Property mode set to
100644
|
File size:
913 bytes
|
Line | |
---|
1 | #!/usr/bin/env python |
---|
2 | # -*- coding: utf-8 -*- |
---|
3 | |
---|
4 | import unittest |
---|
5 | import sys |
---|
6 | sys.path.append('../python') |
---|
7 | from Tools import init128, toparamId |
---|
8 | |
---|
9 | |
---|
10 | class TestTools(unittest.TestCase): |
---|
11 | ''' |
---|
12 | ''' |
---|
13 | |
---|
14 | def setUp(self): |
---|
15 | pass |
---|
16 | |
---|
17 | def test_init128(self): |
---|
18 | ''' |
---|
19 | ''' |
---|
20 | table128 = init128('../grib_templates/ecmwf_grib1_table_128') |
---|
21 | expected = {'078': 'TCLW', '130': 'T', '034': 'SST'} |
---|
22 | # check a sample of parameters which must have been read in |
---|
23 | result = all((k in table128 and table128[k]==v) for k,v in expected.iteritems()) |
---|
24 | self.assertEqual(result, True) |
---|
25 | |
---|
26 | |
---|
27 | def test_toparamId(self): |
---|
28 | ''' |
---|
29 | ''' |
---|
30 | table128 = init128('../grib_templates/ecmwf_grib1_table_128') |
---|
31 | pars = toparamId("T/SP/LSP/SSHF", table128) |
---|
32 | for par in pars: |
---|
33 | self.assertIn(par, [130, 134, 142, 146]) |
---|
34 | |
---|
35 | |
---|
36 | if __name__ == "__main__": |
---|
37 | unittest.main() |
---|
Note: See
TracBrowser
for help on using the repository browser.