예제 #1
0
    def create_scenario(self, interactive=True):
        logger.info('Creating scenario...')

        scenario = self.get_scenario()
        util.ensuredir(self.get_gf_stores_dir())

        engine1 = gf.LocalEngine(use_config=True,
                                 store_superdirs=[self.get_gf_stores_dir()])

        scenario.init_modelling(engine=engine1)

        scenario.ensure_gfstores(
            interactive=interactive,
            gf_store_superdirs_extra=[self.get_gf_stores_dir()])

        self.symlink_gfstores(engine1)

        engine2 = gf.LocalEngine(use_config=False,
                                 store_superdirs=[self.get_gf_stores_dir()])

        scenario.init_modelling(engine=engine2)

        data_dir = op.join(self.project_dir, self.data_dir)
        util.ensuredir(data_dir)

        scenario.dump(filename=op.join(data_dir, 'scenario.yml'))
        scenario.dump_data(path=data_dir)
        scenario.make_map(op.join(self.project_dir, 'scenario_map.pdf'))

        shutil.move(op.join(data_dir, 'sources.yml'),
                    op.join(data_dir, 'scenario_sources.yml'))
예제 #2
0
파일: colosseo.py 프로젝트: li8182/pyrocko
def command_fill(args):

    def setup(parser):
        parser.add_option(
            '--force', dest='force', action='store_true',
            help='overwrite existing files')

    parser, options, args = cl_parse('fill', args, setup=setup)

    if len(args) == 0:
        args.append('.')

    fn = get_scenario_yml(args[0])

    if not fn:
        parser.print_help()
        sys.exit(1)

    project_dir = args[0]

    gf_stores_path = op.join(project_dir, 'gf_stores')
    engine = get_engine([gf_stores_path])

    scenario = guts.load(filename=fn)
    scenario.init_modelling(engine)
    scenario.ensure_gfstores(interactive=True)
    scenario.dump_data(
        path=project_dir, overwrite=options.force)

    scenario.make_map([op.join(project_dir, 'map.pdf'),
                       op.join(project_dir, 'map.ps')])
예제 #3
0
def command_fill(args):

    def setup(parser):
        parser.add_option(
            '--force', dest='force', action='store_true',
            help='overwrite existing files')

    parser, options, args = cl_parse('fill', args, setup=setup)

    if len(args) == 0:
        args.append('.')

    fn = get_scenario_yml(args[0])

    if not fn:
        parser.print_help()
        sys.exit(1)

    project_dir = op.abspath(args[0])

    logger.info('Initializing gf.LocalEngine...')
    engine = get_engine()

    scenario = guts.load(filename=fn)
    scenario.init_modelling(engine)
    scenario.dump_data(path=project_dir, overwrite=options.force)
    scenario.make_map(op.join(project_dir, 'map.pdf'))
예제 #4
0
파일: colosseo.py 프로젝트: emolch/pyrocko
def command_fill(args):

    def setup(parser):
        parser.add_option(
            '--force', dest='force', action='store_true',
            help='overwrite existing files')

    parser, options, args = cl_parse('fill', args, setup=setup)

    if len(args) == 0:
        args.append('.')

    fn = get_scenario_yml(args[0])

    if not fn:
        parser.print_help()
        sys.exit(1)

    project_dir = args[0]

    gf_stores_path = op.join(project_dir, 'gf_stores')
    engine = get_engine([gf_stores_path])

    scenario = guts.load(filename=fn)
    scenario.init_modelling(engine)
    scenario.ensure_gfstores(interactive=True)
    scenario.dump_data(
        path=project_dir, overwrite=options.force)
    scenario.make_map(op.join(project_dir, 'map.pdf'))
예제 #5
0
def command_fill(args):
    def setup(parser):
        parser.add_option('--force',
                          dest='force',
                          action='store_true',
                          help='overwrite existing files')

    parser, options, args = cl_parse('fill', args, setup=setup)

    if len(args) == 0:
        args.append('.')

    fn = get_scenario_yml(args[0])

    if not fn:
        parser.print_help()
        sys.exit(1)

    project_dir = op.abspath(args[0])

    logger.info('Initializing gf.LocalEngine...')
    engine = get_engine()

    scenario = guts.load(filename=fn)
    scenario.init_modelling(engine)
    scenario.dump_data(path=project_dir, overwrite=options.force)
    scenario.make_map(op.join(project_dir, 'map.pdf'))
예제 #6
0
    def create_scenario(self,
                        force=False,
                        interactive=True,
                        gf_store_superdirs=None,
                        make_map=True):

        logger.info('Creating scenario...')

        scenario = self.get_scenario()
        self.create_project_dir(force)
        util.ensuredir(self.get_gf_stores_dir())

        data_dir = op.join(self.project_dir, self.data_dir)
        util.ensuredir(data_dir)

        scenario.dump(filename=op.join(data_dir, 'scenario.yml'))

        if gf_store_superdirs is None:
            engine1 = gf.LocalEngine(
                use_config=True, store_superdirs=[self.get_gf_stores_dir()])
        else:
            engine1 = gf.LocalEngine(use_config=False,
                                     store_superdirs=gf_store_superdirs)

        scenario.init_modelling(engine=engine1)

        scenario.ensure_gfstores(interactive=interactive)
        self.symlink_gfstores(engine1)

        engine2 = gf.LocalEngine(use_config=False,
                                 store_superdirs=[self.get_gf_stores_dir()])

        scenario.init_modelling(engine=engine2)

        scenario.dump_data(path=data_dir)
        if make_map:
            scenario.make_map(op.join(self.project_dir, 'scenario_map.pdf'))

        shutil.move(op.join(data_dir, 'sources.yml'),
                    op.join(data_dir, 'scenario_sources.yml'))

        markers = scenario.get_onsets()
        marker_path = op.join(data_dir, 'picks', 'picks.markers')
        if markers:
            util.ensuredirs(marker_path)
            pmarker.save_markers(markers, marker_path)