Skip to content

Commit

Permalink
Merge pull request #3316 from g-weatherill/ask14_fix
Browse files Browse the repository at this point in the history
Fixes ASK14 GMPE behaviour to remove ValueError
  • Loading branch information
micheles committed Dec 15, 2017
2 parents 1957bcb + 8bcd7d5 commit 350fdfc
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions openquake/hazardlib/gsim/abrahamson_2014.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,10 +361,15 @@ def _get_intra_event_std(self, C, mag, sa1180, vs30, vs30measured,
phi_al = self._get_phi_al_regional(C, mag, vs30measured, rrup)
derAmp = self._get_derivative(C, sa1180, vs30)
phi_amp = 0.4
if any(phi_al**2 < phi_amp**2):
print('phi_al:' % (phi_al))
print('magnitude: %.2f' % (mag))
raise ValueError('sqrt argument < 0')
idx = phi_al < phi_amp
if np.any(idx):
# In the case of small magnitudes and long periods it is possible
# for phi_al to take a value less than phi_amp, which would return
# a complex value. According to the GMPE authors in this case
# phi_amp should be reduced such that it is fractionally smaller
# than phi_al
phi_amp = 0.4 * np.ones_like(phi_al)
phi_amp[idx] = 0.99 * phi_al[idx]
phi_b = np.sqrt(phi_al**2 - phi_amp**2)
phi = np.sqrt(phi_b**2 * (1 + derAmp)**2 + phi_amp**2)
return phi
Expand Down

0 comments on commit 350fdfc

Please sign in to comment.