openquake.commands package#

db command#

openquake.commands.db.convert(strings)[source]#

Convert strings into literal Python objects

openquake.commands.db.main(cmd, args=())[source]#

Run a database command

dbserver command#

openquake.commands.dbserver.main(cmd, dbhostport=None, foreground=False, *, loglevel='INFO')[source]#

start/stop/restart the database server, or return its status

engine command#

openquake.commands.engine.del_calculation(job_id, confirmed=False)[source]#

Delete a calculation and all associated outputs.

openquake.commands.engine.get_job_id(job_id, username)[source]#
openquake.commands.engine.main(no_distribute=False, yes=False, upgrade_db=False, db_version=False, what_if_I_upgrade=False, list_hazard_calculations=False, list_risk_calculations=False, delete_uncompleted_calculations=False, multi=False, reuse_input=False, *, log_file=None, make_html_report=None, run=None, delete_calculation: int = None, hazard_calculation_id: int = None, list_outputs: int = None, show_log=None, export_output=None, export_outputs=None, param='', config_file=None, exports='', log_level='info', sample_sources=False, nodes: int = 1)[source]#

Run a calculation using the traditional command line API

export command#

openquake.commands.export.main(datastore_key, calc_id: int = -1, *, exports='csv', export_dir='.')[source]#

Export an output from the datastore. To see the available datastore keys, use the command oq info exports.

info command#

openquake.commands.info.do_build_reports(directory)[source]#

Walk the directory and builds pre-calculation reports for all the job.ini files found.

openquake.commands.info.is_upper(func)[source]#

True if the name of the function starts with an uppercase character

openquake.commands.info.main(what, report=False)[source]#

Give information about the passed keyword or filename

openquake.commands.info.print_features(fiona_file)[source]#
openquake.commands.info.print_geohash(what)[source]#
openquake.commands.info.print_gsim(what)[source]#

Print the docstring of the given GSIM, or print all available GSIMs.

openquake.commands.info.print_imt(what)[source]#

Print the docstring of the given IMT, or print all available IMTs.

openquake.commands.info.print_peril(what)[source]#

Print the docstring of the given SecondaryPeril, or print all available subclasses

openquake.commands.info.print_subclass(what, cls)[source]#

Print the docstring of the given subclass, or print all available subclasses.

openquake.commands.info.source_model_info(sm_nodes)[source]#

Extract information about source models. Returns a table with TRTs as rows and source classes as columns.

plot command#

openquake.commands.plot.filter_sources(csm, src_ids, codes, excluded_codes)[source]#
openquake.commands.plot.get_boundary_2d(smsh)[source]#

Returns a polygon

openquake.commands.plot.main(what, calc_id: int = -1, others: int = [], webapi=False, local=False)[source]#

Generic plotter for local and remote calculations.

openquake.commands.plot.make_figure_agg_curves(extractors, what)[source]#

$ oq plot “agg_curves?kind=mean&loss_type=structural” -1

openquake.commands.plot.make_figure_avg_gmf(extractors, what)[source]#

$ oq plot “avg_gmf?imt=PGA”

openquake.commands.plot.make_figure_compare_avg_gmf(extractors, what)[source]#

$ oq plot “compare_avg_gmf?imt=PGA”

openquake.commands.plot.make_figure_csq_curves(extractors, what)[source]#

$ oq plot “csq_curves?agg_id=0&loss_type=structural&consequence=losses” -1

openquake.commands.plot.make_figure_disagg(extractors, what)[source]#

$ oq plot “disagg?kind=Mag&imt=PGA&poe_id=0&spec=rlzs”

openquake.commands.plot.make_figure_disagg_by_src(extractors, what)[source]#

$ oq plot “disagg_by_src?”

openquake.commands.plot.make_figure_dist_by_mag(extractors, what)[source]#

$ oq plot “dist_by_mag?”

openquake.commands.plot.make_figure_effect(extractors, what)[source]#

$ oq plot “effect?”

openquake.commands.plot.make_figure_effect_by_mag(extractors, what)[source]#

$ oq plot “effect_by_mag?”

openquake.commands.plot.make_figure_event_based_mfd(extractors, what)[source]#

$ oq plot “event_based_mfd?” -1 -2

openquake.commands.plot.make_figure_gmf_scenario(extractors, what)[source]#

$ oq plot “gmf_scenario?imt=PGA&kind=rlz-0”

openquake.commands.plot.make_figure_governing_mce(extractors, what)[source]#

$ oq plot “governing_mce?”

openquake.commands.plot.make_figure_gridded_sources(extractors, what)[source]#

$ oq plot “gridded_sources?task_no=0”

openquake.commands.plot.make_figure_hcurves(extractors, what)[source]#

$ oq plot “hcurves?kind=mean&imt=PGA&site_id=0”

openquake.commands.plot.make_figure_hmaps(extractors, what)[source]#

$ oq plot “hmaps?kind=mean&imt=PGA”

openquake.commands.plot.make_figure_magdist(extractors, what)[source]#
openquake.commands.plot.make_figure_mean_hcurves_rtgm(extractors, what)[source]#

$ oq plot “mean_hcurves_rtgm?”

openquake.commands.plot.make_figure_memory(extractors, what)[source]#

$ oq plot “memory?”

openquake.commands.plot.make_figure_rups_by_mag_dist(extractors, what)[source]#

$ oq plot “rups_by_mag_dist?”

openquake.commands.plot.make_figure_rupture(extractors, what)[source]#

$ oq plot “rupture?”

openquake.commands.plot.make_figure_rupture_3d(extractors, what)[source]#

$ oq plot “rupture_3d?”

openquake.commands.plot.make_figure_rupture_info(extractors, what)[source]#

$ oq plot “rupture_info?min_mag=6”

openquake.commands.plot.make_figure_source_data(extractors, what)[source]#

$ oq plot “source_data?taskno=XX”

openquake.commands.plot.make_figure_sources(extractors, what)[source]#

$ oq plot “sources?source_id=xxx” $ oq plot “sources?code=N&code=F” $ oq plot “sources?exclude=A”

openquake.commands.plot.make_figure_task_info(extractors, what)[source]#

$ oq plot “task_info?kind=classical”

openquake.commands.plot.make_figure_tot_curves(extractors, what)[source]#

$ oq plot “tot_curves?loss_type=structural&kind=rlz-000&absolute=1”

openquake.commands.plot.make_figure_uhs(extractors, what)[source]#

$ oq plot “uhs?kind=mean&site_id=0”

openquake.commands.plot.make_figure_uhs_cluster(extractors, what)[source]#

$ oq plot “uhs_cluster?k=12”

openquake.commands.plot.make_figure_vs30(extractors, what)[source]#

$ oq plot “vs30?”

openquake.commands.plot.middle(x)[source]#
openquake.commands.plot.plot_csv(fname)[source]#

Plot a CSV with columns (title, time1, time2, …)

openquake.commands.plot.plot_geom(geom, ax, color, label)[source]#
openquake.commands.plot.plot_multi_fault_sources(mfs, src_ids, ax, min_x, max_x, min_y, max_y)[source]#
openquake.commands.plot.plot_point_sources(srcs, ax, min_x, max_x, min_y, max_y)[source]#
openquake.commands.plot.plot_polygon_sources(srcs, ax, min_x, max_x, min_y, max_y, kind)[source]#
openquake.commands.plot.plot_sources(srcs, ax, min_x, max_x, min_y, max_y)[source]#
openquake.commands.plot.plot_wkt(wkt_string)[source]#

Plot a WKT string describing a polygon

openquake.commands.plot.stacked_bar(ax, x, ys, width)[source]#

purge command#

openquake.commands.purge.main(what, force=False)[source]#

Remove calculations from the file system. If you want to remove everything, use oq reset.

openquake.commands.purge.purge(status, days, force)[source]#

Remove calculations of the given status older than days

openquake.commands.purge.purge_all(user=None)[source]#

Remove all calculations of the given user

openquake.commands.purge.purge_one(calc_id, user, force)[source]#

Remove one calculation ID from the database and remove its datastore

sample command#

openquake.commands.sample.main(fname, reduction_factor: <openquake.hazardlib.valid.FloatRange object at 0x7ff2b65d0e90>, investigation_time: ~openquake.hazardlib.valid.positivefloat = 50.0)[source]#

Produce a submodel from fname by sampling the nodes randomly. Supports source models, site models and exposure models. As a special case, it is also able to reduce .csv files by sampling the lines. This is a debugging utility to reduce large computations to small ones.

openquake.commands.sample.reduce_source_model(fname, reduction_factor, itime)[source]#

Reduce the source model by sampling the sources; as a special case, multiPointSources are split in pointSources and then sampled.

openquake.commands.sample.save_bak(fname, node, num_nodes, total)[source]#

reset command#

openquake.commands.reset.main(yes=False)[source]#

Remove all the datastores and the database of the current user

run command#

openquake.commands.run.main(job_ini, pdb=False, reuse_input=False, *, slowest: int = None, hc: int = None, param=(), concurrent_tasks: int = None, exports: <openquake.hazardlib.valid.Choices object at 0x7ff2b6458ed0> = '', loglevel='info', nodes: int = 1)[source]#

Run a calculation

show command#

openquake.commands.show.main(what='contents', calc_id: str_or_int = -1, extra=())[source]#

Show the content of a datastore (by default the last one).

openquake.commands.show.print_(aw)[source]#
openquake.commands.show.str_or_int(calc_id)[source]#

show_attrs command#

openquake.commands.show_attrs.main(key, calc_id: int = -1)[source]#

Show the attributes of a HDF5 dataset in the datastore.

tidy command#

openquake.commands.tidy.main(fnames)[source]#

Reformat a NRML file in a canonical form. That also means reducing the precision of the floats to a standard value. If the file is invalid, a clear error message is shown.

to_hdf5 command#

openquake.commands.to_hdf5.convert_npz_hdf5(input_file, output_file)[source]#
openquake.commands.to_hdf5.convert_xml_hdf5(input_file, output_file)[source]#
openquake.commands.to_hdf5.main(input)[source]#

Convert .xml and .npz files to .hdf5 files.

upgrade_nrml command#

openquake.commands.upgrade_nrml.get_vulnerability_functions_04(fname)[source]#

Parse the vulnerability model in NRML 0.4 format.

Parameters:

fname – path of the vulnerability file

Returns:

a dictionary imt, taxonomy -> vulnerability function + vset

openquake.commands.upgrade_nrml.main(directory, dry_run=False, multipoint=False)[source]#

Upgrade all the NRML files contained in the given directory to the latest NRML version. Works by walking all subdirectories. WARNING: there is no downgrade!

openquake.commands.upgrade_nrml.upgrade_file(path, multipoint)[source]#

Upgrade to the latest NRML version

webui command#

openquake.commands.webui.main(cmd, hostport='127.0.0.1:8800', skip_browser: bool = False)[source]#

Start the webui server in foreground. Other webui commands can be launched after activating the openquake virtual environment, using Django’s command-line utility for administrative tasks, e.g.: manage.py <command> [options]

openquake.commands.webui.runserver(hostport=None, skip_browser=False)[source]#