GFDRR/CCDR-tools

Impact function used in classification?

matamadio opened this issue · 0 comments

So I tried to create new notebook for heat stress.
It requires classification only, with multiple RPs. So I stripped down the code of ifs related to function, including the lines that specify impact_array.

        if exp_cat_dd.value == 'pop':
            impact_array = mortality_factor(fld_array)
        elif exp_cat_dd.value == 'builtup':
            impact_array = damage_factor_builtup(fld_array)
        elif exp_cat_dd.value == 'agri':
            impact_array = damage_factor_agri(fld_array)

But these are required to build the impac_rst, which seems to be used in both procedures??

        # Create raster from array
        impact_rst = xr.DataArray(np.array([impact_array]).astype(np.float32), 
                                  coords=hazard_data.coords, 
                                  dims=hazard_data.dims)
        
        if save_inter_rst_chk.value:
            impact_rst.rio.to_raster(os.path.join(OUTPUT_DIR, f"{country}_LS_{rp}_{exp_cat}_hazard_imp_factor.tif"))

Please clarify, am I messing things? impact_array should not be part of the classification approach!
I checked the results for classification and I'm pretty sure they are correct - no function used. But then why the script doesn't work if function is not specified? :(

The expected notebook for this has:

  • NO choice of analytical procedures - just classes intervals
  • Does only combine selected EXP category with specified hazard classes (bins) - no impact function!
  • Individual, global hazard layers (3 RPs) instead of country clips