Conversation
kirstybayliss
left a comment
There was a problem hiding this comment.
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): | ||
| """ |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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))]) |
There was a problem hiding this comment.
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]) |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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` |
There was a problem hiding this comment.
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?
This PR introduces utils for simple SES generation. Below, you might see brief explanations of scripts.
ses_geo.py
ses_source.py
ses_generator.py