Outputs#
Exporting results from hazard and risk calculations#
Exporting results from a hazard calculation#
There are two alternative ways to get results from the OpenQuake-engine: directly through the calculation or by exporting them from the internal OpenQuake engine database once a calculation is completed.
The first option is defined at the OpenQuake-engine invocation through the flag –exports xml
, as shown in the example
below:
user@ubuntu:~$ oq engine --run job.ini --exports xml
This will export the results to the results
directory specified in the job.ini
file.
The second option allows the user to export the computed results or just a subset of them whenever they want. In order
to obtain the list of results of the hazard calculations stored in the OpenQuake engine database the user can utilize
the --lhc
command (‘list hazard calculations’) to list the hazard calculations:
user@ubuntu:~$ oq engine --lhc
The execution of this command will produce a list similar to the one provided below (the numbers in red are the calculations IDs):
user@ubuntu:~$ oq engine --lhc
job_id | status | start_time | description
1 | failed | 2013-03-01 09:49:34 | Classical PSHA
2 | successful | 2013-03-01 09:49:56 | Classical PSHA
3 | failed | 2013-03-01 10:24:04 | Classical PSHA
4 | failed | 2013-03-01 10:28:16 | Classical PSHA
5 | failed | 2013-03-01 10:30:04 | Classical PSHA
6 | successful | 2013-03-01 10:31:53 | Classical PSHA
7 | failed | 2013-03-09 08:15:14 | Classical PSHA
8 | successful | 2013-03-09 08:18:04 | Classical PSHA
Subsequently the user can get the list of result stored for a specific hazard analysis by using the --list-outputs
,
or --lo
, command, as in the example below (note that the number in blue emphasizes the result ID):
user@ubuntu:~$ oq engine --lo <calc_id>
id | name
3 | hcurves
and finally extract an xml file for a specific hazard result:
user@ubuntu:~$ oq engine --export-outputs <result_id> <output_folder>
Description of hazard outputs#
The results generated by the OpenQuake-engine are fundamentally of two distinct typologies differentiated by the presence (or absence) of epistemic uncertainty in the PSHA input model.
When epistemic uncertainty is incorporated into the calculation, the OpenQuake-engine calculators (e.g. Classical PSHA, Event Based PSHA, Disaggregation, UHS) produce a set of results (i.e. hazard curves, ground motion fields, disaggregation outputs, UHS, for each logic-tree realisation) which reflects epistemic uncertainties introduced in the PSHA input model. For each logic tree sample, results are computed and stored. Calculation of results statistics (mean, standard deviation, quantiles) are supported by all the calculators.
By default, OpenQuake will export only the statistical results, i.e. mean curves and quantiles. If the user requires the complete results for all realizations, there is a flag to specify, please see the FAQ. Beware that if the logic tree contains a large number of end branches the process of exporting the results from each end Branch can add a significant amount of time - possibly longer than the computation time - and result in a large volume of disk spaced being used. In this case it is best to postprocess the data programmatically. Please contact us and we will be happy to give directions on how to do that in Python.
NB: in the literature there are different algorithms for the computation of the quantiles. The OpenQuake engine uses an algorithm based on interpolation which is implemented here:
In particular, the median is computed as the q=0.5 quantile.
Exporting results from a risk calculation#
To obtain a list of all risk calculations that have been previously run (successfully or unsuccessfully), or that are currently running, the following command can be employed:
user@ubuntu:~$ oq engine --list-risk-calculations
or simply:
user@ubuntu:~$ oq engine --lrc
Which will display a list of risk calculations as presented below.
job_id | status | start_time | description
1 | complete | 2015-12-02 08:50:30 | Scenario damage example
2 | failed | 2015-12-03 09:56:17 | Scenario risk example
3 | complete | 2015-12-04 10:45:32 | Scenario risk example
4 | complete | 2015-12-04 10:48:33 | Classical risk example
5 | complete | 2020-07-09 13:47:45 | Event based risk aggregation example
Then, in order to display a list of the risk outputs from a given job which has completed successfully, the following command can be used:
user@ubuntu:~$ oq engine --list-outputs <risk_calculation_id>
or simply:
user@ubuntu:~$ oq engine --lo <risk_calculation_id>
which will display a list of outputs for the calculation requested, as presented below:
Calculation 5 results:
id | name
11 | Aggregate Event Losses
1 | Aggregate Loss Curves
2 | Aggregate Loss Curves Statistics
3 | Aggregate Losses
4 | Aggregate Losses Statistics
5 | Average Asset Losses Statistics
13 | Earthquake Ruptures
6 | Events
7 | Full Report
10 | Input Files
12 | Realizations
14 | Source Loss Table
15 | Total Loss Curves
16 | Total Loss Curves Statistics
17 | Total Losses
18 | Total Losses Statistics
Then, in order to export all of the risk calculation outputs in the default file format (csv for most outputs), the following command can be used:
user@ubuntu:~$ oq engine --export-outputs <risk_calculation_id> <output_directory>
or simply:
user@ubuntu:~$ oq engine --eos <risk_calculation_id> <output_directory>
If, instead of exporting all of the outputs from a particular
calculation, only particular output files need to be exported, this can
be achieved by using the --export-output
option and providing the id
of the required output:
user@ubuntu:~$ oq engine --export-output <risk_output_id> <output_directory>
or simply:
user@ubuntu:~$ oq engine --eo <risk_output_id> <output_directory>