Closed emthompson-usgs closed 1 year ago
Yeah, I remember that. There were a few GMPEs for Canada which were table-based and the engine was interpolating the rupture magnitude versus the magnitudes in the HDF5 table for each rupture. Therefore with 1 million ruptures it was doing 1 million interpolations and it was slow. The change was to pass to the ContextMaker the list of unique magnitudes in the set of ruptures (say 20) so that the interpolation could be done in advance, in the master core, even before starting the calculation, and only 20 times instead of 1 million times.
You are using the obsolete interface get_mean_and_stddevs
that does not have the ability to pass the list of magnitudes
to the underlying ContextMaker. So I would suggest to use the ContextMaker directly instead, something like:
from openquake.hazardlib import valid
from openquake.hazardlib.contexts import ContextMaker
gsim = valid.gsim('NGAEastUSGSSeedSP15')
param = dict(maximum_distance=200, imtls={'PGA': [.1, .2, .3]},
truncation_level=3., investigation_time=1.,
mags=["6.00", "6.10", "6.20"])
cmaker = ContextMaker('TRT', [gsim], param)
ctx = cmaker.new_ctx(size=1) # recarray of size 1
ctx.mag = 6.
ctx.vs30 = 700.
ctx.rrup = 100.
print(ctx.dtype.names)
print(ctx)
mean, sig, tau, phi = cmaker.get_mean_stds([ctx])
print(mean, sig)
NB: the method new_ctx
is in the engine-3.15 branch but not in the released code, it will be once we make the first patch to v3.15. If you are using git, just do a git pull.
I am not hearing back, so I am assuming all is good and closing the issue.
Yes, sorry I hadn't responded back yet. Thank you for the help on this.
Hi, the way we (including @cbworden) have been calling NGA East GMMs no longer seems to work in 3.15 (the last version that we were using this code and it was successful is 3.13). Here is a minimal example that reflects how we have been calling the module:
Here is the output with OQ 3.13:
Here is the error we get with 3.15:
Is there a different/new way to call the NGAEastUSGSGMPE function without having to deal with the
set_tables
issue?Any guidance on how we need to adjust our code to make this work will be greatly appreciated.