openquake.commands package

openquake.commands.export module

openquake.commands.export.export(datastore_key, export_dir='.', calc_id=-1, exports='csv')[source]

Export an output from the datastore.

openquake.commands.info module

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.info(calculators, gsims, views, exports, build_reports, report, input_file='')[source]

Give information. You can pass the name of an available calculator, a job.ini file, or a zip archive with the input files.

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.plot module

openquake.commands.plot.make_figure(indices, imtls, spec_curves, curves=(), label='')[source]
Parameters:
  • indices – the indices of the sites under analysis
  • 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
openquake.commands.plot.plot(calc_id, other_id=None, sites='0')[source]

Hazard curves plotter.

openquake.commands.plot_sites module

openquake.commands.plot_sites.make_tiles(sitecol, sites_per_tile, maximum_distance)[source]
openquake.commands.plot_sites.plot_sites(calc_id)[source]

Plot the hazard sites of a calculations with one ore more a bounding boxes (a box for each tile). If point sources are present, prints them too as circles of radius integration_distance + max rupture radius.

openquake.commands.purge module

openquake.commands.purge.purge(calc_id)[source]

Remove the given calculation. If calc_id is 0, remove all calculations.

openquake.commands.reduce module

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.

openquake.commands.reduce.reduce(fname, reduction_factor)[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.run module

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.run(job_ini, slowest, hc, param, concurrent_tasks=8, exports='', loglevel='info', pdb=None)[source]

Run a calculation.

openquake.commands.run.run2(job_haz, job_risk, concurrent_tasks, pdb, exports, params, monitor)[source]

Run both hazard and risk, one after the other

openquake.commands.show module

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

Extract hcurves from the datastore and compute their means.

Returns:curves_by_rlz, mean_curves
openquake.commands.show.show(what, calc_id=-1)[source]

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

openquake.commands.show_attrs module

openquake.commands.show_attrs.show_attrs(key, calc_id=-1)[source]

Show the attributes of a HDF5 dataset in the datastore.

openquake.commands.tidy module

openquake.commands.tidy.tidy(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.

openquake.commands.upgrade_nrml module

openquake.commands.upgrade_nrml.filter_vset(elem)[source]
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

openquake.commands.upgrade_nrml.upgrade_nrml(directory, dry_run)[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!

Module contents