File: test_python_CMIP6_CV_load_tables.py

package info (click to toggle)
cmor 3.13.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 16,960 kB
  • sloc: ansic: 28,094; f90: 13,872; python: 12,423; sh: 3,738; makefile: 111
file content (25 lines) | stat: -rw-r--r-- 652 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from __future__ import print_function
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()