[edit] implemented loop over PILOT database for reassessment
additionally the output of reassess_pilot_event is more verbose now
This commit is contained in:
parent
3705eb567b
commit
c7d7acd7e3
@ -267,7 +267,16 @@ def picks_from_picksdict(picks):
|
|||||||
return picks_list
|
return picks_list
|
||||||
|
|
||||||
|
|
||||||
def reassess_pilot_event(root_dir, event_id, fn_param=None):
|
def reassess_pilot_db(root_dir, out_dir=None, fn_param=None):
|
||||||
|
import glob
|
||||||
|
|
||||||
|
evt_list = glob.glob1(root_dir,'e????.???.??')
|
||||||
|
|
||||||
|
for evt in evt_list:
|
||||||
|
reassess_pilot_event(root_dir, evt, out_dir, fn_param)
|
||||||
|
|
||||||
|
|
||||||
|
def reassess_pilot_event(root_dir, event_id, out_dir=None, fn_param=None):
|
||||||
from obspy import read
|
from obspy import read
|
||||||
|
|
||||||
from pylot.core.io.inputs import AutoPickParameter
|
from pylot.core.io.inputs import AutoPickParameter
|
||||||
@ -283,7 +292,9 @@ def reassess_pilot_event(root_dir, event_id, fn_param=None):
|
|||||||
phases_file = glob.glob(os.path.join(search_base, 'PHASES.mat'))
|
phases_file = glob.glob(os.path.join(search_base, 'PHASES.mat'))
|
||||||
if not phases_file:
|
if not phases_file:
|
||||||
return
|
return
|
||||||
|
print('Opening PILOT phases file: {fn}'.format(fn=phases_file[0]))
|
||||||
picks_dict = picks_from_pilot(phases_file[0])
|
picks_dict = picks_from_pilot(phases_file[0])
|
||||||
|
print('Dictionary read from PHASES.mat:\n{0}'.format(picks_dict))
|
||||||
for station in picks_dict.keys():
|
for station in picks_dict.keys():
|
||||||
fn_pattern = os.path.join(search_base, '{0}*'.format(station))
|
fn_pattern = os.path.join(search_base, '{0}*'.format(station))
|
||||||
try:
|
try:
|
||||||
@ -320,7 +331,10 @@ def reassess_pilot_event(root_dir, event_id, fn_param=None):
|
|||||||
evt = ope.Event(resource_id=event_id)
|
evt = ope.Event(resource_id=event_id)
|
||||||
evt.picks = picks_from_picksdict(picks_dict)
|
evt.picks = picks_from_picksdict(picks_dict)
|
||||||
# write phase information to file
|
# write phase information to file
|
||||||
|
if not out_dir:
|
||||||
fnout_prefix = os.path.join(root_dir, event_id, '{0}.'.format(event_id))
|
fnout_prefix = os.path.join(root_dir, event_id, '{0}.'.format(event_id))
|
||||||
|
else:
|
||||||
|
fnout_prefix = os.path.join(out_dir, event_id, '{0}.'.format(event_id))
|
||||||
evt.write(fnout_prefix + 'xml', format='QUAKEML')
|
evt.write(fnout_prefix + 'xml', format='QUAKEML')
|
||||||
#evt.write(fnout_prefix + 'cnv', format='VELEST')
|
#evt.write(fnout_prefix + 'cnv', format='VELEST')
|
||||||
|
|
||||||
|
@ -21,4 +21,4 @@ if __name__ == '__main__':
|
|||||||
)
|
)
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
reassess_pilot_event(args.dir, args.id)
|
reassess_pilot_event(args.dir, args.id, None)
|
||||||
|
Loading…
Reference in New Issue
Block a user