#!/usr/bin/env python
except ImportError: print('Pyrocko is required for Grond!' 'Go to https://pyrocko.org/ for installation instructions.')
else:
'init': 'initialise new project structure or print configuration', 'scenario': 'create a forward-modelled scenario project', 'events': 'print available event names for given configuration', 'check': 'check data and configuration', 'go': 'run Grond optimisation', 'forward': 'run forward modelling', 'harvest': 'manually run harvesting', 'cluster': 'run cluster analysis on result ensemble', 'plot': 'plot optimisation result', 'movie': 'visualize optimiser evolution', 'export': 'export results', 'tag': 'add user-defined label to run directories', 'report': 'create result report', 'diff': 'compare two configs or other normalized Grond YAML files', 'qc-polarization': 'check sensor orientations with polarization analysis', 'upgrade-config': 'upgrade config file to the latest version of Grond', 'version': 'print version number of Grond and its main dependencies', }
'init': ( 'init list [options]', 'init <example> [options]', 'init <example> <projectdir> [options]'), 'scenario': 'scenario [options] <projectdir>', 'events': 'events <configfile>', 'check': 'check <configfile> <eventnames> ... [options]', 'go': 'go <configfile> <eventnames> ... [options]', 'forward': ( 'forward <rundir> [options]', 'forward <configfile> <eventnames> ... [options]'), 'harvest': 'harvest <rundir> [options]', 'cluster': ( 'cluster <method> <rundir> [options]', 'cluster <clusteringconfigfile> <rundir> [options]'), 'plot': ( 'plot <plotnames> ( <rundir> | <configfile> <eventname> ) [options]', 'plot all ( <rundir> | <configfile> <eventname> ) [options]', 'plot <plotconfigfile> ( <rundir> | <configfile> <eventname> ) [options]', # noqa 'plot list ( <rundir> | <configfile> <eventname> ) [options]', 'plot config ( <rundir> | <configfile> <eventname> ) [options]'), 'movie': 'movie <rundir> <xpar> <ypar> <filetemplate> [options]', 'export': 'export (best|mean|ensemble|stats) <rundirs> ... [options]', 'tag': ( 'tag add <tag> <rundir>', 'tag remove <tag> <rundir>', 'tag list <rundir>'), 'report': ( 'report <rundir> ... [options]', 'report <configfile> <eventnames> ...'), 'diff': 'diff <left_path> <right_path>', 'qc-polarization': 'qc-polarization <configfile> <eventname> ' '<target_group_path> [options]', 'upgrade-config': 'upgrade-config <configfile>', 'version': 'version', }
Grond is a probabilistic earthquake source inversion framework.
This is Grond version %(version_number)s.
Subcommands:
scenario %(scenario)s init %(init)s events %(events)s check %(check)s go %(go)s forward %(forward)s harvest %(harvest)s cluster %(cluster)s plot %(plot)s movie %(movie)s export %(export)s tag %(tag)s report %(report)s diff %(diff)s qc-polarization %(qc_polarization)s upgrade-config %(upgrade_config)s version %(version)s
To get further help and a list of available options for any subcommand run:
%(program_name)s <subcommand> --help
What do you want to bust today?! ''' % usage_tdata
We created a folder structure in {project_dir}. Check out the YAML configuration in {config} and start the optimisation by:
grond go {config} ''' To start the scenario's optimisation, change to folder
cd {project_dir}
Check out the YAML configuration in {config} and start the optimisation by:
grond go {config} ''' To open the report in your web browser, run
grond report -s --open {config} ''' To start the optimisation, run
grond go {config} ''' To look at the results, run
grond report -so {rundir} '''
getattr(cls, command).format(**kwargs)
args = sys.argv
elif command in ('--help', '-h', 'help'): if command == 'help' and args: acommand = args[0] if acommand in subcommands: globals()['command_' + acommand](['--help'])
sys.exit('Usage: %s' % usage)
else: die('No such subcommand: %s' % command)
'--loglevel', action='store', dest='loglevel', type='choice', choices=('critical', 'error', 'warning', 'info', 'debug'), default='info', help='set logger level to ' '"critical", "error", "warning", "info", or "debug". ' 'Default is "%default".')
'--docs', dest='rst_docs', action='store_true')
from optparse import IndentedHelpFormatter
class DocsFormatter(IndentedHelpFormatter):
def format_heading(self, heading): return '%s\n%s\n\n' % (heading, '.'*len(heading))
def format_usage(self, usage): lines = usage.splitlines() return self.format_heading('Usage') + \ '.. code-block:: none\n\n%s' % '\n'.join( ' '+line.strip() for line in lines)
def format_option(self, option): if not option.help: return ''
result = [] opts = self.option_strings[option] result.append('\n.. describe:: %s\n\n' % opts)
help_text = self.expand_default(option) result.append(' %s\n\n' % help_text)
return ''.join(result)
parser.formatter = DocsFormatter() parser.formatter.set_parser(parser)
def format_help(parser): formatter = parser.formatter result = []
result.append(parser.format_description(formatter) + "\n")
if parser.usage: result.append(parser.get_usage() + "\n")
result.append('\n')
result.append(parser.format_option_help(formatter))
result.append('\n')
result.append(parser.format_epilog(formatter)) return "".join(result)
print(command) print('-' * len(command)) print() print('.. program:: %s' % program_name) print() print('.. option:: %s' % command) print() print(format_help(parser))
print_docs(command, parser) exit(0)
err = '\n' + err
raise OptionValueError('Invalid option %s - valid options are: %s' % (opt, ', '.join(choices)))
mag_range = value.split('-') if len(mag_range) != 2: raise OptionValueError( 'Invalid magnitude %s - valid range is e.g. 6-7.' % value) try: mag_range = tuple(map(float, mag_range)) except ValueError: raise OptionValueError('Magnitudes must be numbers.')
if mag_range[0] > mag_range[1]: raise OptionValueError('Minimum magnitude must be larger than' ' maximum magnitude.') setattr(parser.values, option.dest, mag_range)
'--targets', action='callback', dest='targets', type=str, callback=multiple_choice, callback_kwargs={ 'choices': ('waveforms', 'gnss', 'insar') }, default='waveforms', help='forward modelling targets for the scenario. Select from:' ' waveforms, gnss and insar. ' '(default: --targets=%default,' ' multiple selection by --targets=waveforms,gnss,insar)') '--problem', dest='problem', default='cmt', type='choice', choices=['cmt', 'rectangular'], help='problem to generate: \'dc\' (double couple)' ' or \'rectangular\' (rectangular finite fault)' ' (default: \'%default\')') '--magnitude-range', dest='magnitude_range', type=str, action='callback', callback=magnitude_range, default=[6.0, 7.0], help='Magnitude range min_mag-max_mag (default: %default)') '--nstations', dest='nstations', type=int, default=20, help='number of seismic stations to create (default: %default)') '--gnss_nstations', dest='gnss_nstations', type=int, default=20, help='number of GNSS campaign stations to create' ' (default: %default)') '--nevents', dest='nevents', type=int, default=1, help='number of events to create (default: %default)') '--lat', dest='lat', type=float, default=41.0, help='center latitude of the scenario (default: %default)') '--lon', dest='lon', type=float, default=33.3, help='center latitude of the scenario (default: %default)') '--radius', dest='radius', type=float, default=100., help='radius of the the scenario in [km] (default: %default)') '--gf-waveforms', dest='store_waveforms', type=str, default=STORE_WAVEFORMS, help='Green\'s function store for waveform modelling, ' '(default: %default)') '--gf-static', dest='store_statics', type=str, default=STORE_STATIC, help='Green\'s function store for static modelling, ' '(default: %default)') '--force', dest='force', action='store_true', help='overwrite existing project folder.') '--gf-store-superdirs', dest='gf_store_superdirs', help='Comma-separated list of directories containing GF stores')
else: parser.print_help() sys.exit(1)
project_dir, center_lat=options.lat, center_lon=options.lon, radius=options.radius*km)
nstations=options.nstations, store_id=options.store_waveforms)
store_id=options.store_statics)
nstations=options.gnss_nstations, store_id=options.store_statics)
nevents=options.nevents, magnitude_min=options.magnitude_range[0], magnitude_max=options.magnitude_range[1]) elif options.problem == 'rectangular': problem = grond_scenario.RectangularSourceProblem( nevents=options.nevents)
force=options.force, interactive=True, gf_store_superdirs=gf_store_superdirs)
config=scenario.get_grond_config_path(), project_dir=project_dir))
except grond.GrondError as e: die(str(e))
return '\tNone available.'
name=name, desc=desc, padding=padding, c=Color))
{c.BOLD}Example Projects{c.END}
Deploy a full project structure into a directory.
usage: grond init <example> <projectdir>
where <example> is any of the following:
{examples_list}
{c.BOLD}Config Sections{c.END}
Print out configuration snippets for various components.
usage: grond init <section>
where <section> is any of the following:
{sections_list} '''.format(c=Color, examples_list=print_section(grond_init.get_examples()), sections_list=print_section(grond_init.get_sections()))
'--force', dest='force', action='store_true')
'init', args, setup, 'Use grond init list to show available examples.')
help_and_die(parser, 'Unknown example: %s' % args[0])
'<projectdir>')
help_and_die( parser, 'Directory "%s" already exists! Use --force to overwrite.' % args[1]) else: except OSError as e: print(str(e))
else: sec = grond_init.get_content_snippet(args[0]) if not sec: help_and_die(parser, 'Unknown snippet: %s' % args[0])
sys.stdout.write(sec)
from . import cmd_init as init
def setup(parser): parser.add_option( '--targets', action='callback', dest='targets', type=str, callback=multiple_choice, callback_kwargs={ 'choices': ('waveforms', 'gnss', 'insar', 'all') }, default='waveforms', help='select from:' ' waveforms, gnss and insar. ' '(default: --targets=%default,' ' multiple selection by --targets=waveforms,gnss,insar)') parser.add_option( '--problem', dest='problem', type='choice', choices=['cmt', 'rectangular'], help='problem to generate: \'dc\' (double couple)' ' or\'rectangular\' (rectangular finite fault)' ' (default: \'%default\')') parser.add_option( '--force', dest='force', action='store_true', help='overwrite existing project folder')
parser, options, args = cl_parse('init', args, setup)
try: project = init.GrondProject()
if 'all' in options.targets: targets = ['waveforms', 'gnss', 'insar'] else: targets = options.targets
if not options.problem: if 'insar' in targets or 'gnss' in targets: problem = 'rectangular' else: problem = 'cmt' else: problem = options.problem
if problem == 'rectangular': project.set_rectangular_source() elif problem == 'cmt': project.set_cmt_source()
if 'waveforms' in targets: project.add_waveforms()
if 'insar' in targets: project.add_insar()
if 'gnss' in targets: project.add_gnss()
if len(args) == 1: project_dir = args[0] project.build(project_dir, options.force) logger.info(CLIHints( 'init', project_dir=project_dir, config=op.join(project_dir, 'config', 'config.gronf'))) else: sys.stdout.write(project.dump())
except grond.GrondError as e: die(str(e))
help_and_die(parser, 'missing arguments')
except grond.GrondError as e: die(str(e))
'--target-ids', dest='target_string_ids', metavar='TARGET_IDS', help='process only selected targets. TARGET_IDS is a ' 'comma-separated list of target IDs. Target IDs have the ' 'form SUPERGROUP.GROUP.NETWORK.STATION.LOCATION.CHANNEL.')
'--waveforms', dest='show_waveforms', action='store_true', help='show raw, restituted, projected, and processed waveforms')
'--nrandom', dest='n_random_synthetics', metavar='N', type=int, default=10, help='set number of random synthetics to forward model (default: ' '10). If set to zero, create synthetics for the reference ' 'solution.')
'--save-stations-used', dest='stations_used_path', metavar='FILENAME', help='aggregate all stations used by the setup into a file')
help_and_die(parser, 'missing arguments')
target_string_ids = options.target_string_ids.split(',')
config, event_names=env.get_selected_event_names(), target_string_ids=target_string_ids, show_waveforms=options.show_waveforms, n_random_synthetics=options.n_random_synthetics, stations_used_path=options.stations_used_path)
except grond.GrondError as e: die(str(e))
'--force', dest='force', action='store_true', help='overwrite existing run directory') '--preserve', dest='preserve', action='store_true', help='preserve old rundir') '--status', dest='status', default='state', type='choice', choices=['state', 'quiet'], help='status output selection (choices: state, quiet, default: ' 'state)') '--parallel', dest='nparallel', type=int, default=1, help='set number of events to process in parallel, ' 'if set to more than one, --status=quiet is implied.') '--threads', dest='nthreads', type=int, default=1, help='set number of threads per process (default: 1). ' 'Set to 0 to use all available cores.')
env, force=options.force, preserve=options.preserve, status=status, nparallel=options.nparallel, nthreads=options.nthreads) 'go', rundir=env.get_rundir_path()))
except grond.GrondError as e: die(str(e))
from grond.environment import Environment
def setup(parser): parser.add_option( '--show', dest='show', metavar='WHAT', default='filtered', choices=('filtered', 'processed'), help='select whether to show only "filtered" or fully "processed" ' '(i.e. tapered) waveforms (default "%default").')
parser, options, args = cl_parse('forward', args, setup) if len(args) < 1: help_and_die(parser, 'missing arguments')
try: env = Environment(args) grond.forward(env, show=options.show) except grond.GrondError as e: die(str(e))
def setup(parser): parser.add_option( '--force', dest='force', action='store_true', help='overwrite existing harvest directory') parser.add_option( '--neach', dest='neach', type=int, default=10, help='take NEACH best samples from each chain (default: %default)') parser.add_option( '--weed', dest='weed', type=int, default=0, help='weed out bootstrap samples with bad global performance. ' '0: no weeding (default), ' '1: only bootstrap chains where all NEACH best samples ' 'global misfit is less than the global average misfit of all ' 'NEACH best in all chains plus one standard deviation are ' 'included in the harvest ensemble, ' '2: same as 1 but additionally individual samples are ' 'removed if their global misfit is greater than the global ' 'average misfit of all NEACH best in all chains, ' '3: harvesting is done on the global chain only, bootstrap ' 'chains are excluded')
parser, options, args = cl_parse('harvest', args, setup) if len(args) != 1: help_and_die(parser, 'no rundir')
run_path, = args grond.harvest( run_path, force=options.force, nbest=options.neach, weed=options.weed)
'--metric', dest='metric', metavar='METRIC', default='kagan_angle', choices=metrics.metrics, help='metric to measure model distances. Choices: [%s]. Default: ' 'kagan_angle' % ', '.join(metrics.metrics))
'--write-config', dest='write_config', metavar='FILE', help='write configuration (or default configuration) to FILE')
'cluster', args[1:], setup=Clustering.cli_setup(method, setup), details='Available clustering methods: [%s]. Use ' '"grond cluster <method> --help" to get list of method ' 'dependent options.' % ', '.join(methods))
help_and_die( parser, 'no such clustering method: %s' % method if method else 'no clustering method specified')
clustering = read_config(method) else:
write_config(clustering, options.write_config) else: help_and_die(parser, 'no rundir')
except grond.GrondError as e: die(str(e))
'--show', dest='show', action='store_true', help='show plot for interactive inspection')
help_and_die(parser, '1, 2 or 3 arguments required')
else: env = None
def get_doc_title(doc): for ln in doc.split('\n'): ln = ln.strip() if ln != '': ln = ln.strip('.') return ln return 'Undocumented.'
if env: plot_classes = env.get_plot_classes() else: plot_classes = plot.get_all_plot_classes()
plot_names, plot_doc = zip(*[(pc.name, pc.__doc__) for pc in plot_classes])
plot_descs = [get_doc_title(doc) for doc in plot_doc] left_spaces = max([len(pn) for pn in plot_names])
for name, desc in zip(plot_names, plot_descs): print('{name:<{ls}} - {desc}'.format( ls=left_spaces, name=name, desc=desc))
plot_config_collection = plot.get_plot_config_collection(env) print(plot_config_collection)
if env is None: help_and_die(parser, 'two or three arguments required') plot_names = plot.get_plot_names(env) plot.make_plots(env, plot_names=plot_names, show=options.show)
if env is None: help_and_die(parser, 'two or three arguments required') plots = plot.PlotConfigCollection.load(args[0]) plot.make_plots(env, plots, show=options.show)
else: help_and_die(parser, 'two or three arguments required')
import matplotlib matplotlib.use('Agg')
def setup(parser): pass
parser, options, args = cl_parse('movie', args, setup)
if len(args) != 4: help_and_die(parser, 'four arguments required')
run_path, xpar_name, ypar_name, movie_filename_template = args
from grond import plot
movie_filename = movie_filename_template % { 'xpar': xpar_name, 'ypar': ypar_name}
try: plot.make_movie(run_path, xpar_name, ypar_name, movie_filename)
except grond.GrondError as e: die(str(e))
'--type', dest='type', metavar='TYPE', choices=('event', 'event-yaml', 'source', 'vector'), help='select type of objects to be exported. Choices: ' '"event" (default), "event-yaml", "source", "vector".')
'--parameters', dest='parameters', metavar='PLIST', help='select parameters to be exported. PLIST is a ' 'comma-separated list where each entry has the form ' '"<parameter>[.<measure>]". Available measures: "best", ' '"mean", "std", "minimum", "percentile16", "median", ' '"percentile84", "maximum".')
'--selection', dest='selection', metavar='EXPRESSION', help='only export data for runs which match EXPRESSION. ' 'Example expression: "tags_contains:excellent,good"')
'--output', dest='filename', metavar='FILE', help='write output to FILE')
help_and_die(parser, 'arguments required')
help_and_die( parser, 'invalid choice: %s (choose from %s)' % ( repr(what), ', '.join(repr(x) for x in what_choices)))
pnames = options.parameters.split(',') else:
what, dirnames, filename=options.filename, type=options.type, pnames=pnames, selection=options.selection)
except grond.GrondError as e: die(str(e))
def setup(parser): parser.add_option( '-d', '--dir-names', dest='show_dirnames', action='store_true', help='show directory names instead of run names')
parser, options, args = cl_parse('tag', args, setup) if len(args) < 2: help_and_die(parser, 'two or more arguments required')
action = args.pop(0)
if action not in ('add', 'remove', 'list'): help_and_die(parser, 'invalid action: %s' % action)
if action in ('add', 'remove'): if len(args) < 2: help_and_die(parser, 'three or more arguments required')
tag = args.pop(0)
rundirs = args
if action == 'list': rundirs = args
from grond.environment import Environment
errors = False for rundir in rundirs: try: env = Environment([rundir]) if options.show_dirnames: name = rundir else: name = env.get_problem().name
info = env.get_run_info() if action == 'add': info.add_tag(tag) env.set_run_info(info) elif action == 'remove': info.remove_tag(tag) env.set_run_info(info) elif action == 'list': print('%-60s : %s' % ( name, ', '.join(info.tags)))
except grond.GrondError as e: errors = True logger.error(e)
if errors: die('Errors occurred, see log messages above.')
env.set_current_event_name(event_name)
env, conf, update_without_plotting=update_without_plotting, make_index=False, make_archive=False, nthreads=nthreads)
except grond.GrondError as e: logger.error(str(e)) return False
report_index, report_archive, serve_ip, serve_report, read_config, \ write_config, ReportConfig
'--index-only', dest='index_only', action='store_true', help='create index only') '--serve', '-s', dest='serve', action='store_true', help='start http service') '--serve-external', '-S', dest='serve_external', action='store_true', help='shortcut for --serve --host=default --fixed-port') '--host', dest='host', default='localhost', help='<ip> to start the http server on. Special values for ' '<ip>: "*" binds to all available interfaces, "default" ' 'to default external interface, "localhost" to "127.0.0.1".') '--port', dest='port', type=int, default=8383, help='set default http server port. Will count up if port is ' 'already in use unless --fixed-port is given.') '--fixed-port', dest='fixed_port', action='store_true', help='fail if port is already in use') '--open', '-o', dest='open', action='store_true', help='open report in browser') '--config', dest='config', metavar='FILE', help='report configuration file to use') '--write-config', dest='write_config', metavar='FILE', help='write configuration (or default configuration) to FILE') '--update-without-plotting', dest='update_without_plotting', action='store_true', help='quick-and-dirty update parameter files without plotting') '--parallel', dest='nparallel', type=int, default=1, help='set number of runs to process in parallel, ' 'If set to more than one, --status=quiet is implied.') '--threads', dest='nthreads', type=int, default=1, help='set number of threads per process (default: 1).' 'Set to 0 to use all available cores.') '--no-archive', dest='no_archive', action='store_true', help='don\'t create archive file.')
try: conf = read_config(options.config) except grond.GrondError as e: die(str(e))
s_conf = ' --config="%s"' % options.config else: plot_config_collection=plot.get_plot_config_collection())
try: write_config(conf, options.write_config) sys.exit(0)
except grond.GrondError as e: die(str(e))
# commandline options that can override config values conf.make_archive = False
conf.report_base_path = conf.rel_path(args[0]) s_conf = ' %s' % args[0] args = []
report_index(conf) report_archive(conf) args = []
[rundir], None, conf, options.update_without_plotting, options.nthreads))
elif args: try: env = Environment(args) for event_name in env.get_selected_event_names(): payload.append(( args, event_name, conf, options.update_without_plotting, options.nthreads))
except grond.GrondError as e: die(str(e))
make_report, *zip(*payload), nprocs=options.nparallel):
die('no report entries generated')
if options.serve_external: host = 'default' else: host = options.host
addr = serve_ip(host), options.port
serve_report( addr, report_config=conf, fixed_port=options.fixed_port or options.serve_external, open=options.open)
import webbrowser url = 'file://%s/index.html' % op.abspath(report_base_path) webbrowser.open(url)
else: logger.info('Nothing to do, see: grond report --help')
def setup(parser): parser.add_option( '--time-factor-pre', dest='time_factor_pre', type=float, metavar='NUMBER', default=0.5, help='set duration to extract before synthetic P phase arrival, ' 'relative to 1/fmin. fmin is taken from the selected target ' 'group in the config file (default=%default)') parser.add_option( '--time-factor-post', dest='time_factor_post', type=float, metavar='NUMBER', default=0.5, help='set duration to extract after synthetic P phase arrival, ' 'relative to 1/fmin. fmin is taken from the selected target ' 'group in the config file (default=%default)') parser.add_option( '--distance-min', dest='distance_min', type=float, metavar='NUMBER', help='minimum event-station distance [m]') parser.add_option( '--distance-max', dest='distance_max', type=float, metavar='NUMBER', help='maximum event-station distance [m]') parser.add_option( '--depth-min', dest='depth_min', type=float, metavar='NUMBER', help='minimum station depth [m]') parser.add_option( '--depth-max', dest='depth_max', type=float, metavar='NUMBER', help='maximum station depth [m]') parser.add_option( '--picks', dest='picks_filename', metavar='FILENAME', help='add file with P picks in Snuffler marker format') parser.add_option( '--save', dest='output_filename', metavar='FILENAME.FORMAT', help='save output to file FILENAME.FORMAT') parser.add_option( '--dpi', dest='output_dpi', type=float, default=120., metavar='NUMBER', help='DPI setting for raster formats (default=120)')
parser, options, args = cl_parse('qc-polarization', args, setup) if len(args) != 3: help_and_die(parser, 'missing arguments')
if options.output_filename: import matplotlib matplotlib.use('Agg')
import grond.qc
config_path, event_name, target_group_path = args
try: config = grond.read_config(config_path) except grond.GrondError as e: die(str(e))
ds = config.get_dataset(event_name)
engine = config.engine_config.get_engine()
nsl_to_time = None if options.picks_filename: markers = marker.load_markers(options.picks_filename) marker.associate_phases_to_events(markers)
nsl_to_time = {} for m in markers: if isinstance(m, marker.PhaseMarker): ev = m.get_event() if ev is not None and ev.name == event_name: nsl_to_time[m.one_nslc()[:3]] = m.tmin
if not nsl_to_time: help_and_die( parser, 'no markers associated with event "%s" found in file "%s"' % ( event_name, options.picks_filename))
target_group_paths_avail = [] for target_group in config.target_groups: name = target_group.path if name == target_group_path: imc = target_group.misfit_config fmin = imc.fmin fmax = imc.fmax ffactor = imc.ffactor
store = engine.get_store(target_group.store_id) timing = '{cake:P|cake:p|cake:P\\|cake:p\\}'
grond.qc.polarization( ds, store, timing, fmin=fmin, fmax=fmax, ffactor=ffactor, time_factor_pre=options.time_factor_pre, time_factor_post=options.time_factor_post, distance_min=options.distance_min, distance_max=options.distance_max, depth_min=options.depth_min, depth_max=options.depth_max, nsl_to_time=nsl_to_time, output_filename=options.output_filename, output_dpi=options.output_dpi)
return
target_group_paths_avail.append(name)
die('no target group with path "%s" found. Available: %s' % ( target_group_path, ', '.join(target_group_paths_avail)))
def setup(parser): parser.add_option( '--diff', dest='diff', action='store_true', help='create diff between normalized old and new versions')
parser, options, args = cl_parse('upgrade-config', args, setup) if len(args) != 1: help_and_die(parser, 'missing argument <configfile>')
from grond import upgrade upgrade.upgrade_config_file(args[0], diff=options.diff)
help_and_die(parser, 'requires exactly two arguments')
'--short', dest='short', action='store_true', help='only print Grond\'s version number') '--failsafe', dest='failsafe', action='store_true', help='do not get irritated when some dependencies are missing')
except ImportError: print('pyrocko: N/A')
except ImportError: print('numpy: N/A')
except ImportError: print('scipy: N/A')
except ImportError: print('matplotlib: N/A')
except ImportError: print('PyQt: N/A') print('Qt: N/A')
die('fell back to failsafe version printing')
main() |