NRCan / CanFlood

Flood Risk modelling toolbox for Canada
MIT License
29 stars 7 forks source link

Sampling rasters with building voids #92

Open akhilk15 opened 9 months ago

akhilk15 commented 9 months ago

Hi Seth @cefect , I have another question. We are using flood rasters obtained from the hydraulic model which incorporated building footprints as voids, and therefore, there are holes/voids in the flood rasters. I guess the solution is to conduct hazard sampling separately in GIS and create the expos data file, which bypasses the hazard sampling step from CanFlood. I was wondering if you have any other alternative. We'll have to do some GIS spatial analysis to fill those voids or do some spatial joins of building footprints centroid and the polygon with max hazard calculated.

lateLarch commented 9 months ago

Hi. I've encountered that issue a few times as well. I'm not sure how messy your voids are, but if your flood rasters are elevation (not depth), you should be able to get a good sample from the footprint polygons , maybe with a small buffer added. You can use the footprint polygons directly as your inventory in CanFlood. It will recognize that in the Hazard Sampler and allow you to select the mean, min, max. I usually do mean because I'm wary of any anomaly with min or max but I'm not sure how the stat sampler handles no values in voids, maybe Seth does.
I also use the building polygons, not centroids, to sample stats from the bare-earth DEM because the building removal algorithms are a mystery and I've seen some strange profiles and holes in their place, particularly in varied terrain or heavily treed areas, like North Van. David.

cefect commented 9 months ago

Thank you for the question @akhilk15. David put it nicely and this is what I would recommend also. We've talked about incorporating something like this into CanFlood a bit... but I'm not sure where that plan sits.

As to the behavior of the polygon sampler, it uses the Zonal statistics processing alg in the backend, which I'm assuming ignores null values.

Alternatively, you could consider pre-processing your raster using some hole filling tool like this, but this is effectively the same thing but less transparent (and also only works well with water elevations rather than depths).