In [2]:
%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
mpl.rcParams['lines.linewidth'] = 2
In [3]:
CALCULATION_ID = 39
path = './calc_%d/hazard_curve/PGA/' % CALCULATION_ID
file_wild = '*.xml'
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-2, 1))
plt.ylim((1e-2, 1))
plt.show()
In [4]:
hcm
Out[4]:
In [ ]: