示例#1
0
    haz_real.plot_intensity(event=0)
    haz_real.plot_fraction(event=0)

#%% Impact_function
# Set impact function (see tutorial climada_entity_ImpactFuncSet)
ifset_hail = ImpactFuncSet()
for imp_fun_dict in imp_fun_parameter:
    imp_fun = fct.create_impact_func(haz_type, imp_fun_dict["imp_id"],
                                     imp_fun_dict["L"], imp_fun_dict["x_0"],
                                     imp_fun_dict["k"])
    ifset_hail.append(imp_fun)
ifset_hail.plot()

#%% Exposure

exp_infr = fct.load_exp_infr(force_new_hdf5_generation, name_hdf5_file,
                             input_folder, haz_real)
exp_meshs = fct.load_exp_agr(force_new_hdf5_generation, name_hdf5_file,
                             input_folder, haz_real)
exp_dur = exp_meshs.copy()
exp_dur["if_HL"] = exp_dur[
    "if_HL"] + 3  #change if_HL to match the corresponding imp_id
if plot_img:
    exp_infr.plot_basemap()
    #This takes to long. Do over night!!!
    #exp_agr.plot_basemap()

#%% Impact
imp_infr = Impact()
imp_infr.calc(exp_infr, ifset_hail, haz_real, save_mat=True)
# imp_infr.plot_raster_eai_exposure()
freq_curve_infr = imp_infr.calc_freq_curve()
#%% Impact_function
# Set impact function (see tutorial climada_entity_ImpactFuncSet)
ifset_hail = ImpactFuncSet()
for imp_fun_dict in imp_fun_parameter:
    imp_fun = fct.create_impact_func(haz_type, 
                                 imp_fun_dict["imp_id"], 
                                 imp_fun_dict["L"], 
                                 imp_fun_dict["x_0"], 
                                 imp_fun_dict["k"])
    ifset_hail.append(imp_fun)
if plot_img:
    ifset_hail.plot()

#%% Exposure

exp_synth_infr_meshs = fct.load_exp_infr(force_new_hdf5_generation, name_hdf5_file, input_folder, haz_synth)
exp_synth_agr_meshs = fct.load_exp_agr(force_new_hdf5_generation, name_hdf5_file, input_folder, haz_synth)
if plot_img:    
    exp_synth_infr_meshs.plot_basemap()
    exp_synth_infr_meshs.plot_hexbin()
    exp_synth_infr_meshs.plot_scatter()
    exp_synth_infr_meshs.plot_raster()
    
    exp_synth_agr_meshs.tag = Tag(file_name = "exp_agr", description="Exposure_description")
    exp_synth_agr_meshs.plot_basemap()
    exp_synth_agr_meshs.plot_hexbin()
    exp_synth_agr_meshs.plot_scatter()
    exp_synth_agr_meshs.plot_raster(raster_res = 0.001)

#%% Impact
imp_synth_infr_meshs = Impact()