Skip to content

Adding utils for simple SES generation - #591

Open
kurannn wants to merge 6 commits into
masterfrom
ses_utils
Open

Adding utils for simple SES generation#591
kurannn wants to merge 6 commits into
masterfrom
ses_utils

Conversation

@kurannn

@kurannn kurannn commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

This PR introduces utils for simple SES generation. Below, you might see brief explanations of scripts.

ses_geo.py

  • Provides a function for parsing geospatial data files (e.g., GeoJSON, Shapefile) and converting their geometries into OQ Engine polygon instances.

ses_source.py

  • Provides a function to construct OQ Engine area source instance by combining MFD, PMF, and geometries.

ses_generator.py

  • Provides a function to generate 1000 Stochastic Event Set (SES) by sampling earthquake ruptures from configured seismic sources using Monte Carlo sampling.

@kurannn
kurannn requested a review from mmpagani July 13, 2026 06:44

@kirstybayliss kirstybayliss left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Fahrettin, this is looking very good!
I have some minor comments on a few things that could be a little bit clearer or be generalised a little more, which I know is annoying but future Fahrettin will really appreciate it.



def prepare_source_for_sampling(src):
"""

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be useful to have the number of samples and the seed as inputs rather than fixed values

Grid spacing used for area source discretization.
"""

# Magnitude scaling-relationship

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

magnitude scaling relationship should always be WC1994? Might be useful as in input also

tom = PoissonTOM(time_span)

# Nodal plane distribution
npd = PMF([(1.0, NodalPlane(0.0, 90.0, 0.0))])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this function could be a lot more flexible to allow the user to include npd. You can use these as the defaults if one isn't provided, but it's easy to imagine a scenario where we might like to vary these.

if hdd is None:
hdd = PMF([(1.0, 7.5)])
else:
usd = np.min([v[1] for v in hdd.data])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be useful to say in the input description that hdd is a pmf for the hypocentre distribution.
Not sure why we set the upper and lower limits above if we are going to use the hdd or make a pmf with all values at 7.5 (if I understand correctly what this is doing).

from openquake.man.ses_utils.ses_geo import get_oq_polygons


def get_area_source(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless I am misunderstanding, this function is intended to create an OQ area source from a polygon and some other source parameters. I think this is helpful and a good idea, so maybe 'make' rather than 'get' would be a clearer name? Maybe it's pedantic but 'get' sounds like we are retrieving an existing source, which there is already code for in the engine.
Also it would be good to make this clear in the function description.

:param mfd:
An instance of OQ Engine magnitude-frequency distribution class
:param polygon_fname:
An instance of a OQ Engine polygon class. See :class:`openquake.hazardlib.geo.Polygon`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think polygon_fname should be the name of a file containing geojson/shapefile polygon information, because it's the get_oq_polygons function that converts this to an OQ engine polygon, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants