Merge branch 'develop' of ariadne:/data/git/pylot into develop
This commit is contained in:
commit
410fe18390
30
autoPyLoT.py
30
autoPyLoT.py
@ -252,12 +252,17 @@ def autoPyLoT(input_dict=None, parameter=None, inputfile=None, fnames=None, even
|
||||
for station, props in moment_mag.moment_props.items():
|
||||
picks[station]['P'].update(props)
|
||||
evt = moment_mag.updated_event()
|
||||
net_mw = moment_mag.net_magnitude()
|
||||
print("Network moment magnitude: %4.1f" % net_mw.mag)
|
||||
# calculate local (Richter) magntiude
|
||||
local_mag = LocalMagnitude(corr_dat, evt,
|
||||
parameter.get('sstop'), parameter.get('WAscaling'), \
|
||||
True, iplot)
|
||||
for station, amplitude in local_mag.amplitudes.items():
|
||||
picks[station]['S']['Ao'] = amplitude.generic_amplitude
|
||||
evt = local_mag.updated_event()
|
||||
evt = local_mag.updated_event(parameter.get('magscaling'))
|
||||
net_ml = local_mag.net_magnitude()
|
||||
print("Network local magnitude: %4.1f" % net_ml.mag)
|
||||
else:
|
||||
print("autoPyLoT: No NLLoc-location file available!")
|
||||
print("No source parameter estimation possible!")
|
||||
@ -310,14 +315,17 @@ def autoPyLoT(input_dict=None, parameter=None, inputfile=None, fnames=None, even
|
||||
for station, props in moment_mag.moment_props.items():
|
||||
picks[station]['P'].update(props)
|
||||
evt = moment_mag.updated_event()
|
||||
net_mw = moment_mag.net_magnitude()
|
||||
print("Network moment magnitude: %4.1f" % net_mw.mag)
|
||||
# calculate local (Richter) magntiude
|
||||
local_mag = LocalMagnitude(corr_dat, evt,
|
||||
parameter.get('sstop'), parameter.get('WAscaling'), \
|
||||
True, iplot)
|
||||
for station, amplitude in local_mag.amplitudes.items():
|
||||
picks[station]['S']['Ao'] = amplitude.generic_amplitude
|
||||
evt = local_mag.updated_event()
|
||||
net_mw = moment_mag.net_magnitude()
|
||||
print("Network moment magnitude: %4.1f" % net_mw.mag)
|
||||
evt = local_mag.updated_event(parameter.get('magscaling'))
|
||||
net_ml = local_mag.net_magnitude(parameter.get('magscaling'))
|
||||
print("Network local magnitude: %4.1f" % net_ml.mag)
|
||||
else:
|
||||
print("autoPyLoT: No NLLoc-location file available! Stop iteration!")
|
||||
locflag = 9
|
||||
@ -328,26 +336,26 @@ def autoPyLoT(input_dict=None, parameter=None, inputfile=None, fnames=None, even
|
||||
data.applyEVTData(picks)
|
||||
if evt is not None:
|
||||
data.applyEVTData(evt, 'event')
|
||||
fnqml = '%s/autoPyLoT' % event
|
||||
fnqml = '%s/picks_%s' % (event, evID)
|
||||
data.exportEvent(fnqml)
|
||||
# HYPO71
|
||||
hypo71file = '%s/autoPyLoT_HYPO71_phases' % event
|
||||
hypo71file = '%s/%s_HYPO71_phases' % (event, evID)
|
||||
hypo71.export(picks, hypo71file, parameter)
|
||||
# HYPOSAT
|
||||
hyposatfile = '%s/autoPyLoT_HYPOSAT_phases' % event
|
||||
hyposatfile = '%s/%s_HYPOSAT_phases' % (event, evID)
|
||||
hyposat.export(picks, hyposatfile, parameter)
|
||||
if locflag == 1:
|
||||
# VELEST
|
||||
velestfile = '%s/autoPyLoT_VELEST_phases.cnv' % event
|
||||
velestfile = '%s/%s_VELEST_phases.cnv' % (event, evID)
|
||||
velest.export(picks, velestfile, parameter, evt)
|
||||
# hypoDD
|
||||
hypoddfile = '%s/autoPyLoT_hypoDD_phases.pha' % event
|
||||
hypoddfile = '%s/%s_hypoDD_phases.pha' % (event, evID)
|
||||
hypodd.export(picks, hypoddfile, parameter, evt)
|
||||
# FOCMEC
|
||||
focmecfile = '%s/autoPyLoT_FOCMEC.in' % event
|
||||
focmecfile = '%s/%s_FOCMEC.in' % (event, evID)
|
||||
focmec.export(picks, focmecfile, parameter, evt)
|
||||
# HASH
|
||||
hashfile = '%s/autoPyLoT_HASH' % event
|
||||
hashfile = '%s/%s_HASH' % (event, evID)
|
||||
hash.export(picks, hashfile, parameter, evt)
|
||||
|
||||
endsplash = '''------------------------------------------\n'
|
||||
|
@ -2,6 +2,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Created autumn/winter 2015.
|
||||
Revised/extended summer 2017.
|
||||
|
||||
:author: Ludger Küperkoch / MAGS2 EP3 working group
|
||||
"""
|
||||
@ -115,23 +116,30 @@ class Magnitude(object):
|
||||
def calc(self):
|
||||
pass
|
||||
|
||||
def updated_event(self):
|
||||
self.event.magnitudes.append(self.net_magnitude())
|
||||
def updated_event(self, magscaling=None):
|
||||
self.event.magnitudes.append(self.net_magnitude(magscaling))
|
||||
return self.event
|
||||
|
||||
def net_magnitude(self):
|
||||
def net_magnitude(self, magscaling=None):
|
||||
if self:
|
||||
# TODO if an average Magnitude instead of the median is calculated
|
||||
# StationMagnitudeContributions should be added to the returned
|
||||
# Magnitude object
|
||||
# mag_error => weights (magnitude error estimate from peak_to_peak, calcsourcespec?)
|
||||
# weights => StationMagnitdeContribution
|
||||
mag = ope.Magnitude(
|
||||
mag=np.median([M.mag for M in self.magnitudes.values()]),
|
||||
magnitude_type=self.type,
|
||||
origin_id=self.origin_id,
|
||||
station_count=len(self.magnitudes),
|
||||
azimuthal_gap=self.origin_id.get_referred_object().quality.azimuthal_gap)
|
||||
if magscaling is not None and str(magscaling) is not '[0.0, 0.0]':
|
||||
# scaling necessary
|
||||
print("Scaling network magnitude ...")
|
||||
mag = ope.Magnitude(
|
||||
mag=np.median([M.mag for M in self.magnitudes.values()]) *\
|
||||
magscaling[0] + magscaling[1],
|
||||
magnitude_type=self.type,
|
||||
origin_id=self.origin_id,
|
||||
station_count=len(self.magnitudes),
|
||||
azimuthal_gap=self.origin_id.get_referred_object().quality.azimuthal_gap)
|
||||
else:
|
||||
# no saling necessary
|
||||
mag = ope.Magnitude(
|
||||
mag=np.median([M.mag for M in self.magnitudes.values()]),
|
||||
magnitude_type=self.type,
|
||||
origin_id=self.origin_id,
|
||||
station_count=len(self.magnitudes),
|
||||
azimuthal_gap=self.origin_id.get_referred_object().quality.azimuthal_gap)
|
||||
return mag
|
||||
return None
|
||||
|
||||
@ -153,7 +161,7 @@ class LocalMagnitude(Magnitude):
|
||||
|
||||
_amplitudes = dict()
|
||||
|
||||
def __init__(self, stream, event, calc_win, wascaling=None, verbosity=False, iplot=0):
|
||||
def __init__(self, stream, event, calc_win, wascaling, verbosity=False, iplot=0):
|
||||
super(LocalMagnitude, self).__init__(stream, event, verbosity, iplot)
|
||||
|
||||
self._calc_win = calc_win
|
||||
@ -257,12 +265,13 @@ class LocalMagnitude(Magnitude):
|
||||
self.amplitudes = (station, amplitude)
|
||||
# using standard Gutenberg-Richter relation
|
||||
# or scale WA amplitude with given scaling relation
|
||||
if self.wascaling == None:
|
||||
if str(self.wascaling) == '[0.0, 0.0, 0.0]':
|
||||
print("Calculating original Richter magnitude ...")
|
||||
magnitude = ope.StationMagnitude(mag=np.log10(a0) \
|
||||
+ richter_magnitude_scaling(delta))
|
||||
else:
|
||||
print("Calculating scaled local magnitude ...")
|
||||
a0 = a0 * 1e03 # mm to nm (see Havskov & Ottemöller, 2010)
|
||||
magnitude = ope.StationMagnitude(mag=np.log10(a0) \
|
||||
+ self.wascaling[0] * np.log10(delta) + self.wascaling[1]
|
||||
* delta + self.wascaling[2])
|
||||
|
@ -278,12 +278,14 @@ defaults = {'rootpath': {'type': str,
|
||||
'value': 1.0},
|
||||
|
||||
'WAscaling': {'type': (float, float, float),
|
||||
'tooltip': 'Scaling relation (log(Ao)+Alog(r)+Br+C) of Wood-Anderson amplitude Ao [nm]',
|
||||
'value': (1.0, 1.0, 1.0)},
|
||||
'tooltip': 'Scaling relation (log(Ao)+Alog(r)+Br+C) of Wood-Anderson amplitude Ao [nm] \
|
||||
If zeros are set, original Richter magnitude is calculated!',
|
||||
'value': (0., 0., 0.)},
|
||||
|
||||
'magscaling': {'type': (float, float),
|
||||
'tooltip': 'Scaling relation for derived local magnitude [a*Ml+b]',
|
||||
'value': (1.0, 1.0)}
|
||||
'tooltip': 'Scaling relation for derived local magnitude [a*Ml+b]. \
|
||||
If zeros are set, no scaling is of network magnitude is applied.',
|
||||
'value': (0., 0.)}
|
||||
}
|
||||
|
||||
settings_main={
|
||||
|
Loading…
Reference in New Issue
Block a user