Flexible calculation of local magnitude including station magntiude scaling as well as network magnitude scaling.
auoPyLot-output-file names have prefix event ID.
This commit is contained in:
@@ -1 +1 @@
|
||||
f91e1-dirty
|
||||
8e8b-dirty
|
||||
|
||||
@@ -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={
|
||||
|
||||
Reference in New Issue
Block a user