[GRASS-SVN] r45475 - in grass-addons/raster: . r.hazard.flood

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Feb 27 11:33:40 EST 2011


Author: madi
Date: 2011-02-27 08:33:40 -0800 (Sun, 27 Feb 2011)
New Revision: 45475

Added:
   grass-addons/raster/r.hazard.flood/
   grass-addons/raster/r.hazard.flood/Makefile
   grass-addons/raster/r.hazard.flood/description.html
   grass-addons/raster/r.hazard.flood/r.hazard.flood.py
Log:
Added r.hazard.flood module

Added: grass-addons/raster/r.hazard.flood/Makefile
===================================================================
--- grass-addons/raster/r.hazard.flood/Makefile	                        (rev 0)
+++ grass-addons/raster/r.hazard.flood/Makefile	2011-02-27 16:33:40 UTC (rev 45475)
@@ -0,0 +1,7 @@
+MODULE_TOPDIR = ../..
+
+PGM = r.hazard.flood.py
+
+include $(MODULE_TOPDIR)/include/Make/Script.make
+
+default: script

Added: grass-addons/raster/r.hazard.flood/description.html
===================================================================
--- grass-addons/raster/r.hazard.flood/description.html	                        (rev 0)
+++ grass-addons/raster/r.hazard.flood/description.html	2011-02-27 16:33:40 UTC (rev 45475)
@@ -0,0 +1,25 @@
+<h2>DESCRIPTION</h2>
+<em>r.hazard.flood</em> Implementation of a fast procedure to detect flood prone areas
+
+<h2>NOTES</h2>
+<p>The availability of new technologies for the measurement of surface elevation has addressed the lack of high resolution elevation data, and this has led to an increase in the attraction of DEM-based automated procedures for hydrological applications including the delineation of floodplains. In particular, the exposure to flooding may be delineated quite well by adopting a modified topographic index (TIm) computed from a DEM. The comparison between TIm and flood inundation maps (obtained from hydraulic simulations) shows that the portion of a basin exposed to flood inundation is generally characterized by a TIm higher than a given threshold, tau. This allows the development of a simple procedure for the identification of flood prone areas that requires only two parameters for the calibration: the threshold tau and the exponent of TIm. Because the topographic index is sensitive to the spatial resolution of the digital elevation model, the threshold is automatically determin
 ated from the cellsize.
+<p>The proposed procedure may help in the delineation of flood prone areas especially in basins with marked topography. The method is sensitive to the DEM resolution, but a cell size of ~100m is sufficient to reach good performances for the catchments investigated here. The procedure is also tested adopting DEMs from different sources, such as the shuttle radar topography mission (SRTM) DEM, ASTER GDEM, and national elevation data. This experiment highlights the reliability with the SRTM DEM for the delineation of flood prone areas. A useful relationship between model parameters and the reference scale of the DEM was also obtained providing a strategy for the application of this method in different contexts. 
+<p>The use of the modified topographic index should not be considered as an alternative to standard hydrological-hydraulic simulations for flood mapping, but it may represent a useful and rapid tool for a preliminary delineation of flooding areas in ungauged basins and in areas where expensive and time consuming hydrological-hydraulic simulations are not affordable or economically convenient. 
+
+<h2>EXAMPLE</h2>
+
+<p>r.hazard.flood.py map=elevation flood=flood mti=MTI [--overwrite][--verbose] [--quiet]
+
+<h3>Dependencies</h3>
+<em>
+<a href="r.area.html">r.area</a>,
+</em>
+
+<h2>REFERENCES</h2>
+<p><em>Manfreda S., Di Leo M., Sole A., &mdash; Detection of Flood Prone Areas using Digital Elevation Models, Journal of Hydrologic Engineering, (10.1061/(ASCE)HE.1943-5584.0000367), 2011.</em>
+
+<h2>AUTHORS</h2>
+<p>Margherita Di Leo (dileomargherita AT gmail DOT com)
+<p><i>Last changed: (Sun Feb 27 17:07:57 2011)</i>
+
+

Added: grass-addons/raster/r.hazard.flood/r.hazard.flood.py
===================================================================
--- grass-addons/raster/r.hazard.flood/r.hazard.flood.py	                        (rev 0)
+++ grass-addons/raster/r.hazard.flood/r.hazard.flood.py	2011-02-27 16:33:40 UTC (rev 45475)
@@ -0,0 +1,124 @@
+#!/usr/bin/env python
+
+############################################################################
+#
+# MODULE:      r.hazard.flood.py
+# AUTHOR(S):   Margherita Di Leo
+# PURPOSE:     Fast procedure to detect flood prone areas on the basis of a 
+#              topographic index
+# COPYRIGHT:   (C) 2010 by Margherita Di Leo and the GRASS Development Team
+#              dileomargherita at gmail.com
+#
+#              This program is free software under the GNU General Public
+#              License (>=v2). Read the file COPYING that comes with GRASS
+#              for details.
+#
+#############################################################################
+
+#%module
+#%  description: Fast procedure to detect flood prone areas
+#%  keywords: raster
+#%end
+#%option
+#%  key: map
+#%  type: string
+#%  gisprompt: old, raster, cell
+#%  key_desc: elevation
+#%  description: Name of elevation raster map 
+#%  required: yes
+#%end
+#%option
+#%  key: flood
+#%  type: string
+#%  gisprompt: new, raster, cell
+#%  key_desc: flood
+#%  description: Name of output flood raster map 
+#%  required: yes
+#%end
+#%option
+#%  key: mti
+#%  type: string
+#%  gisprompt: new, raster, cell
+#%  key_desc: MTI
+#%  description: Name of output MTI raster map 
+#%  required: yes
+#%END
+
+import grass.script as grass
+import os, sys
+
+if not os.environ.has_key("GISBASE"):
+    print "You must be in GRASS GIS to run this program."
+    sys.exit(1)
+
+def main():
+    r_elevation = options['map'].split('@')[0] 
+    mapname = options['map'].replace("@"," ")
+    mapname = mapname.split()
+    mapname[0] = mapname[0].replace(".","_")
+    r_flood_map = options['flood']
+    r_mti = options['mti']
+
+    # Detect cellsize of the DEM
+    info_region = grass.read_command('g.region', flags = 'p', rast = '%s' % (r_elevation))
+    dict_region = grass.parse_key_val(info_region, ':')
+    resolution = float(dict_region['nsres'])
+    print 'cellsize : ', resolution
+
+    # Flow accumulation map MFD
+    grass.run_command('r.watershed', elevation = r_elevation , accumulation = 'r_accumulation' , convergence = 5, flags = 'fa')
+    print 'flow accumulation done.'
+
+    # Slope map
+    grass.run_command('r.slope.aspect', elevation = r_elevation , slope = 'r_slope' )
+    print 'slope map done.'
+
+    # n exponent 
+    n = 0.016 * (resolution ** 0.46)
+    print 'exponent : ', n
+
+    # MTI threshold
+    mti_th = 10.89 * n + 2.282
+    print 'MTI threshold : ', mti_th
+    
+    # MTI map
+    print 'Calculating mti raster map.. '
+    grass.mapcalc("$r_mti = log((exp((($rast1+1)*$resolution) , $n)) / (tan($rast2+0.001)))", r_mti = r_mti, rast1 = 'r_accumulation', resolution = resolution, rast2 = 'r_slope', n = n)
+
+    # Cleaning up
+    print 'Cleaning up.. '
+    grass.run_command('g.remove', rast = 'r_accumulation')
+    grass.run_command('g.remove', rast = 'r_slope')
+
+    # flood map
+    print 'Calculating flood raster map.. '
+    grass.mapcalc("r_flood = if($rast1 >  $mti_th, 1, null())", rast1 = r_mti, mti_th = mti_th)
+
+    ## # Attempt to eliminate isolated pixels (doesn't seem to work properly)
+    # Recategorizes data in a raster map by grouping cells that form physically discrete areas into unique categories (preliminar to r.area)
+    print 'Running r.clump..'
+    grass.run_command('r.clump', input = 'r_flood', output = 'r_clump')
+    
+    # Delete areas of less than a threshold of cells (corresponding to 1 square kilometer)
+    # Calculating threshold
+    th = 1000000 / resolution**2
+    print 'Deleting areas of less than ', th, ' cells.. '
+    grass.run_command('r.area', input = 'r_clump', output = 'r_flood_th', treshold = 'th')
+
+    # New flood map
+    grass.mapcalc("$r_flood_map = $rast1 / $rast1", r_flood_map = r_flood_map, rast1 = 'r_flood_th')
+
+    # Cleaning up
+    print 'Cleaning up.. '
+    grass.run_command('g.remove', rast = 'r_clump')
+    grass.run_command('g.remove', rast = 'r_flood_th')
+    grass.run_command('g.remove', rast = 'r_flood')
+
+    grass.run_command('g.message' , message = 'Done!')	
+
+if __name__ == "__main__":
+    options, flags = grass.parser()
+    sys.exit(main())
+
+
+


Property changes on: grass-addons/raster/r.hazard.flood/r.hazard.flood.py
___________________________________________________________________
Added: svn:executable
   + *



More information about the grass-commit mailing list