Exemple #1
0
 def test_get_inventory_stationgroup(self):
     """
     Tests get_inventory method for StationGroup, issue #1756.
     """
     client = Client(user='******')
     # 1 - defined @INGV
     with warnings.catch_warnings(record=True) as w:
         warnings.filterwarnings("always")
         result = client.get_inventory(network="_NFOTABOO", route=True)
     self.assertEqual(len(w), 1)
     self.assertEqual(
         str(w[0].message),
         "Routing was requested but parameter 'network' is '_NFOTABOO' "
         "and therefore routing is disabled.")
     self.assertIn('IV', result)
     self.assertIn('IV.ATBU', result)
     self.assertIn('IV.SSFR', result)
     # 2 - defined @NIEP
     result = client.get_inventory(network="_NFOVRANC", route=False)
     self.assertIn('RO', result)
     self.assertIn('RO.BISRR', result)
     self.assertIn('RO.VRI', result)
     # 3 - defined @ETH
     result = client.get_inventory(
         network="_NFOVALAIS", starttime=UTCDateTime(2017, 10, 16),
         endtime=UTCDateTime(2017, 10, 19))
     self.assertIn('CH', result)
     self.assertIn('S', result)
     # self.assertIn('7H', result) This network does not appear to be
     # included in the _NFOVALAIS network anymore. Checked on 03/12/2018
     # at http://eida.gfz-potsdam.de/webdc3/
     self.assertIn('CH.AIGLE', result)
     self.assertIn('CH.VANNI', result)
     self.assertIn('S.ESION', result)
Exemple #2
0
 def test_get_inventory_stationgroup(self):
     """
     Tests get_inventory method for StationGroup, issue #1756.
     """
     client = Client(user='******')
     # 1 - defined @INGV
     with warnings.catch_warnings(record=True) as w:
         warnings.filterwarnings("always")
         result = client.get_inventory(network="_NFOTABOO", route=True)
     self.assertEqual(len(w), 1)
     self.assertEqual(
         str(w[0].message),
         "Routing was requested but parameter 'network' is '_NFOTABOO' "
         "and therefore routing is disabled.")
     self.assertIn('IV', result)
     self.assertIn('IV.ATBU', result)
     self.assertIn('IV.SSFR', result)
     # 2 - defined @NIEP
     result = client.get_inventory(network="_NFOVRANC", route=False)
     self.assertIn('RO', result)
     self.assertIn('RO.BISRR', result)
     self.assertIn('RO.VRI', result)
     # 3 - defined @ETH
     result = client.get_inventory(
         network="_NFOVALAIS", starttime=UTCDateTime(2017, 10, 16),
         endtime=UTCDateTime(2017, 10, 19))
     self.assertIn('CH', result)
     self.assertIn('S', result)
     # self.assertIn('7H', result) This network does not appear to be
     # included in the _NFOVALAIS network anymore. Checked on 03/12/2018
     # at http://eida.gfz-potsdam.de/webdc3/
     self.assertIn('CH.AIGLE', result)
     self.assertIn('CH.VANNI', result)
     self.assertIn('S.ESION', result)
Exemple #3
0
 def test_get_inventory_stationgroup(self):
     """
     Tests get_inventory method for StationGroup, issue #1756.
     """
     client = Client(user='******')
     # 1 - defined @INGV
     with warnings.catch_warnings(record=True) as w:
         warnings.filterwarnings("always")
         result = client.get_inventory(network="_NFOTABOO", route=True)
     self.assertEqual(len(w), 1)
     self.assertEqual(
         str(w[0].message),
         "Routing was requested but parameter 'network' is '_NFOTABOO' "
         "and therefore routing is disabled.")
     self.assertIn('IV', result)
     self.assertIn('IV.ATBU', result)
     self.assertIn('IV.SSFR', result)
     # 2 - defined @NIEP
     result = client.get_inventory(network="_NFOVRANC", route=False)
     self.assertIn('RO', result)
     self.assertIn('RO.BISRR', result)
     self.assertIn('RO.VRI', result)
     # 3 - defined @ETH
     result = client.get_inventory(network="_NFOVALAIS")
     self.assertIn('CH', result)
     self.assertIn('S', result)
     self.assertIn('7H', result)
     self.assertIn('CH.AIGLE', result)
     self.assertIn('CH.VANNI', result)
     self.assertIn('S.ESION', result)
Exemple #4
0
 def test_get_inventory_stationgroup(self):
     """
     Tests get_inventory method for StationGroup, issue #1756.
     """
     client = Client(user='******')
     # 1 - defined @INGV
     with warnings.catch_warnings(record=True) as w:
         warnings.filterwarnings("always")
         result = client.get_inventory(network="_NFOTABOO", route=True)
     self.assertEqual(len(w), 1)
     self.assertEqual(
         str(w[0].message),
         "Routing was requested but parameter 'network' is '_NFOTABOO' "
         "and therefore routing is disabled.")
     self.assertIn('IV', result)
     self.assertIn('IV.ATBU', result)
     self.assertIn('IV.SSFR', result)
     # 2 - defined @NIEP
     result = client.get_inventory(network="_NFOVRANC", route=False)
     self.assertIn('RO', result)
     self.assertIn('RO.BISRR', result)
     self.assertIn('RO.VRI', result)
     # 3 - defined @ETH
     result = client.get_inventory(network="_NFOVALAIS")
     self.assertIn('CH', result)
     self.assertIn('S', result)
     self.assertIn('7H', result)
     self.assertIn('CH.AIGLE', result)
     self.assertIn('CH.VANNI', result)
     self.assertIn('S.ESION', result)
Exemple #5
0
 def test_getInventoryTwice(self):
     """
     Requesting inventory data twice should not fail.
     """
     client = Client(user="******")
     dt = UTCDateTime(2009, 1, 1)
     # station
     client.get_inventory("BW", "MANZ", starttime=dt, endtime=dt + 1)
     client.get_inventory("BW", "MANZ", starttime=dt, endtime=dt + 1)
     # network
     client.get_inventory("BW", starttime=dt, endtime=dt + 1)
     client.get_inventory("BW", starttime=dt, endtime=dt + 1)
 def test_get_inventory_twice(self):
     """
     Requesting inventory data twice should not fail.
     """
     client = Client(user='******')
     dt = UTCDateTime(2009, 1, 1)
     # station
     client.get_inventory('BW', 'MANZ', starttime=dt, endtime=dt + 1)
     client.get_inventory('BW', 'MANZ', starttime=dt, endtime=dt + 1)
     # network
     client.get_inventory('BW', starttime=dt, endtime=dt + 1)
     client.get_inventory('BW', starttime=dt, endtime=dt + 1)
Exemple #7
0
 def test_get_inventory_twice(self):
     """
     Requesting inventory data twice should not fail.
     """
     client = Client(user='******')
     dt = UTCDateTime(2009, 1, 1)
     # station
     client.get_inventory('BW', 'MANZ', starttime=dt, endtime=dt + 1)
     client.get_inventory('BW', 'MANZ', starttime=dt, endtime=dt + 1)
     # network
     client.get_inventory('BW', starttime=dt, endtime=dt + 1)
     client.get_inventory('BW', starttime=dt, endtime=dt + 1)
Exemple #8
0
    def test_getInventoryInstrumentChange(self):
        """
        Check results of get_inventory if instrumentation has been changed.

        Sensitivity change for GE.SNAA..BHZ at 2003-01-10T00:00:00
        """
        client = Client(user="******")
        # one instrument in given time span
        dt = UTCDateTime("2003-01-09T00:00:00")
        inv = client.get_inventory("GE", "SNAA", "", "BHZ", dt, dt + 10, instruments=True, route=False)
        self.assertTrue(len(inv["GE.SNAA..BHZ"]), 1)
        # two instruments in given time span
        dt = UTCDateTime("2003-01-09T23:59:59")
        inv = client.get_inventory("GE", "SNAA", "", "BHZ", dt, dt + 10, instruments=True, route=False)
        self.assertTrue(len(inv["GE.SNAA..BHZ"]), 2)
        # one instrument in given time span
        dt = UTCDateTime("2003-01-10T00:00:00")
        inv = client.get_inventory("GE", "SNAA", "", "BHZ", dt, dt + 10, instruments=True, route=False)
        self.assertTrue(len(inv["GE.SNAA..BHZ"]), 1)
    def test_get_inventory_instrument_change(self):
        """
        Check results of get_inventory if instrumentation has been changed.

        Sensitivity change for GE.SNAA..BHZ at 2003-01-10T00:00:00
        """
        client = Client(user='******')
        # one instrument in given time span
        dt = UTCDateTime("2003-01-09T00:00:00")
        inv = client.get_inventory("GE",
                                   "SNAA",
                                   "",
                                   "BHZ",
                                   dt,
                                   dt + 10,
                                   instruments=True,
                                   route=False)
        self.assertTrue(len(inv['GE.SNAA..BHZ']), 1)
        # two instruments in given time span
        dt = UTCDateTime("2003-01-09T23:59:59")
        inv = client.get_inventory("GE",
                                   "SNAA",
                                   "",
                                   "BHZ",
                                   dt,
                                   dt + 10,
                                   instruments=True,
                                   route=False)
        self.assertTrue(len(inv['GE.SNAA..BHZ']), 2)
        # one instrument in given time span
        dt = UTCDateTime("2003-01-10T00:00:00")
        inv = client.get_inventory("GE",
                                   "SNAA",
                                   "",
                                   "BHZ",
                                   dt,
                                   dt + 10,
                                   instruments=True,
                                   route=False)
        self.assertTrue(len(inv['GE.SNAA..BHZ']), 1)
Exemple #10
0
 def test_getInventory(self):
     """
     Tests get_inventory method on various ArcLink nodes.
     """
     client = Client(user="******")
     dt = UTCDateTime(2010, 1, 1)
     # 1 - GE network
     result = client.get_inventory("GE", "APE", starttime=dt, endtime=dt + 1)
     self.assertIn("GE", result)
     self.assertIn("GE.APE", result)
     # 2 - GE network
     result = client.get_inventory("GE", "APE", "", "BHE", starttime=dt, endtime=dt + 1, instruments=True)
     self.assertIn("GE", result)
     self.assertIn("GE.APE", result)
     self.assertIn("GE.APE..BHE", result)  # only for instruments=True
     # 3 - BW network
     result = client.get_inventory("BW", "RJOB", starttime=dt, endtime=dt + 1)
     self.assertIn("BW", result)
     self.assertIn("BW.RJOB", result)
     # 4 - BW network
     result = client.get_inventory("BW", "MANZ", "", "EHE", starttime=dt, endtime=dt + 1, instruments=True)
     self.assertIn("BW", result)
     self.assertIn("BW.MANZ", result)
     self.assertIn("BW.MANZ..EHE", result)
     # 5 - unknown network 00 via webdc.eu:18002
     self.assertRaises(ArcLinkException, client.get_inventory, "00", "", starttime=dt, endtime=dt + 1)
     # 6 - get channel gain without PAZ
     start = UTCDateTime("1970-01-01 00:00:00")
     end = UTCDateTime("2020-10-19 00:00:00")
     result = client.get_inventory("BW", "MANZ", "", "EHE", start, end)
     self.assertIn("BW", result)
     self.assertIn("BW.MANZ", result)
     self.assertIn("BW.MANZ..EHE", result)
     self.assertEqual(len(result["BW.MANZ..EHE"]), 2)
     self.assertIn("gain", result["BW.MANZ..EHE"][0])
     self.assertNotIn("paz", result["BW.MANZ..EHE"][0])
     # 7 - history of instruments
     # GE.SNAA sometimes needs a while therefore we use command_delay=0.1
     client = Client(user="******", command_delay=0.1)
     result = client.get_inventory("GE", "SNAA", "", "BHZ", start, end, instruments=True)
     self.assertIn("GE", result)
     self.assertIn("GE.SNAA", result)
     self.assertIn("GE.SNAA..BHZ", result)
     self.assertEqual(len(result["GE.SNAA..BHZ"]), 4)
     # sort channel results
     channel = result["GE.SNAA..BHZ"]
     channel = sorted(channel, key=operator.itemgetter("starttime"))
     # check for required attributes
     self.assertEqual(channel[0].starttime, UTCDateTime("1997-03-03"))
     self.assertEqual(channel[0].endtime, UTCDateTime("1999-10-11"))
     self.assertEqual(channel[0].gain, 596224500.0)
     self.assertEqual(channel[1].starttime, UTCDateTime("1999-10-11"))
     self.assertEqual(channel[1].endtime, UTCDateTime("2003-01-10"))
     self.assertEqual(channel[1].gain, 596224500.0)
     self.assertEqual(channel[2].starttime, UTCDateTime("2003-01-10"))
     self.assertEqual(channel[2].endtime, UTCDateTime(2011, 1, 15, 9, 56))
     self.assertEqual(channel[2].gain, 588000000.0)
Exemple #11
0
 def test_get_inventory(self):
     """
     Tests get_inventory method on various ArcLink nodes.
     """
     client = Client(user='******')
     dt = UTCDateTime(2010, 1, 1)
     # 1 - GE network
     result = client.get_inventory('GE',
                                   'APE',
                                   starttime=dt,
                                   endtime=dt + 1)
     self.assertIn('GE', result)
     self.assertIn('GE.APE', result)
     # 2 - GE network
     result = client.get_inventory('GE',
                                   'APE',
                                   '',
                                   'BHE',
                                   starttime=dt,
                                   endtime=dt + 1,
                                   instruments=True)
     self.assertIn('GE', result)
     self.assertIn('GE.APE', result)
     self.assertIn('GE.APE..BHE', result)  # only for instruments=True
     # 3 - BW network
     result = client.get_inventory('BW',
                                   'RJOB',
                                   starttime=dt,
                                   endtime=dt + 1)
     self.assertIn('BW', result)
     self.assertIn('BW.RJOB', result)
     # 4 - BW network
     result = client.get_inventory('BW',
                                   'MANZ',
                                   '',
                                   'EHE',
                                   starttime=dt,
                                   endtime=dt + 1,
                                   instruments=True)
     self.assertIn('BW', result)
     self.assertIn('BW.MANZ', result)
     self.assertIn('BW.MANZ..EHE', result)
     # 5 - unknown network 00 via webdc.eu:18002
     self.assertRaises(ArcLinkException,
                       client.get_inventory,
                       '00',
                       '',
                       starttime=dt,
                       endtime=dt + 1)
     # 6 - get channel gain without PAZ
     start = UTCDateTime("1970-01-01 00:00:00")
     end = UTCDateTime("2020-10-19 00:00:00")
     result = client.get_inventory('BW', 'MANZ', '', 'EHE', start, end)
     self.assertIn('BW', result)
     self.assertIn('BW.MANZ', result)
     self.assertIn('BW.MANZ..EHE', result)
     self.assertEqual(len(result['BW.MANZ..EHE']), 2)
     self.assertIn('gain', result['BW.MANZ..EHE'][0])
     self.assertNotIn('paz', result['BW.MANZ..EHE'][0])
     # 7 - history of instruments
     # GE.SNAA sometimes needs a while therefore we use command_delay=0.1
     client = Client(user='******', command_delay=0.1)
     result = client.get_inventory('GE',
                                   'SNAA',
                                   '',
                                   'BHZ',
                                   start,
                                   end,
                                   instruments=True)
     self.assertIn('GE', result)
     self.assertIn('GE.SNAA', result)
     self.assertIn('GE.SNAA..BHZ', result)
     self.assertEqual(len(result['GE.SNAA..BHZ']), 4)
     # sort channel results
     channel = result['GE.SNAA..BHZ']
     channel = sorted(channel, key=operator.itemgetter('starttime'))
     # check for required attributes
     self.assertEqual(channel[0].starttime, UTCDateTime("1997-03-03"))
     self.assertEqual(channel[0].endtime, UTCDateTime("1999-10-11"))
     self.assertEqual(channel[0].gain, 596224500.0)
     self.assertEqual(channel[1].starttime, UTCDateTime("1999-10-11"))
     self.assertEqual(channel[1].endtime, UTCDateTime("2003-01-10"))
     self.assertEqual(channel[1].gain, 596224500.0)
     self.assertEqual(channel[2].starttime, UTCDateTime("2003-01-10"))
     self.assertEqual(channel[2].endtime, UTCDateTime(2011, 1, 15, 9, 56))
     self.assertEqual(channel[2].gain, 588000000.0)
Exemple #12
0
 def test_get_inventory(self):
     """
     Tests get_inventory method on various ArcLink nodes.
     """
     client = Client(user='******')
     dt = UTCDateTime(2010, 1, 1)
     # 1 - GE network
     result = client.get_inventory('GE', 'APE', starttime=dt,
                                   endtime=dt + 1)
     self.assertIn('GE', result)
     self.assertIn('GE.APE', result)
     # 2 - GE network
     result = client.get_inventory('GE', 'APE', '', 'BHE', starttime=dt,
                                   endtime=dt + 1, instruments=True)
     self.assertIn('GE', result)
     self.assertIn('GE.APE', result)
     self.assertIn('GE.APE..BHE', result)  # only for instruments=True
     # 3 - BW network
     result = client.get_inventory('BW', 'RJOB', starttime=dt,
                                   endtime=dt + 1)
     self.assertIn('BW', result)
     self.assertIn('BW.RJOB', result)
     # 4 - BW network
     result = client.get_inventory('BW', 'MANZ', '', 'EHE', starttime=dt,
                                   endtime=dt + 1, instruments=True)
     self.assertIn('BW', result)
     self.assertIn('BW.MANZ', result)
     self.assertIn('BW.MANZ..EHE', result)
     # 5 - unknown network 00 via webdc.eu:18002
     result = client.get_inventory('00', '', starttime=dt, endtime=dt + 1)
     self.assertIsInstance(result, AttribDict)
     self.assertEqual(result, AttribDict({}))
     # 6 - get channel gain without PAZ
     start = UTCDateTime("1970-01-01 00:00:00")
     end = UTCDateTime("2020-10-19 00:00:00")
     result = client.get_inventory('BW', 'MANZ', '', 'EHE', start, end)
     self.assertIn('BW', result)
     self.assertIn('BW.MANZ', result)
     self.assertIn('BW.MANZ..EHE', result)
     self.assertEqual(len(result['BW.MANZ..EHE']), 2)
     self.assertIn('gain', result['BW.MANZ..EHE'][0])
     self.assertNotIn('paz', result['BW.MANZ..EHE'][0])
     # 7 - history of instruments
     # GE.SNAA sometimes needs a while therefore we use command_delay=0.1
     client = Client(user='******', command_delay=0.1)
     result = client.get_inventory('GE', 'SNAA', '', 'BHZ', start, end,
                                   instruments=True)
     self.assertIn('GE', result)
     self.assertIn('GE.SNAA', result)
     self.assertIn('GE.SNAA..BHZ', result)
     self.assertEqual(len(result['GE.SNAA..BHZ']), 4)
     # sort channel results
     channel = result['GE.SNAA..BHZ']
     channel = sorted(channel, key=operator.itemgetter('starttime'))
     # check for required attributes
     self.assertEqual(channel[0].starttime, UTCDateTime("1997-03-03"))
     self.assertEqual(channel[0].endtime, UTCDateTime("1999-10-11"))
     self.assertEqual(channel[0].gain, 596224500.0)
     self.assertEqual(channel[1].starttime, UTCDateTime("1999-10-11"))
     self.assertEqual(channel[1].endtime, UTCDateTime("2003-01-10"))
     self.assertEqual(channel[1].gain, 596224500.0)
     self.assertEqual(channel[2].starttime, UTCDateTime("2003-01-10"))
     self.assertEqual(channel[2].endtime, UTCDateTime(2011, 1, 15, 9, 56))
     self.assertEqual(channel[2].gain, 588000000.0)