From 67e2ba3ad7df6d7a463cae1414c76f62b9227e6e Mon Sep 17 00:00:00 2001 From: Ludger Kueperkoch Date: Tue, 15 Jun 2021 11:18:24 +0200 Subject: [PATCH] Additional screen output, temporarily comment amplitude info for obs-file. --- pylot/core/analysis/magnitude.py | 13 ++++++++++--- pylot/core/io/data.py | 14 +++++++------- pylot/core/io/phases.py | 1 + 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/pylot/core/analysis/magnitude.py b/pylot/core/analysis/magnitude.py index 40e98a48..ac6705ac 100644 --- a/pylot/core/analysis/magnitude.py +++ b/pylot/core/analysis/magnitude.py @@ -282,12 +282,13 @@ class LocalMagnitude(Magnitude): for a in self.arrivals: if a.phase not in 'sS': continue + pick = a.pick_id.get_referred_object() + station = pick.waveform_id.station_code # make sure calculating Ml only from reliable onsets # NLLoc: time_weight = 0 => do not use onset! if a.time_weight == 0: + print("Uncertain pick at Station {}, do not use it!".format(station)) continue - pick = a.pick_id.get_referred_object() - station = pick.waveform_id.station_code wf = select_for_phase(self.stream.select( station=station), a.phase) if not wf: @@ -399,7 +400,13 @@ class MomentMagnitude(Magnitude): print("WARNING: No instrument corrected data available," " no magnitude calculation possible! Go on.") continue - scopy = self.stream.copy() + try: + scopy = self.stream.copy() + except AssertionError: + print("WARNING: Something's wrong with the data," + "station {}," + "no calculation of moment magnitude possible! Go on.".format(station)) + continue wf = scopy.select(station=station) if not wf: continue diff --git a/pylot/core/io/data.py b/pylot/core/io/data.py index 87434a3c..3a9fc19e 100644 --- a/pylot/core/io/data.py +++ b/pylot/core/io/data.py @@ -354,13 +354,13 @@ class Data(object): nllocfile = open(fnout + fnext) l = nllocfile.readlines() # Adding A0/Generic Amplitude to .obs file - l2 = [] - for li in l: - for amp in evtdata_org.amplitudes: - if amp.waveform_id.station_code == li[0:5].strip(): - li = li[0:64] + '{:0.2e}'.format(amp.generic_amplitude) + li[73:-1] + '\n' - l2.append(li) - l = l2 + #l2 = [] + #for li in l: + # for amp in evtdata_org.amplitudes: + # if amp.waveform_id.station_code == li[0:5].strip(): + # li = li[0:64] + '{:0.2e}'.format(amp.generic_amplitude) + li[73:-1] + '\n' + # l2.append(li) + #l = l2 nllocfile.close() l.insert(0, header) nllocfile = open(fnout + fnext, 'w') diff --git a/pylot/core/io/phases.py b/pylot/core/io/phases.py index 8442ed7f..8e902677 100644 --- a/pylot/core/io/phases.py +++ b/pylot/core/io/phases.py @@ -543,6 +543,7 @@ def writephases(arrivals, fformat, filename, parameter=None, eventinfo=None): try: if arrivals[key]['P']['weight'] >= 4: pweight = 0 # do not use pick + print("Station {}: Uncertain pick, do not use it!".format(key)) except KeyError as e: print(e.message + '; no weight set during processing') fid.write('%s ? ? ? P %s %d%02d%02d %02d%02d %7.4f GAU 0 0 0 0 %d \n' % (key,