Exemple #1
0
def test_reading_more_complex_resp_file():
    """
    Tests reading a slightly more complex RESP file. This one contains two
    (identical!!!) channels. That is pretty much the maximum complexity of
    RESP files.
    """
    filename = os.path.join(data_dir, "RESP.AF.DODT..BHE")
    channels = simple_resp_parser.get_inventory(filename)
    assert len(channels) == 2
    channel = channels[0]
    assert channel["network"] == "AF"
    assert channel["station"] == "DODT"
    assert channel["location"] == ""
    assert channel["channel"] == "BHE"
    assert channel["start_date"] == obspy.UTCDateTime(2009, 8, 9, 0)
    assert channel["end_date"] is None
    assert channel["channel_id"] == "AF.DODT..BHE"
    # The two have the same information for some reason...
    channel = channels[1]
    assert channel["network"] == "AF"
    assert channel["station"] == "DODT"
    assert channel["location"] == ""
    assert channel["channel"] == "BHE"
    assert channel["start_date"] == obspy.UTCDateTime(2009, 8, 9, 0)
    assert channel["end_date"] is None
    assert channel["channel_id"] == "AF.DODT..BHE"
def test_reading_more_complex_resp_file():
    """
    Tests reading a slightly more complex RESP file. This one contains two
    (identical!!!) channels. That is pretty much the maximum complexity of
    RESP files.
    """
    filename = os.path.join(data_dir, "RESP.AF.DODT..BHE")
    channels = simple_resp_parser.get_inventory(filename)
    assert len(channels) == 2
    channel = channels[0]
    assert channel["network"] == "AF"
    assert channel["station"] == "DODT"
    assert channel["location"] == ""
    assert channel["channel"] == "BHE"
    assert channel["start_date"] == obspy.UTCDateTime(2009, 8, 9, 0)
    assert channel["end_date"] is None
    assert channel["channel_id"] == "AF.DODT..BHE"
    # The two have the same information for some reason...
    channel = channels[1]
    assert channel["network"] == "AF"
    assert channel["station"] == "DODT"
    assert channel["location"] == ""
    assert channel["channel"] == "BHE"
    assert channel["start_date"] == obspy.UTCDateTime(2009, 8, 9, 0)
    assert channel["end_date"] is None
    assert channel["channel_id"] == "AF.DODT..BHE"
Exemple #3
0
    def _extract_index_values_resp(filename):
        try:
            channels = simple_resp_parser.get_inventory(filename,
                                                        remove_duplicates=True)
        except:
            msg = "Not a valid RESP file?"
            raise StationCacheError(msg)

        channels = [[
            _i["channel_id"], int(_i["start_date"].timestamp),
            int(_i["end_date"].timestamp) if _i["end_date"] else None,
            None, None, None, None] for _i in channels]

        return channels
Exemple #4
0
def test_reading_simple_resp_file():
    """
    Tests reading of a very simple RESP file.
    """
    filename = os.path.join(data_dir, "RESP.G.FDF.00.BHE")
    channels = simple_resp_parser.get_inventory(filename)
    assert len(channels) == 1
    channel = channels[0]
    assert channel["network"] == "G"
    assert channel["station"] == "FDF"
    assert channel["location"] == "00"
    assert channel["channel"] == "BHE"
    assert channel["start_date"] == obspy.UTCDateTime(2006, 11, 22, 13)
    assert channel["end_date"] is None
    assert channel["channel_id"] == "G.FDF.00.BHE"
def test_removing_duplicates():
    """
    Tests the removal of duplicates.
    """
    filename = os.path.join(data_dir, "RESP.AF.DODT..BHE")
    channels = simple_resp_parser.get_inventory(filename, remove_duplicates=True)
    assert len(channels) == 1
    channel = channels[0]
    assert channel["network"] == "AF"
    assert channel["station"] == "DODT"
    assert channel["location"] == ""
    assert channel["channel"] == "BHE"
    assert channel["start_date"] == obspy.UTCDateTime(2009, 8, 9, 0)
    assert channel["end_date"] is None
    assert channel["channel_id"] == "AF.DODT..BHE"
def test_reading_simple_resp_file():
    """
    Tests reading of a very simple RESP file.
    """
    filename = os.path.join(data_dir, "RESP.G.FDF.00.BHE")
    channels = simple_resp_parser.get_inventory(filename)
    assert len(channels) == 1
    channel = channels[0]
    assert channel["network"] == "G"
    assert channel["station"] == "FDF"
    assert channel["location"] == "00"
    assert channel["channel"] == "BHE"
    assert channel["start_date"] == obspy.UTCDateTime(2006, 11, 22, 13)
    assert channel["end_date"] is None
    assert channel["channel_id"] == "G.FDF.00.BHE"
Exemple #7
0
def test_removing_duplicates():
    """
    Tests the removal of duplicates.
    """
    filename = os.path.join(data_dir, "RESP.AF.DODT..BHE")
    channels = simple_resp_parser.get_inventory(filename,
                                                remove_duplicates=True)
    assert len(channels) == 1
    channel = channels[0]
    assert channel["network"] == "AF"
    assert channel["station"] == "DODT"
    assert channel["location"] == ""
    assert channel["channel"] == "BHE"
    assert channel["start_date"] == obspy.UTCDateTime(2009, 8, 9, 0)
    assert channel["end_date"] is None
    assert channel["channel_id"] == "AF.DODT..BHE"