Index: wflow-py/Scripts/wflow_flood_lib.py =================================================================== diff -u -r34850193a8dc11a1d40383cc39212dfad7b371b2 -rd0835ddf132994a8a772d23ec5f5936f22aafea8 --- wflow-py/Scripts/wflow_flood_lib.py (.../wflow_flood_lib.py) (revision 34850193a8dc11a1d40383cc39212dfad7b371b2) +++ wflow-py/Scripts/wflow_flood_lib.py (.../wflow_flood_lib.py) (revision d0835ddf132994a8a772d23ec5f5936f22aafea8) @@ -411,7 +411,7 @@ return stream_ge, pcr.ordinal(subcatch) -def volume_spread(ldd, hand, subcatch, volume, volume_thres=0., area_multiplier=1., iterations=15, logging=logging): +def volume_spread(ldd, hand, subcatch, volume, volume_thres=0., cell_surface=1., iterations=15, logging=logging): """ Estimate 2D flooding from a 1D simulation per subcatchment reach Input: @@ -426,12 +426,11 @@ inundation -- pcraster object float32, scalar inundation estimate """ #initial values - pcr.setglobaloption("unittrue") + pcr.setglobaloption("unitcell") dem_min = pcr.areaminimum(hand, subcatch) # minimum elevation in subcatchments dem_norm = hand - dem_min # surface of each subcatchment - surface = pcr.areaarea(subcatch)*area_multiplier - + surface = pcr.areaarea(subcatch)*pcr.areaaverage(cell_surface, subcatch) # area_multiplier error_abs = pcr.scalar(1e10) # initial error (very high) volume_catch = pcr.areatotal(volume, subcatch) @@ -449,7 +448,6 @@ error = pcr.cover((depth_catch-average_depth_catch)/depth_catch, depth_catch*0) dem_min = pcr.ifthenelse(error > 0, dem_av, dem_min) dem_max = pcr.ifthenelse(error <= 0, dem_av, dem_max) - # error_abs = np.abs(error) # TODO: not needed probably, remove inundation = pcr.max(dem_av - dem_norm, 0) return inundation