def setUp(self): """ Read a sample catalogue containing 2 events after instantiating the CsvCatalogueParser object. """ filename = os.path.join(self.BASE_DATA_PATH, 'test_gcmt_catalogue.txt') parser = ParseNDKtoGCMT(filename) parser_cent = ParseNDKtoGCMT(filename) self.cat = parser.read_file() self.cat_cent = parser_cent.read_file(use_centroid='True')
def test_without_specifying_years(self): """ Tests that when the catalogue is parsed without specifying the start and end year that the start and end year come from the minimum and maximum in the catalogue """ filename = os.path.join(self.BASE_DATA_PATH, 'test_gcmt_catalogue.txt') parser = ParseNDKtoGCMT(filename) self.cat = parser.read_file() self.assertAlmostEqual(self.cat.start_year, np.min(self.cat.data['year'])) self.assertAlmostEqual(self.cat.end_year, np.max(self.cat.data['year']))