當前位置: 首頁>>代碼示例>>Python>>正文


Python Client.getEvents方法代碼示例

本文整理匯總了Python中obspy.neries.Client.getEvents方法的典型用法代碼示例。如果您正苦於以下問題:Python Client.getEvents方法的具體用法?Python Client.getEvents怎麽用?Python Client.getEvents使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在obspy.neries.Client的用法示例。


在下文中一共展示了Client.getEvents方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_getEventsWithUTCDateTimes

# 需要導入模塊: from obspy.neries import Client [as 別名]
# 或者: from obspy.neries.Client import getEvents [as 別名]
 def test_getEventsWithUTCDateTimes(self):
     """
     Testing event request method with UTCDateTimes as input parameters.
     """
     client = Client()
     # 1
     results = client.getEvents(format="list", min_depth=-700,
                                max_datetime=UTCDateTime("2005-01-01"))
     expected = [{'author': u'EMSC', 'event_id': u'20040312_0000026',
                  'origin_id': 1347097, 'longitude': 57.143,
                  'datetime': UTCDateTime('2004-03-12T22:48:05Z'),
                  'depth': -700.0, 'magnitude': 4.4,
                  'magnitude_type': u'mb',
                  'latitude': 26.303, 'flynn_region': u'SOUTHERN IRAN'}]
     self.assertEqual(results, expected)
     # 2
     results = client.getEvents(format="list", min_depth=-700,
                                min_datetime=UTCDateTime("2004-01-01"),
                                max_datetime=UTCDateTime("2005-01-01"))
     expected = [{'author': u'EMSC', 'event_id': u'20040312_0000026',
                  'origin_id': 1347097, 'longitude': 57.143,
                  'datetime': UTCDateTime('2004-03-12T22:48:05Z'),
                  'depth': -700.0, 'magnitude': 4.4,
                  'magnitude_type': u'mb',
                  'latitude': 26.303, 'flynn_region': u'SOUTHERN IRAN'}]
     self.assertEqual(results, expected)
開發者ID:Ciack404,項目名稱:obspy,代碼行數:28,代碼來源:test_client.py

示例2: test_getEventsAsCatalog

# 需要導入模塊: from obspy.neries import Client [as 別名]
# 或者: from obspy.neries.Client import getEvents [as 別名]
 def test_getEventsAsCatalog(self):
     """
     Testing event request with Catalog as output format.
     """
     client = Client()
     cat = client.getEvents(format="catalog", min_depth=-700,
                            max_datetime=UTCDateTime("2005-01-01"))
     self.assertTrue(isinstance(cat, Catalog))
     # check for origin id
     self.assertTrue(cat[0].preferred_origin_id.endswith('1347097'))
開發者ID:msimon00,項目名稱:obspy,代碼行數:12,代碼來源:test_client.py

示例3: test_getEventsAsQuakeML

# 需要導入模塊: from obspy.neries import Client [as 別名]
# 或者: from obspy.neries.Client import getEvents [as 別名]
 def test_getEventsAsQuakeML(self):
     """
     Testing event request with QuakeML as output format.
     """
     client = Client()
     results = client.getEvents(format="xml", min_depth=-700,
                                max_datetime=UTCDateTime("2005-01-01"))
     self.assertTrue(isinstance(results, basestring))
     # check for origin id
     self.assertTrue('1347097' in results)
開發者ID:msimon00,項目名稱:obspy,代碼行數:12,代碼來源:test_client.py

示例4: get_events

# 需要導入模塊: from obspy.neries import Client [as 別名]
# 或者: from obspy.neries.Client import getEvents [as 別名]
 def get_events(self):
     """
     Method to fetch updated list of events to use in plot.
     """
     with self.lock:
         start, end = self.stream[0].stats.starttime, self.stream[0].stats.endtime
     c = Client()
     events = c.getEvents(min_datetime=start, max_datetime=end,
                          format="catalog",
                          min_magnitude=self.args.events)
     return events
開發者ID:ThomasLecocq,項目名稱:seedlink_plotter,代碼行數:13,代碼來源:seedlink_plotter.py

示例5: test_issue531

# 需要導入模塊: from obspy.neries import Client [as 別名]
# 或者: from obspy.neries.Client import getEvents [as 別名]
 def test_issue531(self):
     """
     Event_type "other" has been replaced by "other event" in recent
     QuakeML version
     """
     client = Client(user='[email protected]')
     events = client.getEvents(minlon=-30, maxlon=40, minlat=30, maxlat=90,
         min_datetime=UTCDateTime(2000, 4, 11, 11, 24, 31),
         max_datetime=UTCDateTime(2000, 4, 11, 11, 24, 32),
         minmag=5.5, format='catalog')
     self.assertEquals(len(events), 1)
     self.assertEquals(events[0].event_type, 'other event')
開發者ID:miili,項目名稱:obspy,代碼行數:14,代碼來源:test_client.py

示例6: test_getEventsList

# 需要導入模塊: from obspy.neries import Client [as 別名]
# 或者: from obspy.neries.Client import getEvents [as 別名]
 def test_getEventsList(self):
     """
     Testing event request method.
     """
     client = Client()
     # 1
     results = client.getEvents(format="list", min_depth=-700,
                                max_datetime="2005-01-01")
     expected = [{'author': u'EMSC', 'event_id': u'20040312_0000026',
                  'origin_id': 1347097, 'longitude': 57.143,
                  'datetime': UTCDateTime('2004-03-12T22:48:05Z'),
                  'depth':-700.0, 'magnitude': 4.4, 'magnitude_type': u'mb',
                  'latitude': 26.303, 'flynn_region': u'SOUTHERN IRAN'}]
     self.assertEquals(results, expected)
     # 2
     results = client.getEvents(format="list", min_latitude=-95,
                                max_latitude=-1, min_longitude=20,
                                max_longitude=90, max_datetime="2005-01-01")
     expected = [{'author': u'NEIR', 'event_id': u'20041016_0000009',
                  'origin_id': 120690, 'longitude': 33.682,
                  'datetime': UTCDateTime('2004-10-16T01:29:14Z'),
                  'depth':-10.0, 'magnitude': 5.0, 'magnitude_type': u'm ',
                  'latitude':-46.394,
                  'flynn_region': u'PRINCE EDWARD ISLANDS REGION'}]
     self.assertEquals(results, expected)
     # 3
     results = client.getEvents(format="list", min_depth=-11,
                                max_depth=-22.33, min_magnitude=6.6,
                                max_magnitude=7, max_datetime="2005-01-01")
     expected = [{'author': u'EMSC', 'event_id': u'20001206_0000014',
                  'origin_id': 1441886, 'longitude': 54.843,
                  'datetime': UTCDateTime('2000-12-06T17:11:05Z'),
                  'depth':-11.4, 'magnitude': 6.7, 'magnitude_type': u'mb',
                  'latitude': 39.604},
                 {'author': u'EMSC', 'event_id': u'20010210_0000010',
                  'origin_id': 1438991, 'longitude': 43.784,
                  'datetime': UTCDateTime('2001-02-10T18:21:57Z'),
                  'depth':-17.0, 'magnitude': 6.6,
                  'magnitude_type': u'mb', 'latitude': 12.045,
                  'flynn_region': u'NEAR THE COAST OF YEMEN'}]
     self.assertEquals(results, expected)
     # 4
     results = client.getEvents(format="list", author="EMSC", max_results=3,
                                magnitude_type="mw", min_magnitude=4,
                                max_datetime="2005-01-01")
     expected = [{'author': u'EMSC', 'event_id': u'19980110_0000006',
                  'origin_id': 1500183, 'longitude': 20.816,
                  'datetime': UTCDateTime('1998-01-10T19:21:55Z'),
                  'depth':-10.0, 'magnitude': 5.5, 'magnitude_type': u'mw',
                  'latitude': 37.243, 'flynn_region': u'IONIAN SEA'},
                 {'author': u'EMSC', 'event_id': u'19980128_0000006',
                  'origin_id': 1500249, 'longitude': 32.204,
                  'datetime': UTCDateTime('1998-01-28T22:38:57Z'),
                  'depth':-41.6, 'magnitude': 4.3, 'magnitude_type': u'mw',
                  'latitude': 34.429},
                 {'author': u'EMSC', 'event_id': u'19980213_0000004',
                  'origin_id': 1500135, 'longitude': 28.459,
                  'datetime': UTCDateTime('1998-02-13T07:18:50Z'),
                  'depth':-69.2, 'magnitude': 4.8, 'magnitude_type': u'mw',
                  'latitude': 36.284}]
     self.assertEquals(results, expected)
開發者ID:msimon00,項目名稱:obspy,代碼行數:63,代碼來源:test_client.py

示例7: plotDay

# 需要導入模塊: from obspy.neries import Client [as 別名]
# 或者: from obspy.neries.Client import getEvents [as 別名]
 def plotDay(self, *args, **kwargs):
     """
     Extend the seismogram.
     """
     # Merge and trim to pad.
     self.stream.merge()
     if len(self.stream) != 1:
         msg = "All traces need to be of the same id for a dayplot"
         raise ValueError(msg)
     self.stream.trim(self.starttime, self.endtime, pad=True)
     # Get minmax array.
     self.__dayplotGetMinMaxValues(self, *args, **kwargs)
     # Normalize array
     self.__dayplotNormalizeValues(self, *args, **kwargs)
     # Get timezone information. If none is  given, use local time.
     self.time_offset = kwargs.get('time_offset',
         round((UTCDateTime(datetime.now()) - UTCDateTime()) / 3600.0, 2))
     self.timezone = kwargs.get('timezone', 'local time')
     # Try to guess how many steps are needed to advance one full time unit.
     self.repeat = None
     intervals = self.extreme_values.shape[0]
     if self.interval < 60 and 60 % self.interval == 0:
         self.repeat = 60 / self.interval
     elif self.interval < 1800 and 3600 % self.interval == 0:
         self.repeat = 3600 / self.interval
     # Otherwise use a maximum value of 10.
     else:
         if intervals >= 10:
             self.repeat = 10
         else:
             self.repeat = intervals
     # Create axis to plot on.
     if self.background_color:
         ax = self.fig.add_subplot(1, 1, 1, axisbg=self.background_color)
     else:
         ax = self.fig.add_subplot(1, 1, 1)
     # Adjust the subplots
     self.fig.subplots_adjust(left=self.subplots_adjust_left,
                              right=self.subplots_adjust_right,
                              top=self.subplots_adjust_top,
                              bottom=self.subplots_adjust_bottom)
     # Create x_value_array.
     aranged_array = np.arange(self.width)
     x_values = np.empty(2 * self.width)
     x_values[0::2] = aranged_array
     x_values[1::2] = aranged_array
     intervals = self.extreme_values.shape[0]
     # Loop over each step.
     for _i in xrange(intervals):
         # Create offset array.
         y_values = np.ma.empty(self.width * 2)
         y_values.fill(intervals - (_i + 1))
         # Add min and max values.
         y_values[0::2] += self.extreme_values[_i, :, 0]
         y_values[1::2] += self.extreme_values[_i, :, 1]
         # Plot the values.
         ax.plot(x_values, y_values,
                 color=self.color[_i % len(self.color)],
                 linewidth=self.linewidth, linestyle=self.linestyle)
     # Plot the scale, if required.
     scale_unit = kwargs.get("data_unit", None)
     if scale_unit is not None:
         self._plotDayplotScale(unit=scale_unit)
     # Set ranges.
     ax.set_xlim(0, self.width - 1)
     ax.set_ylim(-0.3, intervals + 0.3)
     self.axis = [ax]
     # Set ticks.
     self.__dayplotSetYTicks(*args, **kwargs)
     self.__dayplotSetXTicks(*args, **kwargs)
     # Choose to show grid but only on the x axis.
     self.fig.axes[0].grid(color=self.grid_color,
                           linestyle=self.grid_linestyle,
                           linewidth=self.grid_linewidth)
     self.fig.axes[0].yaxis.grid(False)
     # Set the title of the plot.
     self.fig.suptitle(self.title, fontsize=self.title_size)
     # Now try to plot some events.
     events = kwargs.get("events", [])
     # Potentially download some events with the help of obspy.neries.
     if "min_magnitude" in events:
         try:
             from obspy.neries import Client
             c = Client()
             events = c.getEvents(min_datetime=self.starttime,
                                  max_datetime=self.endtime,
                                  format="catalog",
                                  min_magnitude=events["min_magnitude"])
         except Exception, e:
             msg = "Could not download the events because of '%s: %s'." % \
                 (e.__class__.__name__, e.message)
             warnings.warn(msg)
開發者ID:nloadholtes,項目名稱:obspy,代碼行數:94,代碼來源:waveform.py


注:本文中的obspy.neries.Client.getEvents方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。