How to import TauDEM D8 direction into GRASS GIS
TauDEM D8 direction (d8
) uses the following encoding:
This is GRASS GIS drainage (drain
) encoding:
# import D8
r.in.gdal input=d8.tif output=d8
# convert D8 to drain
r.mapcalc ex="drain=if(d8-1,d8-1,8)"
# convert drain back to D8
# use abs() for possibly negative directions from outside the DEM
r.mapcalc ex="d82=1+abs(drain)%8"