File: test_python_CMIP6_CV_load_tables.py

package info (click to toggle)
cmor 3.14.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 16,976 kB
  • sloc: ansic: 28,053; f90: 13,893; python: 12,699; sh: 3,739; makefile: 111
file content (24 lines) | stat: -rw-r--r-- 614 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import cmor
import glob
import unittest



def run():
    unittest.main()

class TestLoadTables(unittest.TestCase):
    def testLoadTables(self):
        tables = glob.glob("Tables/CMIP6*json")
        for table in tables:
            if "formula_terms" in table:
                continue
            cmor.setup(inpath='Tables', netcdf_file_action=cmor.CMOR_REPLACE)
            cmor.dataset_json("Test/CMOR_input_example.json")
            print("Loading table:", table)
            ierr = cmor.load_table(table)
            self.assertEqual(ierr, 0)
            cmor.close()

if __name__ == '__main__':
    run()