Skip to content

Commit

Permalink
Merge pull request #335 from GEMScienceTools/quick_fix
Browse files Browse the repository at this point in the history
quick fix for if distances returned by att_curves function are less t…
  • Loading branch information
CB-quakemodel authored Jul 6, 2023
2 parents aa804eb + db7bdb6 commit 706a47e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
4 changes: 2 additions & 2 deletions docsrc/contents/smt.rst
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,8 @@ Comparing GMPEs
strike = -999
dip = 60 # (Albania has predominantly reverse faulting)
rake = 90 # (+ 90 for compression, -90 for extension)
trellis_mag_list = [5, 6, 7] # mags used only for trellis
trellis_depths = [20, 20, 20] # depth per magnitude
trellis_mag_list = [5, 6, 7] # mags used only for trellis and response spectra
trellis_depths = [20, 20, 20] # depth per magnitude for trellis and response spectra
# Specify magnitude array for Sammons, Euclidean dist and clustering
[mag_values_non_trellis_functions]
Expand Down
9 changes: 5 additions & 4 deletions openquake/smt/comparison/utils_compare_gmpes.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def plot_trellis_util(rake, strike, dip, depth, Z1, Z25, Vs30, region,

pyplot.loglog()
pyplot.ylim(0.001, 10)
pyplot.xlim(distances[0], distances[len(distances)-1])
pyplot.xlim(distances[0], distances[len(distances)-2])

pyplot.grid(axis = 'both', which = 'both', alpha = 0.5)

Expand Down Expand Up @@ -479,9 +479,10 @@ def plot_spectra_util(rake, strike, dip, depth, Z1, Z25, Vs30, region,
for k, imt in enumerate(imt_list):
mu, std, distances = att_curves(gmm, gmm_orig, depth[l], m,
aratio_g, strike_g, dip_g,
rake,Vs30, Z1, Z25, 300,
0.1, imt, 1, eshm20_region)

rake,Vs30, Z1, Z25, np.max(
dist_list), 0.1, imt, 1,
eshm20_region)

mu = mu[0][0]
f = interpolate.interp1d(distances, mu)
rs_50p_dist = np.exp(f(i))
Expand Down
5 changes: 4 additions & 1 deletion openquake/smt/comparison/utils_gmpes.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def att_curves(gmpe, orig_gmpe, depth, mag, aratio, strike, dip, rake, Vs30,
else:
props = {'vs30': Vs30, 'z1pt0': Z1, 'z2pt5': Z25, 'backarc': False,
'vs30measured': True}

sites = get_sites_from_rupture(rup, from_point='TC', toward_azimuth=90,
direction='positive', hdist=maxR, step=step,
site_props=props)
Expand All @@ -161,6 +161,9 @@ def att_curves(gmpe, orig_gmpe, depth, mag, aratio, strike, dip, rake, Vs30,
mean, std, tau, phi = ctxm.get_mean_stds([ctxs])
distances = ctxs.rrup

# Ensures can interpolate to max value in dist_list (within RS plotting)
distances[len(distances)-1] = maxR

return mean, std, distances


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ Z25 = -999
strike = -999
dip = 60 # (Albania has predominantly reverse faulting)
rake = 90 # (+ 90 for compression, -90 for extension)
trellis_mag_list = [5, 6, 7] # mags used only for trellis
trellis_depths = [20, 20, 20] # depth per magnitude
trellis_mag_list = [5, 6, 7] # mags used only for trellis and response spectra
trellis_depths = [20, 20, 20] # depth per magnitude and response spectra

# Specify magnitude array for Sammons, Euclidean dist and clustering
[mag_values_non_trellis_functions]
Expand Down

0 comments on commit 706a47e

Please sign in to comment.