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.Outputobjects associated with the specified job and output_type.Parameters: - job_id (int) – ID of a
openquake.engine.db.models.OqJob. - output_type (str) – the output type; if None, return all outputs
Returns: django.db.models.query.QuerySetofopenquake.engine.db.models.Outputobjects.- job_id (int) – ID of a
-
openquake.engine.export.core.makedirs(path)[source]¶ Make all of the directories in the
pathusing 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: - output –
openquake.engine.db.models.Outputwith an output_type of disagg_matrix. - target (str) – Destination directory location for exported files.
Returns: A list of exported file name (including the absolute path to each file).
- output –
-
openquake.engine.export.hazard.export_gmf_xml(key, output, target)[source]¶ Export the GMF Collection specified by
outputto thetarget.Parameters: - output –
openquake.engine.db.models.Outputwith an output_type of gmf. - target – The same
targetasexport().
Returns: The same return value as defined by
export().- output –
-
openquake.engine.export.hazard.export_hazard_curve(key, output, target)[source]¶ Export the specified hazard curve
outputto thetarget.Parameters: - output –
openquake.engine.db.models.Outputwith an output_type of hazard_curve. - target – The same
targetasexport().
Returns: The same return value as defined by
export().- output –
-
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_map(key, output, target)[source]¶ General hazard map export code.
-
openquake.engine.export.hazard.export_ses_xml(key, output, target)[source]¶ Export the Stochastic Event Set Collection specified by
outputto thetarget.Parameters: - output –
openquake.engine.db.models.Outputwith an output_type of ses. - target (str) – Destination directory location for exported files.
Returns: A list of exported file names (including the absolute path to each file).
- output –
-
openquake.engine.export.hazard.export_uh_spectra_xml(key, output, target)[source]¶ Export the specified UHS
outputto thetarget.Parameters: - output –
openquake.engine.db.models.Outputwith an output_type of uh_spectra. - target (str) – Destination directory location for exported files.
Returns: A list containing the exported file name.
- output –