def test_readRESPFunction(self): """ Tests the _read_RESP() function. This function expects a StringIO as an input file. """ resp_file = os.path.join(self.data_dir, "RESP.PM.PFVI..BHZ") with open(resp_file, "r") as open_file: data = StringIO.StringIO(open_file.read()) data.seek(0, 0) # This file only contains information about one channel. Check it. channels = station_mappers._read_RESP(data) self.assertEqual(len(channels), 1) self.assertEqual(channels, [ {"network": "PM", "station": "PFVI", "location": "", "channel": "BHZ", "start_date": UTCDateTime(2007, 1, 1), "end_date": None, "format": "RESP", "latitude": None, "longitude": None, "elevation": None, "local_depth": None}])
def test_multiple_identical_channels_in_RESP(self): """ Some RESP files have identical versions of the same channel in one file. This is a faulty file. In this case, only one version of the channel is returned. """ # The file contains the same channel time span twice. Only one should # be returned. resp_file = os.path.join(self.data_dir, "RESP.IW.TPAW..BHE") with open(resp_file, "r") as open_file: data = StringIO.StringIO(open_file.read()) data.seek(0, 0) # This file only contains information about one channel. Check it. channels = station_mappers._read_RESP(data) self.assertEqual(len(channels), 1) self.assertEqual(channels[0], {"station": "TPAW", "longitude": None, "network": "IW", "end_date": UTCDateTime(2999, 12, 31, 23, 59, 59), "format": "RESP", "latitude": None, "elevation": None, "local_depth": None, "start_date": UTCDateTime(2004, 7, 1, 0, 0), "channel": "BHE", "location": ""})