Beispiel #1
0
    def _create_regional_ttt_store(self, typ):

        if typ == 'a':
            conf = gf.ConfigTypeA(
                id='empty_regional',
                source_depth_min=0.,
                source_depth_max=20*km,
                source_depth_delta=10*km,
                distance_min=10*km,
                distance_max=2000*km,
                distance_delta=10*km,
                sample_rate=2.0,
                ncomponents=10,
                earthmodel_1d=cake.load_model(),
                tabulated_phases=[
                    gf.TPDef(id=id, definition=defi) for (id, defi) in [
                        ('depthp', 'p'),
                        ('pS', 'pS'),
                        ('P', 'P'),
                        ('S', 'S')
                    ]
                ])

        elif typ == 'b':
            conf = gf.ConfigTypeB(
                id='empty_regional_b',
                receiver_depth_min=0.,
                receiver_depth_max=5*km,
                receiver_depth_delta=5*km,
                source_depth_min=0.,
                source_depth_max=20*km,
                source_depth_delta=10*km,
                distance_min=10*km,
                distance_max=2000*km,
                distance_delta=10*km,
                sample_rate=2.0,
                ncomponents=10,
                earthmodel_1d=cake.load_model(),
                tabulated_phases=[
                    gf.TPDef(id=id, definition=defi) for (id, defi) in [
                        ('depthp', 'p'),
                        ('pS', 'pS'),
                        ('P', 'P'),
                        ('S', 'S')
                    ]
                ])

        store_dir = mkdtemp(prefix='gfstore')
        self.tempdirs.append(store_dir)

        gf.Store.create(store_dir, config=conf)
        store = gf.Store(store_dir)
        store.make_ttt()

        store.close()
        return store_dir
Beispiel #2
0
    def _create_pulse_store(self):

        conf = gf.ConfigTypeB(id='pulse',
                              receiver_depth_min=0.,
                              receiver_depth_max=10.,
                              receiver_depth_delta=10.,
                              source_depth_min=0.,
                              source_depth_max=1000.,
                              source_depth_delta=10.,
                              distance_min=10.,
                              distance_max=1000.,
                              distance_delta=10.,
                              sample_rate=200.,
                              ncomponents=2.,
                              component_scheme='elastic2')

        pulse = PulseConfig()

        # fnyq_spatial = pulse.velocity / math.sqrt(conf.distance_delta**2 +
        #                                       conf.source_depth_delta**2)

        store_dir = mkdtemp(prefix='gfstore')
        self.tempdirs.append(store_dir)

        gf.Store.create(store_dir,
                        config=conf,
                        force=True,
                        extra={'pulse': pulse})

        deltat = conf.deltat

        store = gf.Store(store_dir, mode='w')
        for args in store.config.iter_nodes(level=-1):

            rdepth, sdepth, surfdist = args
            dist = math.sqrt((rdepth - sdepth)**2 + surfdist**2)

            tarr = dist / pulse.velocity

            tmin = tarr - 5 * pulse.fwhm
            tmax = tarr + 5 * pulse.fwhm
            itmin = int(num.floor(tmin / deltat))
            itmax = int(num.ceil(tmax / deltat))
            tmin = itmin * deltat
            tmax = itmax * deltat
            nsamples = itmax - itmin + 1

            t = tmin + num.arange(nsamples) * deltat

            data = pulse.evaluate(dist, t)

            phi = math.atan2(rdepth - sdepth, surfdist)
            data = [data * math.cos(phi), data * math.sin(phi)]
            for icomponent, data in enumerate(data):
                is_zero = num.all(data == 0.0)

                tr = gf.GFTrace(data=data,
                                itmin=itmin,
                                deltat=deltat,
                                is_zero=is_zero)

                store.put(args + (icomponent, ), tr)

        store.close()
        return store_dir