How to calculate the occurrence_rate for a rupture?

277 views
Skip to first unread message

Aulia Khalqillah

unread,
Jul 18, 2023, 4:14:04 AM7/18/23
to OpenQuake Users
Hi,

I just simulate the hazard calculation by using event based. In the hdf5 file, there is rupture dataset. In this file, each rup_id has its own occurrence_rate. How to calculate this occurrence_rate for each rup_id? Is the Gutenberg-Richter relationship used for occurrence_rate calculation?

I hope anyone can help answer these questions. Thanks

Aulia K

Peter Pažák

unread,
Jul 21, 2023, 4:34:13 AM7/21/23
to OpenQuake Users
Hi,

all these calculations are done by the engine in the background and the output is saved to hdf5 during the runs,
if you want to understand in more detail, you can study the code and/or calculate the rates using a sample script:

from openquake.hazardlib.source import PointSource
from openquake.hazardlib.mfd import TruncatedGRMFD
from openquake.hazardlib.scalerel import WC1994
from openquake.hazardlib.geo import Point, NodalPlane
from openquake.hazardlib.pmf import PMF
from openquake.hazardlib.tom import PoissonTOM

src = PointSource(
    source_id='1',
    name='point',
    tectonic_region_type='Active Shallow Crust',
    mfd=TruncatedGRMFD(min_mag=5., max_mag=6.5, bin_width=0.1, a_val=0.01, b_val=0.98),
    rupture_mesh_spacing=2,
    magnitude_scaling_relationship=WC1994(),
    rupture_aspect_ratio=1,
    temporal_occurrence_model=PoissonTOM(50.), #50 years investigation time
    upper_seismogenic_depth=2.,
    lower_seismogenic_depth=12.,
    location=Point(9.1500, 45.1833,30),
    nodal_plane_distribution=PMF([(1., NodalPlane(strike=45, dip=50, rake=0))]),
    hypocenter_distribution=PMF([(1, 10.)]) #depth 10 km
)

ruptures = [r for r in src.iter_ruptures()] #sample the ruptures in 50 years

print(ruptures[0].mag) #gives 5.05 as magnitude of the first rupture
print(ruptures[0].occurrence_rate) #gives 2.6023325356665764e-06 as a corresponding occurrence rate

which is indeed the occurrence rate for magnitude 5.5:

print(TruncatedGRMFD(min_mag=5., max_mag=6.5, bin_width=0.1, a_val=0.01, b_val=0.98).get_annual_occurrence_rates()) #gives among others 5.05, 2.6023325356665764e-06

Hope this helps
Peter

Dátum: utorok 18. júla 2023, čas: 10:14:04 UTC+2, odosielateľ: auliakhalq...@gmail.com

Aulia Khalqillah

unread,
Oct 21, 2023, 9:51:17 AM10/21/23
to OpenQuake Users
Thank you for your response. This is very helpful information.

Based on the script that you showed, we need the parameters of a-value and b-value in truncated GR MFD. How do we calculate these parameters for the simple fault source. Do we need the earthquake distribution around the correspond fault ?

Thank you for the attention.

Aulia K

Aulia Khalqillah

unread,
Jul 2, 2025, 1:22:45 AM7/2/25
to OpenQuake Users
Hi Peter and everyone.

I came back to this thread because I want to get the confirmation about the occurrence rate that I have calculated through the event-based mode for the single source model (subduction interface). I applied the TruncatedGRMFD to calculate the occurrence rate where the a-value = 5.9, b-value = 0.79, bin_width = 0.1, min_mag = 6.5, and max_mag = 9.1.

I have tried to calculate this through the OpenQuake engine, then produced the ruptrue file corresponding to each magnitude and its occurrence rate. Also, I have tried to calculcate the occurrence rate directly using TruncatedGRMFD module in a Python script (attached) by using the above parameters.

Both method gives different results for the occurrence rate given each magnitude. Example,

Mag | Occurrence Rate OQ-engine | Occurrence Rate Direct Calculation
6.55 | 0.00269678886979818 | 0.968147176087502

Is my Python code correct to calculate the occurrence rate? I attach the corresponding files.

Many thanks for the attention.

Aulia K
ruptures.xlsx
calculate_occurrence_rate.ipynb

Peter Pažák

unread,
Jul 14, 2025, 6:31:31 AM7/14/25
to OpenQuake Users
Hi Aulia,

the calculation in the notebook, essentially setting up a truncated GR MFD which calculates the rates per magnitude bin is correct.
The output in the excel: the occurrence rates are per each location, so if you for example sum all the frequencies in the excel for M 6.55, it gives 0.7281.
Some of the ruptures are most probably missing, because they are too far from the exposure/hazard sites.
I believe if you would have sites covering the whole source zone densely, you would get exactly the total rate of 0.9681 as from the MFD, the main reason for
the observed difference is that the rate is divided into all discretized points in the (area) source.

Peter


Dátum: streda 2. júla 2025, čas: 7:22:45 UTC+2, odosielateľ: auliakhalq...@gmail.com

Aulia Khalqillah

unread,
Jul 20, 2025, 5:37:51 PM7/20/25
to openqua...@googlegroups.com

Dear Peter,

Thank you for your explanation.

Best regards,
Aulia K


--
You received this message because you are subscribed to the Google Groups "OpenQuake Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openquake-use...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/openquake-users/24a49ae5-33d5-4716-a32c-a68fd369e130n%40googlegroups.com.

Aulia Khalqillah

unread,
Jul 9, 2026, 4:28:47 AM (6 days ago) Jul 9
to OpenQuake Users
Dear all members.

Currently, I am trying to understand and learn comprehensively about event based hazard calculation. As I understand, event-based hazard calculation simulates ground motion based  on stochastic event set (ses) where the ruptures are randomly generated. What I am concerned about now is the parameter "n_occ" or the number of occurrences. This parameter is stored in the rupture file (hdf5). The simplest way to calculate "n_occ" is using the approximation, n_occ ~ occurrence_rate * eff_investigation_time. However, in a comprehensive calculation, the "n_occ" is calculated based on a Poisson approximation.

I have tried to simulate the event based calculation for a simple case with some configuration as follows;

1. single point
2. ses_per_logic_tree_path = 1_000_000
3. number_of_logic_tree_path = 2
4. investigation_time = 1

using OpenQuake engine 3.23.2 (Python 3.11.6). Now, I am trying to re-calculate the "n_occ" using the "occurrence_rate" in the rupture output file that has been calculated and the parameters mentioned above. The calculation is conducted using the "calculate_n_occ.ipynb" (in the attachment). Unfortunately, the result of the re-calculation of n_occ is not the same as the calculation from the engine (see ruptures_630.xlsx, where "n_occ_recal" is the recalculation of n_occ).

Why the n_occ from the engine calculation is different from the re-calculation (python script), even using the same openquake version?

The hdf file can be accessed here.

I appreciate for anyone who can response this.

Best regards.
calculate_n_occ.ipynb
ruptures_630.xlsx

Marco Pagani

unread,
Jul 9, 2026, 6:27:41 AM (6 days ago) Jul 9
to openqua...@googlegroups.com, OpenQuake Users

n_occ comes from the random sampling of a temporal occurrence model (mostly a Poisson process). Unless you use the same seed, you will never get the same numbers. What you can do is to obtain the average rate from n_occ and compare it with the original one but you will need a long stochastic catalogue


Sent from my iPhone

On 9 Jul 2026, at 16:28, Aulia Khalqillah <auliakh...@usk.ac.id> wrote:

Dear all members.
To view this discussion visit https://groups.google.com/d/msgid/openquake-users/eea7aef8-b98f-441d-8ea9-fa28a12a3479n%40googlegroups.com.
<calculate_n_occ.ipynb>
<ruptures_630.xlsx>

Aulia Khalqillah

unread,
Jul 9, 2026, 8:56:43 AM (6 days ago) Jul 9
to openqua...@googlegroups.com
Dear Marco.

Thank you for your response.

Absolutely.

Actually, I use the same seed number (42) when I try to recalculate the n_occ through python code as in the openquake engine. Unfortunately, I got different n_occ from the recalculation. Did I miss something in the python code that I have provided?

As I know, everytime the engine is simulated with the same parameter and seed number, and also same engine version, the result will the same. Am I right?

Thank you.

Best regards

Aulia Khalqillah. S.Si., M.Si
Tsunami and Disaster Mitigation Research Center
Universitas Syiah Kuala, Banda Aceh, Indonesia
auliakh...@usk.ac.id

Marco Pagani

unread,
Jul 9, 2026, 9:30:23 AM (6 days ago) Jul 9
to openqua...@googlegroups.com

Sorry, I do not have time right now to check your code. The seed you provide is not the final one used; it’s more complex, but from the user perspective same model + same seed + same OQ = same SES

Aulia Khalqillah

unread,
Jul 9, 2026, 10:02:00 AM (6 days ago) Jul 9
to openqua...@googlegroups.com
It is okay. I appreciate your valuable explanation. Thank you very much.

Regards.



--
Aulia Khalqillah, S.Si., M.Si
Research Assistant
Geological Hazards Division
Tsunami and Disaster Mitigation Research Center (TDMRC)
Universitas Syiah Kuala, Aceh, Indonesia
Reply all
Reply to author
Forward
0 new messages