Exemplo n.º 1
0
    def inv_issue_115(self):
        """ Get an inventory for testing issue 115. """

        sta1 = dict(
            network="LF",
            location="",
            station="BOB",
            channel="HHZ",
            start_date="2019-01-01",
            enddate="2100-01-01",
            sample_rate=250,
            latitude=0,
            longitude=0,
            elevation=0,
            depth=0,
        )
        sta2 = dict(
            network="01",
            location="",
            station="01",
            channel="BHZ",
            start_date="2019-01-01",
            enddate="2100-01-01",
            sample_rate=1000,
            latitude=0,
            longitude=0,
            elevation=0,
            depth=0,
        )

        return df_to_inventory(pd.DataFrame([sta1, sta2]))
Exemplo n.º 2
0
 def test_response(self, df_with_response):
     """ Ensure the NRL is used to pull responses. """
     inv = df_to_inventory(df_with_response)
     assert isinstance(inv, obspy.Inventory)
     for net in inv:
         for sta in net:
             for chan in sta:
                 assert chan.response is not None
Exemplo n.º 3
0
 def test_column_dtypes(self, dummy_df):
     """ Make sure data types get set (particularly for NSLC columns) """
     inv = df_to_inventory(dummy_df)
     for network in inv.networks:
         assert network.code == "1"
         for station in network:
             assert station.code == "1"
         for channel in station:
             assert channel.code == "1"
             assert channel.location_code == "1"
 def test_NaN_in_non_time_columns(self, df_from_inv):
     """
     If there are NaN values in non-time these should just be interp.
     as None.
     """
     df_from_inv.loc[2, "dip"] = np.NaN
     df_from_inv.loc[3, "azimuth"] = np.NaN
     # convert to inv
     inv = df_to_inventory(df_from_inv)
     # make sure dip is None
     dip_row = df_from_inv.loc[2]
     kwargs = {x: getattr(dip_row, x) for x in NSLC}
     inv_sub = inv.get_stations(**kwargs)
     assert inv_sub[0][0][0].dip is None
     # make sure azimuth is None
     dip_row = df_from_inv.loc[3]
     kwargs = {x: getattr(dip_row, x) for x in NSLC}
     inv_sub = inv.get_stations(**kwargs)
     assert inv_sub[0][0][0].azimuth is None
 def inv_from_df(self, df_from_inv):
     """ convert the station df back into an inventory. """
     return df_to_inventory(df_from_inv)