def test_get_exp_bufr_table_names(self): # #[ """ test the get_expected_ecmwf_bufr_table_names method """ center = 210 # = ksec1( 3) subcenter = 0 # = ksec1(16) local_version = 1 # = ksec1( 8) master_table_version = 0 # = ksec1(15) edition_number = 3 # = ksec0( 3) master_table_number = 0 # = ksec1(14) bufrobj = BUFRInterfaceECMWF() # inspect the location of the ecmwfbufr*.so file, and derive # from this the location of the BUFR tables that are delivered # with the ECMWF BUFR library software ecmwfbufr_path = os.path.split(ecmwfbufr.__file__)[0] path1 = os.path.join(ecmwfbufr_path, "ecmwf_bufrtables") path2 = os.path.join(ecmwfbufr_path, '..', "ecmwf_bufrtables") if os.path.exists(path1): ecmwf_bufr_tables_dir = path1 elif os.path.exists(path2): ecmwf_bufr_tables_dir = path2 else: print("Error: could not find BUFR tables directory") raise IOError # make sure the path is absolute, otherwise the ECMWF library # might fail when it attempts to use it ... bufrobj.ecmwf_bufr_tables_dir = os.path.abspath(ecmwf_bufr_tables_dir) (btable, ctable, dtable) = \ bufrobj.get_expected_ecmwf_bufr_table_names(\ center, subcenter, local_version, master_table_version, edition_number, master_table_number) # print("tabel name B: ", btable) # print("tabel name D: ", dtable) self.assertEqual(btable, 'B0000000000210000001.TXT') self.assertEqual(ctable, 'C0000000000210000001.TXT') self.assertEqual(dtable, 'D0000000000210000001.TXT')