# http://pyrocko.org - GPLv3 # # The Pyrocko Developers, 21st Century # ---|P------/S----------~Lg----------
default=False, help='Avoid sources offshore under the ocean / lakes.')
default=4.0, help='minimum moment magnitude') optional=True, help='if set, maximum moment magnitude for a uniform distribution. ' 'If set to ``None``, magnitudes are drawn using a ' 'Gutenberg-Richter distribution, see :gattr:`b_value`.') optional=True, help='b-value for Gutenberg-Richter magnitude distribution. If unset, ' 'a value of 1 is assumed.')
raise ScenarioError( '%s: b_value and magnitude_max are mutually exclusive.' % self.__class__.__name__)
if self.b_value is None and self.magnitude_max is None: b_value = 1.0 else: b_value = self.b_value
if b_value is None: return rstate.uniform(self.magnitude_min, self.magnitude_max) else: return moment_tensor.rand_to_gutenberg_richter( rstate.rand(), b_value, magnitude_min=self.magnitude_min)
sources = [] for ievent in range(self.nevents): src = self.get_source(ievent) src.name = 'scenario_ev%03d' % (ievent + 1) sources.append(src)
return sources
fn_sources = op.join(path, 'sources.yml') if not op.exists(fn_sources): with open(fn_sources, 'w') as f: for src in self.get_sources(): f.write(src.dump())
fn_events = op.join(path, 'events.txt') if not op.exists(fn_events): with open(fn_events, 'w') as f: for isrc, src in enumerate(self.get_sources()): f.write(src.pyrocko_event().dump())
pass |