self.updatePyrockoSource() SandboxSource.parametersUpdated(self)
for arg, value in self._src_args.items(): self.pyrocko_source.__setattr__(arg, value)
'''Classical Haskell source model modified for bilateral rupture. See :class:`pyrocko.gf.seismosizer.RectangularSource`. '''
optional=True, default=10, help='Sub-source decimation factor.') help='Pyrocko GF Store path')
SandboxSourceRectangular.__init__(self, *args, **kwargs) self.pyrocko_source = gf.RectangularSource(**self._src_args)
def _src_args(self): return { 'lat': 0., 'lon': 0., 'north_shift': self.northing, 'east_shift': self.easting, 'depth': self.depth, 'length': self.length, 'width': self.width, 'strike': self.strike, 'dip': self.dip, 'rake': self.rake, 'slip': self.slip, 'decimation_factor': self.decimation_factor, 'anchor': 'top', }
'''A moment tensor point source.
See :class:`pyrocko.gf.seismosizer.MomentTensor`. '''
help='Pyrocko GF Store path') default=1., help='north-north component of moment tensor in [Nm]') default=1., help='east-east component of moment tensor in [Nm]') default=1., help='down-down component of moment tensor in [Nm]') default=0., help='north-east component of moment tensor in [Nm]') default=0., help='north-down component of moment tensor in [Nm]') default=0., help='east-down component of moment tensor in [Nm]')
SandboxSource.__init__(self, *args, **kwargs) self.pyrocko_source = gf.MTSource(**self._src_args)
def _src_args(self): return { 'lat': 0., 'lon': 0., 'north_shift': self.northing, 'east_shift': self.easting, 'depth': self.depth, 'mnn': self.mnn, 'mee': self.mee, 'mdd': self.mdd, 'mne': self.mne, 'mnd': self.mnd, 'med': self.med, }
'''A double-couple point source.
See :class:`pyrocko.gf.seismosizer.DCSource`. '''
default=0.0, help='strike direction in [deg], measured clockwise from north') default=6.0, help='moment magnitude Mw as in [Hanks and Kanamori, 1979]') default=90.0, help='dip angle in [deg], measured downward from horizontal') default=0.0, help='rake angle in [deg], ' 'measured counter-clockwise from right-horizontal ' 'in on-plane view') help='Pyrocko GF Store path')
SandboxSource.__init__(self, *args, **kwargs) self.pyrocko_source = gf.DCSource(**self._src_args)
def moment(self): return self.pyrocko_source.moment
def _src_args(self): return { 'lat': 0., 'lon': 0., 'north_shift': self.northing, 'east_shift': self.easting, 'depth': self.depth, 'magnitude': self.magnitude, 'strike': self.strike, 'dip': self.dip, 'rake': self.rake }
'''A ring fault with vertical doublecouples.
See :class:`pyrocko.gf.seismosizer.RingfaultSource`. '''
help='Pyrocko GF Store path') default=1.0, help='diameter of the ring in [m]') default=1.0, help='inside of the ring moves up (+1) or down (-1)') default=0.0, help='strike direction of the ring plane, clockwise from north,' ' in [deg]') default=0.0, help='dip angle of the ring plane from horizontal in [deg]') default=8, help='number of point sources to use') default=6.0, help='moment magnitude Mw as in [Hanks and Kanamori, 1979]')
SandboxSource.__init__(self, *args, **kwargs) PyrockoSource.__init__(self) self.pyrocko_source = gf.RingfaultSource(**self._src_args)
def _src_args(self): return { 'lat': 0., 'lon': 0., 'north_shift': self.northing, 'east_shift': self.easting, 'depth': self.depth, 'diameter': self.diameter, 'strike': self.strike, 'dip': self.dip, 'magnitude': self.magnitude, 'npointsources': self.npointsources, }
'''A ring fault with vertical doublecouples.
See :class:`pyrocko.gf.seismosizer.VLVDSource`. '''
help='Pyrocko GF Store path') default=.25, help='Volume change in [km^3]') default=0.0, help='azimuth direction of CLVD, clockwise from north,' ' in [deg]') default=90.0, help='dip angle of the CLVD from horizontal in [deg]') default=3e18, help='Moment in [Nm] of the CLVD contribution')
SandboxSource.__init__(self, *args, **kwargs) PyrockoSource.__init__(self) self.pyrocko_source = gf.VLVDSource(**self._src_args)
def _src_args(self): return { 'lat': 0., 'lon': 0., 'north_shift': self.northing, 'east_shift': self.easting, 'depth': self.depth, 'volume_change': self.volume_change * km3, 'azimuth': self.azimuth, 'dip': self.dip, 'clvd_moment': self.clvd_moment }
SourceProcessor.__init__(self, *args) self.engine = gf.LocalEngine()
result = { 'processor_profile': dict(), 'displacement.n': num.zeros(sandbox.frame.npixel), 'displacement.e': num.zeros(sandbox.frame.npixel), 'displacement.d': num.zeros(sandbox.frame.npixel) }
coords = sandbox.frame.coordinatesMeter
target = gf.StaticTarget( lats=num.full(sandbox.frame.npixel, sandbox.frame.llLat), lons=num.full(sandbox.frame.npixel, sandbox.frame.llLon), east_shifts=coords[:, 0], north_shifts=coords[:, 1], interpolation='nearest_neighbor')
store_dirs = set([src.store_dir for src in sources]) for store_dir in store_dirs: self.engine.store_dirs = [store_dir]
talpa_sources = [src for src in sources if src.store_dir == store_dir]
pyr_sources = [src.pyrocko_source for src in talpa_sources]
for src in sources: src.regularize()
try: res = self.engine.process( pyr_sources, [target], nthreads=nthreads)
except Exception as e: self._log.error( 'Could not execute pyrocko.gf.LocalEngine.process! \n' 'LocalEngine Exception: %s' % e) continue
for ires, static_res in enumerate(res.static_results()): result['displacement.n'] += static_res.result['displacement.n'] result['displacement.e'] += static_res.result['displacement.e'] result['displacement.d'] += static_res.result['displacement.d']
talpa_sources[ires]._cached_result = static_res.result
for src in sources: if src._cached_result is None: continue self._log.debug('Using cached displacement for %s' % src.__class__.__name__) result['displacement.n'] += src._cached_result['displacement.n'] result['displacement.e'] += src._cached_result['displacement.e'] result['displacement.d'] += src._cached_result['displacement.d']
return result |