jblindsay / whitebox-tools

An advanced geospatial data analysis platform
https://www.whiteboxgeo.com/
MIT License
960 stars 160 forks source link

feature request: Allow user to provide area raster for computing flow accumulations #116

Open jonschwenk opened 4 years ago

jonschwenk commented 4 years ago

I am working with a DEM in geographic coordinates (EPSG 4326). I would like to export the flow accumulation raster in units of square meters without reprojecting my DEM. I have found that reprojection (even with bilinear or cubic resampling) alters the flowpaths and introduces artifacts for this particular DEM, hence the desire to leave it in its native format.

When working at high latitudes, it's not sufficient to re-compute an average pixel area to convert numbers of cells to areas. E.g. in my DEM, the x-resolution ranges from 10-11 meters across the full domain, so a simple transformation like this would bias all the higher-latitude pixels' areas too high and lower-latitude pixels too low..

I have developed code that will create a raster matching the DEM for which each pixel represents that pixel's area in square meters. It would be really handy to be able to feed this raster into the flow accumulation function so that these areas are accumulated and exported. It seems like it would be a relatively simple implement, but I'm not sure. Since geographic coordinate considerations are already implemented in WBT, perhaps it could also generate the area raster if a 4326 input is detected and the flow accumulation output is requested as area?

Atreyagaurav commented 2 years ago

This is an interesting Idea, though I don't know if it'll be useful in other cases, but it can help find the catchment area in all the grid points without having to reproject and delineate (if you only need area and not a boundary) as long as you have a way to calculate the area for each grid.

And if what I understand is correct it'll be like the flow accumulation tool, but instead of adding 1 in every new addition of grid, it'll add the value from a separate grid, it'll take that grid and the flow direction grid as inputs. We can make a new tool, or add an optional input to flow accumulation that'll hold the area raster value (default being raster of same size with all values = 1).

Can you make a small example rasters? I am interested in testing a modified flow accumulation algorithm and see if it works.