[enhancement, task] there was no routine to read obs pick files available; default values for autopicking should be the same for all parts of PyLoT, thus defaults should be defined only once
This commit is contained in:
		
							parent
							
								
									2a8729c39b
								
							
						
					
					
						commit
						a9cd53886b
					
				| @ -45,7 +45,8 @@ from pylot.core.read.inputs import FilterOptions, AutoPickParameter | ||||
| from pylot.core.pick.autopick import autopickevent | ||||
| from pylot.core.read.io import picks_from_evt | ||||
| from pylot.core.loc.nll import locate as locateNll | ||||
| from pylot.core.util.defaults import FILTERDEFAULTS, COMPNAME_MAP | ||||
| from pylot.core.util.defaults import FILTERDEFAULTS, COMPNAME_MAP,\ | ||||
|     AUTOMATIC_DEFAULTS | ||||
| from pylot.core.util.errors import FormatError, DatastructureError, \ | ||||
|     OverwriteError | ||||
| from pylot.core.util.connection import checkurl | ||||
| @ -689,8 +690,7 @@ class MainWindow(QMainWindow): | ||||
|         self.logDockWidget.setWidget(self.listWidget) | ||||
|         self.addDockWidget(Qt.LeftDockWidgetArea, self.logDockWidget) | ||||
|         self.addListItem('loading default values for local data ...') | ||||
|         home = os.path.expanduser("~") | ||||
|         autopick_parameter = AutoPickParameter('%s/.pylot/autoPyLoT_local.in' % home) | ||||
|         autopick_parameter = AutoPickParameter(AUTOMATIC_DEFAULTS) | ||||
|         self.addListItem(str(autopick_parameter)) | ||||
| 
 | ||||
|         # Create the worker thread and run it | ||||
|  | ||||
| @ -135,6 +135,24 @@ def readPILOTEvent(phasfn=None, locfn=None, authority_id=None, **kwargs): | ||||
|         raise AttributeError('{0} - Matlab LOC files {1} and {2} contains \ | ||||
|                               insufficient data!'.format(e, phasfn, locfn)) | ||||
| 
 | ||||
| def picks_from_obs(fn): | ||||
|     picks = dict() | ||||
|     station_name = str() | ||||
|     for line in open(fn, 'r'): | ||||
|         if line.startswith('#'): | ||||
|             continue | ||||
|         else: | ||||
|             phase_line = line.split() | ||||
|             if not station_name == phase_line[0]: | ||||
|                 phase = dict() | ||||
|             station_name = phase_line[0] | ||||
|             phase_name = phase_line[4].upper() | ||||
|             pick = UTCDateTime(phase_line[6] + phase_line[7] + phase_line[8]) | ||||
|             phase[phase_name] = dict(mpp=pick, fm=phase_line[5]) | ||||
|             picks[station_name] = phase | ||||
|     return picks | ||||
| 
 | ||||
| 
 | ||||
| def picks_from_evt(evt): | ||||
|     ''' | ||||
|     Takes an Event object and return the pick dictionary commonly used within | ||||
|  | ||||
| @ -43,6 +43,10 @@ FILTERDEFAULTS = readFilterInformation(os.path.join(os.path.expanduser('~'), | ||||
|                                                     '.pylot', | ||||
|                                                     'filter.in')) | ||||
| 
 | ||||
| AUTOMATIC_DEFAULTS = os.path.join(os.path.expanduser('~'), | ||||
|                                   '.pylot', | ||||
|                                   'autoPyLoT.in') | ||||
| 
 | ||||
| OUTPUTFORMATS = {'.xml': 'QUAKEML', | ||||
|                  '.cnv': 'CNV', | ||||
|                  '.obs': 'NLLOC_OBS'} | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user