In [1]:
%matplotlib inline
import os
import glob
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import oq_output.hazard_curve_converter as hazard_converter
In [33]:
CALCULATION_ID = 39
path = './calc_%d/hazard_curve/PGA/' % CALCULATION_ID
file_wild = '*.xml'
In [34]:
for file_name in glob.glob(path + file_wild):
hcm = hazard_converter.read_hazard_curves(file_name)
for row in hcm["curves"]:
if hcm["gsim_tree_path"] is not None:
label="GSIM %s Source %s" % (hcm["gsim_tree_path"],
hcm["source_model_tree_path"])
else:
label="%s" % (hcm["statistics"])
plt.loglog(hcm["imls"], row[2:], label=label)
plt.xlabel(hcm['imt'])
plt.ylabel('Probability of exceedence in %s years' %
hcm['investigation_time'])
plt.legend(loc='center left', bbox_to_anchor=(1, 0.5), frameon=False)
#plt.autoscale('x', tight=True)
plt.xlim((1e-1, 1))
plt.ylim((1e-1, 1))
plt.show()
mpl.rcParams['lines.linewidth'] = 2
In [35]:
CALCULATION_ID = 39
path = './calc_%d/hazard_curve/' % CALCULATION_ID
file_wild = '*.xml'
In [36]:
for file_name in glob.glob(path + file_wild):
hcm = hazard_converter.read_hazard_curves(file_name)
for row in hcm["curves"]:
if hcm["gsim_tree_path"] is not None:
label="GSIM %s Source %s" % (hcm["gsim_tree_path"],
hcm["source_model_tree_path"])
else:
label="%s" % (hcm["statistics"])
plt.loglog(hcm["imls"], row[2:], label=label)
plt.xlabel(hcm['imt'])
plt.ylabel('Probability of exceedence in %s years' %
hcm['investigation_time'])
plt.legend(loc='center left', bbox_to_anchor=(1, 0.5), frameon=False)
#plt.autoscale('x', tight=True)
plt.xlim((1e-1, 1))
plt.ylim((1e-1, 1))
plt.show()
mpl.rcParams['lines.linewidth'] = 2
In [48]:
CALCULATION_ID = 39
path = './calc_%d/hazard_curve_multi/PGA_multi/' % CALCULATION_ID
file_wild = '*.xml'
In [49]:
for file_name in glob.glob(path + file_wild):
hcm = hazard_converter.read_hazard_curves(file_name)
for row in hcm["curves"]:
if hcm["gsim_tree_path"] is not None:
label="GSIM %s Source %s" % (hcm["gsim_tree_path"],
hcm["source_model_tree_path"])
else:
label="%s" % (hcm["statistics"])
plt.loglog(hcm["imls"], row[2:], label=label)
plt.xlabel(hcm['imt'])
plt.ylabel('Probability of exceedence in %s years' %
hcm['investigation_time'])
plt.legend(loc='center left', bbox_to_anchor=(1, 0.5), frameon=False)
#plt.autoscale('x', tight=True)
plt.xlim((1e-1, 1))
plt.ylim((1e-1, 1))
plt.show()
mpl.rcParams['lines.linewidth'] = 2
In [56]:
CALCULATION_ID = 49
path = './calc_%d/uh_spectra/' % CALCULATION_ID
file_wild = '*.xml'
In [ ]: