Export API

Functions for listing completed calculations and outputs, as well as exporting outputs to files.

Functions for getting information about completed jobs and calculation outputs, as well as exporting outputs from the database to various file formats.

openquake.engine.export.core.LT_PATH_JOIN_TOKEN = '_'

Used to separate node labels in a logic tree path

openquake.engine.export.core.export(output_id, target, export_type='xml, geojson, csv')[source]

Export the given calculation output_id from the database to the specified target directory in the specified export_type.

openquake.engine.export.core.get_outputs(job_id, output_type=None)[source]

Get all openquake.engine.db.models.Output objects associated with the specified job and output_type.

Parameters:
Returns:

django.db.models.query.QuerySet of openquake.engine.db.models.Output objects.

openquake.engine.export.core.makedirs(path)[source]

Make all of the directories in the path using os.makedirs.

Hazard Export

API for exporting hazard artifacts from the DB.

Functionality for exporting and serializing hazard curve calculation results.

openquake.engine.export.hazard.export_disagg_matrix_xml(key, output, target)[source]

Export disaggregation histograms to the target.

Parameters:
Returns:

A list of exported file name (including the absolute path to each file).

openquake.engine.export.hazard.export_gmf_csv(key, output, target)[source]

Export the GMF Collection specified by output to the target.

Parameters:
Returns:

The same return value as defined by export().

openquake.engine.export.hazard.export_gmf_xml(key, output, target)[source]

Export the GMF Collection specified by output to the target.

Parameters:
Returns:

The same return value as defined by export().

openquake.engine.export.hazard.export_hazard_curve(key, output, target)[source]

Export the specified hazard curve output to the target.

Parameters:
Returns:

The same return value as defined by export().

openquake.engine.export.hazard.export_hazard_curve_csv(key, output, target)[source]

Save a hazard curve (of a given IMT) as a .csv file in the format (lon lat poe1 ... poeN), where the fields are space separated.

openquake.engine.export.hazard.export_hazard_curve_multi_xml(key, output, target)[source]
openquake.engine.export.hazard.export_hazard_map(key, output, target)[source]

General hazard map export code.

openquake.engine.export.hazard.export_hazard_map_csv(key, output, target)[source]

General hazard map export code.

openquake.engine.export.hazard.export_ses_csv(key, output, target)[source]

Export the Stochastic Event Set Collection specified by output to the target in csv format.

Parameters:
Returns:

The exported file path

openquake.engine.export.hazard.export_ses_xml(key, output, target)[source]

Export the Stochastic Event Set Collection specified by output to the target.

Parameters:
Returns:

The exported file path

openquake.engine.export.hazard.export_uh_spectra_xml(key, output, target)[source]

Export the specified UHS output to the target.

Parameters:
Returns:

A list containing the exported file name.

openquake.engine.export.hazard.regroup(idx_gmv_imt_triples)[source]

Regroup the GMF data in a form suitable for export.

>>> data = [(1, 0.1, 'PGA'), (2, 0.2, 'PGA'),
...         (1, 0.11, 'SA(0.1)'), (2, 0.21, 'SA(0.1)'),
...         (1, 0.12, 'SA(0.2)'), (2, 0.22, 'SA(0.2)')]
>>> regroup(data)
[(1, 2), [0.1, 0.2], [0.11, 0.21], [0.12, 0.22]]
openquake.engine.export.hazard.to_imt_str(gmf)[source]

Extract the IMT from a gmf record