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.run_job(cfg_file, log_level='info', log_file=None, exports='', hazard_calculation_id=None, **kw)[source]

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

Parameters:
  • cfg_file (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.
  • hazard_calculation_id – ID of the previous calculation or None
openquake.commands.engine.run_tile(job_ini, sites_slice)[source]

Used in tiling calculations

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(node)[source]

Extract information about a NRML/0.5 source model

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, imtls, poes, pmaps)[source]
Parameters:
  • indices – the indices of the sites under analysis
  • n_sites – total number of sites
  • imtls – DictArray with the IMTs and levels
  • poes – PoEs used to compute the hazard maps
  • pmaps – a list of probability maps per realization

purge command

openquake.commands.purge.purge_all(user=None)[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.random_filter(objects, reduction_factor, seed=42)[source]

Given a list of objects, returns a sublist by extracting randomly some elements. The reduction factor (< 1) tells how small is the extracted list compared to the original list.

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, concurrent_tasks, pdb, exports, params, monitor)[source]

Run both hazard and risk, one after the other

run_tiles command

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)[source]

Upgrade to the latest NRML version

webui command

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