Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modifications to Indirect AvgSA and implementation of European Direct AvgSA GMM #9274

Merged
merged 11 commits into from
Feb 28, 2024
Merged
8 changes: 8 additions & 0 deletions doc/api-reference/openquake.hazardlib.gsim.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1210,6 +1210,14 @@ vanhoutte_2018
:undoc-members:
:show-inheritance:

weatherill_2024
-------------------------------------------

.. automodule:: openquake.hazardlib.gsim.weatherill_2024
:members:
:undoc-members:
:show-inheritance:

wong2022
-------------------------------------------

Expand Down
17 changes: 16 additions & 1 deletion openquake/calculators/tests/classical_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
case_50, case_51, case_53, case_54, case_55, case_57,
case_60, case_61, case_62, case_63, case_64, case_65,
case_66, case_69, case_70, case_72, case_74, case_75, case_76, case_77,
case_78, case_80, case_81, case_82, case_83, case_84)
case_78, case_80, case_81, case_82, case_83, case_84, case_86)

ae = numpy.testing.assert_equal
aac = numpy.testing.assert_allclose
Expand Down Expand Up @@ -718,3 +718,18 @@ def test_case_84(self):
self.run_calc(case_84.__file__, 'job.ini')
[f] = export(('mean_rates_by_src', 'csv'), self.calc.datastore)
self.assertEqualFiles('expected/rbs.csv', f)

def test_case_86(self):
# Comparing the revised indirect GMPE and the direct AvgSA GMPE
# for AvgSA at multiple spectral periods
self.assert_curves_ok([
'hazard_curve-mean-AvgSA(0.1).csv',
'hazard_curve-mean-AvgSA(0.75).csv',
'hazard_curve-mean-AvgSA(2.0).csv',
'hazard_curve-rlz-000-AvgSA(0.1).csv',
'hazard_curve-rlz-000-AvgSA(0.75).csv',
'hazard_curve-rlz-000-AvgSA(2.0).csv',
'hazard_curve-rlz-001-AvgSA(0.1).csv',
'hazard_curve-rlz-001-AvgSA(0.75).csv',
'hazard_curve-rlz-001-AvgSA(2.0).csv'],
case_86.__file__)
2 changes: 2 additions & 0 deletions openquake/commonlib/oqvalidation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1419,6 +1419,8 @@ def check_gsims(self, gsims):
imts.add("FAS")
elif imt.startswith("DRVT"):
imts.add("DRVT")
elif imt.startswith("AvgSA"):
imts.add("AvgSA")
else:
imts.add(im.string)
for gsim in gsims:
Expand Down
7 changes: 4 additions & 3 deletions openquake/hazardlib/gsim/coeffs_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from openquake.baselib.general import RecordBuilder
from openquake.hazardlib.imt import from_string

SA_LIKE_PREFIXES = ['SA', 'EA', 'FA', 'DR']
SA_LIKE_PREFIXES = ['SA', 'EA', 'FA', 'DR', 'Av']


class CoeffsTable(object):
Expand Down Expand Up @@ -175,7 +175,8 @@ def _setup_table_from_str(self, table, sa_damping):
dt = RecordBuilder(**{name: 0. for name in header[1:]})
for line in lines:
row = line.split()
imt_name_or_period = row[0].upper()
imt_name_or_period = row[0] if row[0].startswith("AvgSA") else\
row[0].upper()
if imt_name_or_period == 'SA': # protect against stupid mistakes
raise ValueError('specify period as float value '
'to declare SA IMT')
Expand Down Expand Up @@ -204,7 +205,7 @@ def get_coeffs(self, coeff_list):
if re.search('^(SA|EAS|FAS|DRVT)', imt.string):
tmp = np.array(self._coeffs[imt])
coeffs.append([tmp[i] for i in coeff_list])
if re.search('^(SA)', imt.string):
if re.search('^(SA|AvgSA)', imt.string):
pof.append(imt.period)
elif re.search('^(EAS|FAS|DRVT)', imt.string):
pof.append(imt.frequency)
Expand Down
149 changes: 130 additions & 19 deletions openquake/hazardlib/gsim/kotha_2020.py

Large diffs are not rendered by default.

Loading
Loading