[fix] returning variables now, docstrings corrected to be able to use single quotes in docstrings

This commit is contained in:
Sebastian Wehling-Benatelli 2016-05-18 12:55:04 +02:00
parent 019b801603
commit e62ff9d68c

View File

@ -193,13 +193,13 @@ def picksdict_from_obs(fn):
def picks_to_dict(evt): def picks_to_dict(evt):
''' """
Takes an Event object and return the pick dictionary commonly used within Takes an Event object and return the pick dictionary commonly used within
PyLoT PyLoT
:param evt: Event object contain all available information :param evt: Event object contain all available information
:type evt: `~obspy.core.event.Event` :type evt: `~obspy.core.event.Event`
:return: pick dictionary :return: pick dictionary
''' """
picks = {} picks = {}
for pick in evt.picks: for pick in evt.picks:
phase = {} phase = {}
@ -229,6 +229,7 @@ def picks_to_dict(evt):
picks[station] = onsets.copy() picks[station] = onsets.copy()
return picks return picks
def picks_from_dict(picks): def picks_from_dict(picks):
firstonset = None firstonset = None
for station, onsets in picks.items(): for station, onsets in picks.items():
@ -265,6 +266,7 @@ def picks_from_dict(picks):
print('No polarity information found for %s' % phase) print('No polarity information found for %s' % phase)
if firstonset is None or firstonset > onset: if firstonset is None or firstonset > onset:
firstonset = onset firstonset = onset
return pick, firstonset
def reassess_pilot_event(root_dir, event_id): def reassess_pilot_event(root_dir, event_id):
@ -307,7 +309,7 @@ def reassess_pilot_event(root_dir, event_id):
def writephases(arrivals, fformat, filename): def writephases(arrivals, fformat, filename):
''' """
Function of methods to write phases to the following standard file Function of methods to write phases to the following standard file
formats used for locating earthquakes: formats used for locating earthquakes:
@ -325,7 +327,7 @@ def writephases(arrivals, fformat, filename):
:param: filename, full path and name of phase file :param: filename, full path and name of phase file
:type: string :type: string
''' """
if fformat == 'NLLoc': if fformat == 'NLLoc':
print ("Writing phases to %s for NLLoc" % filename) print ("Writing phases to %s for NLLoc" % filename)
@ -387,7 +389,6 @@ def writephases(arrivals, fformat, filename):
sweight)) sweight))
fid.close() fid.close()
elif fformat == 'HYPO71': elif fformat == 'HYPO71':
print ("Writing phases to %s for HYPO71" % filename) print ("Writing phases to %s for HYPO71" % filename)
fid = open("%s" % filename, 'w') fid = open("%s" % filename, 'w')