openquake.commands package

db command

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

Convert strings into literal Python objects

dbserver command

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=None)[source]
openquake.commands.engine.read(calc_id, username=None)[source]
Parameters:
  • calc_id – a calculation ID
  • username – if given, restrict the search to the user’s calculations
Returns:

the associated DataStore instance

openquake.commands.engine.run_job(job_ini, log_level='info', log_file=None, exports='', username='jenkins', **kw)[source]

Run a job using the specified config file and other options.

Parameters:
  • job_ini (str) – Path to calculation config (INI-style) files.
  • log_level (str) – ‘debug’, ‘info’, ‘warn’, ‘error’, or ‘critical’
  • log_file (str) – Path to log file.
  • exports – A comma-separated string of export types requested by the user.
  • username – Name of the user running the job
  • kw – Extra parameters like hazard_calculation_id and calculation_mode
openquake.commands.engine.run_tile(job_ini, sites_slice)[source]

Used in tiling calculations

openquake.commands.engine.smart_run(job_ini, oqparam, log_level, log_file, exports, reuse_hazard)[source]

Run calculations by storing their hazard checksum and reusing previous calculations if requested.

export command

from_shapefile command

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.print_csm_info(fname)[source]

Parse the composite source model without instantiating the sources and prints information about its composition and the full logic tree

openquake.commands.info.source_model_info(nodes)[source]

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

plot_agg_curve command

openquake.commands.plot_agg_curve.make_figure(curves)[source]

plot command

openquake.commands.plot.get_pmaps(dstore, indices)[source]
openquake.commands.plot.make_figure(indices, n, imtls, spec_curves, curves=(), label='')[source]
Parameters:
  • indices – the indices of the sites under analysis
  • n – the total number of sites
  • imtls – ordered dictionary with the IMTs and levels
  • spec_curves – a dictionary of curves IMT -> array(n_sites, n_levels)
  • curves – a dictionary of dictionaries IMT -> array
  • label – the label associated to spec_curves

plot_sites command

plot_uhs command

openquake.commands.plot_uhs.make_figure(indices, n_sites, oq, pmaps)[source]
Parameters:
  • indices – the indices of the sites under analysis
  • n_sites – total number of sites
  • oq – instance of OqParam
  • pmaps – a list of probability maps per realization

purge command

openquake.commands.purge.purge_all(user=None, fast=False)[source]

Remove all calculations of the given user

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

Remove one calculation ID from the database and remove its datastore

reduce command

openquake.commands.reduce.reduce_source_model(fname, reduction_factor)[source]
openquake.commands.reduce.save_bak(fname, node, num_nodes, total)[source]

reset command

run command

class openquake.commands.run.PStatData(ncalls, tottime, percall, cumtime, percall2, path)

Bases: tuple

cumtime

Alias for field number 3

ncalls

Alias for field number 0

path

Alias for field number 5

percall

Alias for field number 2

percall2

Alias for field number 4

tottime

Alias for field number 1

openquake.commands.run.get_pstats(pstatfile, n)[source]

Return profiling information as an RST table.

Parameters:
  • pstatfile – path to a .pstat file
  • n – the maximum number of stats to retrieve
openquake.commands.run.run2(job_haz, job_risk, calc_id, concurrent_tasks, pdb, loglevel, exports, params)[source]

Run both hazard and risk, one after the other

show command

openquake.commands.show.get_hcurves_and_means(dstore)[source]

Extract hcurves from the datastore and compute their means.

Returns:curves_by_rlz, mean_curves

show_attrs command

tidy command

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]

to_shapefile command

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.upgrade_file(path, multipoint)[source]

Upgrade to the latest NRML version

webui command

openquake.commands.webui.rundjango(subcmd, hostport=None, skip_browser=False)[source]