[refs #195] make autoPyLoT export automatic picks in QuakeML format
This commit is contained in:
		
							parent
							
								
									9519372247
								
							
						
					
					
						commit
						9359338e81
					
				
							
								
								
									
										14
									
								
								autoPyLoT.py
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								autoPyLoT.py
									
									
									
									
									
								
							| @ -202,10 +202,15 @@ def autoPyLoT(inputfile): | |||||||
|                 if hasattr(finalpicks, 'getpicdic'): |                 if hasattr(finalpicks, 'getpicdic'): | ||||||
|                     if finalpicks.getpicdic() is not None: |                     if finalpicks.getpicdic() is not None: | ||||||
|                         writephases(finalpicks.getpicdic(), 'HYPO71', hypo71file) |                         writephases(finalpicks.getpicdic(), 'HYPO71', hypo71file) | ||||||
|  |                         data.applyEVTData(finalpicks.getpicdic()) | ||||||
|                     else: |                     else: | ||||||
|                         writephases(picks, 'HYPO71', hypo71file) |                         writephases(picks, 'HYPO71', hypo71file) | ||||||
|  |                         data.applyEVTData(picks) | ||||||
|                 else: |                 else: | ||||||
|                     writephases(picks, 'HYPO71', hypo71file) |                     writephases(picks, 'HYPO71', hypo71file) | ||||||
|  |                     data.applyEVTData(picks) | ||||||
|  |                 fnqml = '%s/autoPyLoT' % event | ||||||
|  |                 data.exportEvent(fnqml) | ||||||
| 
 | 
 | ||||||
|                 endsplash = '''------------------------------------------\n' |                 endsplash = '''------------------------------------------\n' | ||||||
|                                -----Finished event %s!-----\n' |                                -----Finished event %s!-----\n' | ||||||
| @ -318,10 +323,15 @@ def autoPyLoT(inputfile): | |||||||
|             if hasattr(finalpicks, 'getpicdic'): |             if hasattr(finalpicks, 'getpicdic'): | ||||||
|                 if finalpicks.getpicdic() is not None: |                 if finalpicks.getpicdic() is not None: | ||||||
|                     writephases(finalpicks.getpicdic(), 'HYPO71', hypo71file) |                     writephases(finalpicks.getpicdic(), 'HYPO71', hypo71file) | ||||||
|  |                     data.applyEVTData(finalpicks.getpicdic()) | ||||||
|                 else: |                 else: | ||||||
|                     writephases(picks, 'HYPO71', hypo71file) |                     writephases(picks, 'HYPO71', hypo71file) | ||||||
|  |                     data.applyEVTData(picks) | ||||||
|             else: |             else: | ||||||
|                 writephases(picks, 'HYPO71', hypo71file) |                 writephases(picks, 'HYPO71', hypo71file) | ||||||
|  |                 data.applyEVTData(picks) | ||||||
|  |             fnqml =  '%s/%s/autoPyLoT' % (datapath, parameter.getParam('eventID')) | ||||||
|  |             data.exportEvent(fnqml) | ||||||
| 
 | 
 | ||||||
|             endsplash = '''------------------------------------------\n' |             endsplash = '''------------------------------------------\n' | ||||||
|                            -----Finished event %s!-----\n' |                            -----Finished event %s!-----\n' | ||||||
| @ -340,6 +350,7 @@ def autoPyLoT(inputfile): | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| if __name__ == "__main__": | if __name__ == "__main__": | ||||||
|  |     from pylot.core.util.defaults import AUTOMATIC_DEFAULTS | ||||||
|     # parse arguments |     # parse arguments | ||||||
|     parser = argparse.ArgumentParser( |     parser = argparse.ArgumentParser( | ||||||
|         description='''autoPyLoT automatically picks phase onset times using higher order statistics, |         description='''autoPyLoT automatically picks phase onset times using higher order statistics, | ||||||
| @ -349,8 +360,7 @@ if __name__ == "__main__": | |||||||
|                         action='store', |                         action='store', | ||||||
|                         help='''full path to the file containing the input |                         help='''full path to the file containing the input | ||||||
|                         parameters for autoPyLoT''', |                         parameters for autoPyLoT''', | ||||||
|                         default=os.path.join(os.path.expanduser('~'), '.pylot', |                         default=AUTOMATIC_DEFAULTS | ||||||
|                                              'autoPyLoT.in') |  | ||||||
|                         ) |                         ) | ||||||
|     parser.add_argument('-v', '-V', '--version', action='version', |     parser.add_argument('-v', '-V', '--version', action='version', | ||||||
|                         version='autoPyLoT ' + __version__, |                         version='autoPyLoT ' + __version__, | ||||||
|  | |||||||
| @ -417,6 +417,8 @@ class Data(object): | |||||||
|             for station, onsets in picks.items(): |             for station, onsets in picks.items(): | ||||||
|                 print('Reading picks on station %s' % station) |                 print('Reading picks on station %s' % station) | ||||||
|                 for label, phase in onsets.items(): |                 for label, phase in onsets.items(): | ||||||
|  |                     if not isinstance(phase, dict): | ||||||
|  |                         continue | ||||||
|                     onset = phase['mpp'] |                     onset = phase['mpp'] | ||||||
|                     epp = phase['epp'] |                     epp = phase['epp'] | ||||||
|                     lpp = phase['lpp'] |                     lpp = phase['lpp'] | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user