From a3153844174184b386f216be8bea7a0d3344c047 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludger=20K=C3=BCperkoch?= Date: Tue, 27 Oct 2015 10:01:07 +0100 Subject: [PATCH] New function writephases.py for writing phases files for various kinds of location routines. Started with NLLoc-phase file. --- pylot/core/pick/utils.py | 43 +++++++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/pylot/core/pick/utils.py b/pylot/core/pick/utils.py index 9feabbb8..34b0c207 100644 --- a/pylot/core/pick/utils.py +++ b/pylot/core/pick/utils.py @@ -961,11 +961,44 @@ def writephases(arrivals, fformat, filename): fid.write('# EQEVENT: Label: EQ001 Loc: X 0.00 Y 0.00 Z 10.00 OT 0.00 \n') for key in arrivals: if arrivals[key]['P']['weight'] < 4: - # NLLoc only knows weight 0 (do not use pick) - # and weight 1 (use pick) - NLLocweight = 1 - # write phase information to file - fid.write('%s \n' % key) + fm = arrivals[key]['P']['fm'] + onset = arrivals[key]['P']['mpp'] + year = onset.year + month = onset.month + day = onset.day + hh = onset.hour + mm = onset.minute + ss = onset.second + ms = onset.microsecond + ss_ms = ss + ms / 1000000.0 + fid.write('%s ? ? ? P %s %d%02d%02d %02d%02d %7.4f GAU 0 0 0 0 1 \n' % (key, + fm, + year, + month, + day, + hh, + mm, + ss_ms)) + if arrivals[key]['S']['weight'] < 4: + fm = '?' + onset = arrivals[key]['S']['mpp'] + year = onset.year + month = onset.month + day = onset.day + hh = onset.hour + mm = onset.minute + ss = onset.second + ms = onset.microsecond + ss_ms = ss + ms / 1000000.0 + fid.write('%s ? ? ? S %s %d%02d%02d %02d%02d %7.4f GAU 0 0 0 0 1 \n' % (key, + fm, + year, + month, + day, + hh, + mm, + ss_ms)) + fid.close()