コード例 #1
0
yy_start = 106
yy_end = 116

idx_band = 1

exp = Exposures()

ssp_file = EXP_POP_PTH +'baseYr_total_2000.tif'
exp.set_from_raster(ssp_file, transform=DST_META['transform'], height=DST_META['height'], 
                width=DST_META['width'], resampling=Resampling.average)

exp.value *= 25     # sum of the grids after upscaling
if np.any(exp.value<0) == True:
    raise ValueError
exp.value_unit = 'N people per pixel'
exp.ref_year = 2000
exp[INDICATOR_CENTR+HAZ_TYPE] = np.arange(len(exp), dtype=int)
exp[INDICATOR_IF+HAZ_TYPE] = np.ones(len(exp), dtype=int)
exp.check()

for year in YEAR:    
    
    imp_model = []  # initite a list fro all models in one year
    imp_save = None

    for hydro, gcm in [(hydro, gcm) for hydro in HYDRO_MODEL for gcm in GCM_MODEL]:
        
        haz_file = HAZARD_PTH +'flddph_' +hydro +'_' +gcm +'_' +RCP +'_flopros_gev_picontrol_2006_2300_0.1.nc'
        haz_frac = HAZARD_PTH +'fldfrc_' +hydro +'_' +gcm +'_' +RCP +'_flopros_gev_picontrol_2006_2300_0.1.nc'
    
        if haz_file not in HAZ_FILES:
コード例 #2
0
for ssp, year in [(ssp, year) for ssp in SSP_MODEL for year in YEAR]:
    exp = Exposures()

    ssp_file = EXP_POP_PTH + ssp.upper(
    ) + '_1km/' + ssp + '_total_' + year + '.tif'
    exp.set_from_raster(ssp_file,
                        transform=DST_META['transform'],
                        height=DST_META['height'],
                        width=DST_META['width'],
                        resampling=Resampling.average)

    exp.value *= 25  # sum of the grids after upscaling
    if np.any(exp.value < 0) == True:
        raise ValueError
    exp.value_unit = 'N people per pixel'
    exp.ref_year = int(year)
    exp[INDICATOR_CENTR + HAZ_TYPE] = np.arange(len(exp), dtype=int)
    exp[INDICATOR_IF + HAZ_TYPE] = np.ones(len(exp), dtype=int)
    exp.check()

    imp_model = []  # initite a list fro all models in one year
    imp_save = None

    for hydro, gcm in [(hydro, gcm) for hydro in HYDRO_MODEL
                       for gcm in GCM_MODEL]:

        haz_file = HAZARD_PTH + 'flddph_' + hydro + '_' + gcm + '_' + RCP + '_flopros_gev_picontrol_2006_2300_0.1.nc'
        haz_frac = HAZARD_PTH + 'fldfrc_' + hydro + '_' + gcm + '_' + RCP + '_flopros_gev_picontrol_2006_2300_0.1.nc'

        if haz_file not in HAZ_FILES:
            logging.error('no file: flddph_' + hydro + '_' + gcm + '_' + RCP +