当前位置: 首页>>代码示例>>Python>>正文


Python Client.get_waveforms_bulk方法代码示例

本文整理汇总了Python中obspy.fdsn.Client.get_waveforms_bulk方法的典型用法代码示例。如果您正苦于以下问题:Python Client.get_waveforms_bulk方法的具体用法?Python Client.get_waveforms_bulk怎么用?Python Client.get_waveforms_bulk使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在obspy.fdsn.Client的用法示例。


在下文中一共展示了Client.get_waveforms_bulk方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: queryData

# 需要导入模块: from obspy.fdsn import Client [as 别名]
# 或者: from obspy.fdsn.Client import get_waveforms_bulk [as 别名]
	def queryData(self):
		# code from IRIS client 
		#Here we pull the data
		client = Client("IRIS")
		DupStations = []
		DupLocations = []
		DupChannels = []
		self.STAWILD = False
		self.LOCWILD = False
		self.CHANWILD = False
		try:
			requestArray = [(self.network,self.station,self.location, \
				self.channel,self.startTime,self.endTime)]
			print
			if self.debug:
				print(requestArray)
				print 
			self.st = client.get_waveforms_bulk(requestArray)
			for self.tr in self.st:
				#Here we remove the M data quality and go with D
				self.tr.stats.mseed['dataquality'] = 'D'
				if self.debug:
					#print "Here is a trace we have"
					#print(tr.stats)
					if self.station == '*':
						self.STAWILD = True
						DupStations.append(self.tr.stats.station)				
		    			elif self.station != '*':
                				self.STAWILD = False

            				if self.location == '*':
						self.LOCWILD = True	
                				DupLocations.append(self.tr.stats.location)
		    			elif self.location != '*':
						self.LOCWILD = False 
			
					if self.channel == '*':
						self.CHANWILD = True	
                				DupChannels.append(self.tr.stats.channel)
		    			elif self.channel != '*':
						self.CHANWILD = False 
		except:
			print 'Trouble getting data'
			sys.exit(0)
		#takes duplicate stations out of list
		self.stations = list(set(DupStations))
		self.locations = list(set(DupLocations))
		self.channels = list(set(DupChannels))
		print self.stations
		print self.locations
		print self.channels
		# Now call code to store streams in mseed files
		self.storeMSEED()
开发者ID:mkline-usgs,项目名称:getIIdata,代码行数:55,代码来源:getIIdata.py

示例2: queryData

# 需要导入模块: from obspy.fdsn import Client [as 别名]
# 或者: from obspy.fdsn.Client import get_waveforms_bulk [as 别名]
	def queryData(self):
		# code from IRIS client 
		# Here we pull the data
		client = Client("IRIS")
		DupStations = []
		DupLocations = []
		DupChannels = []
		self.st = Stream()
		self.STAWILD = False
		self.LOCWILD = False
		self.CHANWILD = False
		
		try:
			timeout = 300
			socket.setdefaulttimeout(timeout)
			# this needs to have a get_waveform that queries data 1 hour at a time
			# data cant query right now if the data is too bulky
			# also needs to include a timeout exception
			for hourIndex in range(0,self.hours): #this cant be days... has to be hours
				self.startTime1 = self.startTime + (hourIndex)*1*60*60
				self.endTime1 = self.startTime + (hourIndex+1)*1*60*60
				requestArray = [(self.network,self.station,self.location, \
					self.channel,self.startTime1,self.endTime1)]
				self.st1 = client.get_waveforms_bulk(requestArray)
				self.st += self.st1
				print self.st	
				print
				#self.st = client.get_waveforms_bulk(timeout=10,requestArray)
				
			for self.tr in self.st:
				#Here we remove the M data quality and go with D
				self.tr.stats.mseed['dataquality'] = 'D'
				if self.debug:
					if self.station == '*':
						self.STAWILD = True
						DupStations.append(self.tr.stats.station)				
		    			elif self.station != '*':
                				self.STAWILD = False
	
            				if self.location == '*':
						self.LOCWILD = True	
                				DupLocations.append(self.tr.stats.location)
		    			elif self.location != '*':
						self.LOCWILD = False 
				
					if self.channel == '*':
						self.CHANWILD = True	
                				DupChannels.append(self.tr.stats.channel)
		    			elif self.channel != '*':
						self.CHANWILD = False 
		#except TimeoutError:
			#print 'Get waveform timeout, exiting...'
			#sys.exit(0)	
		except:
			print 'Trouble getting data'
			sys.exit(0)
		
		# Takes duplicate stations out of list and 
		# makes station, location, and channel into an array 
		# for looping( probably easier way but it works)
		self.stations = list(set(DupStations))
		if self.station != '*':
			self.stations.append(self.station)
		self.locations = list(set(DupLocations))
		if self.location != '*':
			self.locations.append(self.location)
		self.channels = list(set(DupChannels))
		if self.channel != '*':	
			self.channels.append(self.channel)
		print
		print "Station(s) being pulled: " + str(self.stations)
		print "Location(s) being pulled: " + str(self.locations)
		print "Channel(s) being pulled: " + str(self.channels)
			
		# Now call code to store streams in mseed files
		self.storeMSEED()
开发者ID:aringler-usgs,项目名称:getIIdata,代码行数:78,代码来源:getIIdata.py


注:本文中的obspy.fdsn.Client.get_waveforms_bulk方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。