[GRASS-SVN] r58758 - in grass-addons/grass7/raster: r.mcda.ahp r.mcda.input r.mcda.output r.mcda.roughset r.width.funct
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Jan 21 14:14:02 PST 2014
Author: neteler
Date: 2014-01-21 14:14:02 -0800 (Tue, 21 Jan 2014)
New Revision: 58758
Added:
grass-addons/grass7/raster/r.mcda.ahp/r.mcda.ahp.html
grass-addons/grass7/raster/r.mcda.input/r.mcda.input.html
grass-addons/grass7/raster/r.mcda.output/r.mcda.output.html
grass-addons/grass7/raster/r.mcda.roughset/r.mcda.roughset.html
grass-addons/grass7/raster/r.width.funct/r.width.funct.py
Removed:
grass-addons/grass7/raster/r.mcda.ahp/r.mcda.ahp.py.html
grass-addons/grass7/raster/r.mcda.input/r.mcda.input.py.html
grass-addons/grass7/raster/r.mcda.output/r.mcda.output.py.html
grass-addons/grass7/raster/r.mcda.roughset/r.mcda.roughset.py.html
grass-addons/grass7/raster/r.width.funct/r.width.funct
Modified:
grass-addons/grass7/raster/r.mcda.ahp/Makefile
grass-addons/grass7/raster/r.mcda.input/Makefile
grass-addons/grass7/raster/r.mcda.output/Makefile
grass-addons/grass7/raster/r.mcda.roughset/Makefile
Log:
GRASS 7 Addons: fix for extension mess
Modified: grass-addons/grass7/raster/r.mcda.ahp/Makefile
===================================================================
--- grass-addons/grass7/raster/r.mcda.ahp/Makefile 2014-01-21 22:00:03 UTC (rev 58757)
+++ grass-addons/grass7/raster/r.mcda.ahp/Makefile 2014-01-21 22:14:02 UTC (rev 58758)
@@ -1,6 +1,6 @@
MODULE_TOPDIR = ../..
-PGM = r.mcda.ahp.py
+PGM = r.mcda.ahp
include $(MODULE_TOPDIR)/include/Make/Script.make
Copied: grass-addons/grass7/raster/r.mcda.ahp/r.mcda.ahp.html (from rev 58746, grass-addons/grass7/raster/r.mcda.ahp/r.mcda.ahp.py.html)
===================================================================
--- grass-addons/grass7/raster/r.mcda.ahp/r.mcda.ahp.html (rev 0)
+++ grass-addons/grass7/raster/r.mcda.ahp/r.mcda.ahp.html 2014-01-21 22:14:02 UTC (rev 58758)
@@ -0,0 +1,33 @@
+<h2>DESCRIPTION</h2>
+<p>The <em>r.mcda.ahp</em> Generate a raster map classified with analytic hierarchy process (AHP) [Saaty, 1977 and Saaty & Vargas, 1991]</p>
+<em>(GRASS python Script)</em>
+<p></p>
+<h2>NOTES</h2>
+<p>It is mandatory to build a pairwise comparation table with the same order of input of criteria maps in the criteria field.</p>
+<p>Example: r.mcda.ahp criteria=reclass_slope,reclass_sand,reclass_elev pairwise=pairwise output=outputMap</p>
+<p>The file "pairwise" has to have a structure like this:</p>
+<p>#start file</p>
+<p>1.0, 0.2, 3.0</p>
+<p>5.0, 1.0, 5.0</p>
+<p>0.3, 0.2, 1.0</p>
+<p>#comment: order: reclass_slope,reclass_sand,reclass_</p>
+<p>#end file</p>
+The first row and first column are related to the first criteria (reclass_slope in our case); the second row and second column are related to the second criteria (reclass_sand in our case) and the third row and third column are related to the third criteria
+ ( reclass_elev in our cas), and so on.
+<p>In the work directory should be generated a log.txt file were you can find additional information like: eigenvectors, eigenvalues, weights</p>
+<h2>TODO</h2>
+<h2>SEE ALSO</h2>
+<em>
+<a href="r.roughset.html">r.roughset</a>,
+<a href="r.mcda.regime.html">r.mcda.regime</a>,
+<a href="r.mcda.fuzzy.html">r.mcda.fuzzy</a>
+<a href="r.mcda.electre.html">r.mcda.electre</a>,
+<a href="r.mcda.roughset.html">r.mcda.roughset</a>
+<a href="r.in.drsa.html">r.in.drsa</a>
+<a href="r.to.drsa.html">r.to.drsa</a>
+</em>
+<h2>AUTHORS</h2>
+Antonio Boggia - Gianluca Massei<br>
+Department of Economics and Appraisal - University of Perugia - Italy
+<p><i>Last changed: $Date$</i>
+
Deleted: grass-addons/grass7/raster/r.mcda.ahp/r.mcda.ahp.py.html
===================================================================
--- grass-addons/grass7/raster/r.mcda.ahp/r.mcda.ahp.py.html 2014-01-21 22:00:03 UTC (rev 58757)
+++ grass-addons/grass7/raster/r.mcda.ahp/r.mcda.ahp.py.html 2014-01-21 22:14:02 UTC (rev 58758)
@@ -1,33 +0,0 @@
-<h2>DESCRIPTION</h2>
-<p>The <em>r.mcda.ahp</em> Generate a raster map classified with analytic hierarchy process (AHP) [Saaty, 1977 and Saaty & Vargas, 1991]</p>
-<em>(GRASS python Script)</em>
-<p></p>
-<h2>NOTES</h2>
-<p>It is mandatory to build a pairwise comparation table with the same order of input of criteria maps in the criteria field.</p>
-<p>Example: r.mcda.ahp criteria=reclass_slope,reclass_sand,reclass_elev pairwise=pairwise output=outputMap</p>
-<p>The file "pairwise" has to have a structure like this:</p>
-<p>#start file</p>
-<p>1.0, 0.2, 3.0</p>
-<p>5.0, 1.0, 5.0</p>
-<p>0.3, 0.2, 1.0</p>
-<p>#comment: order: reclass_slope,reclass_sand,reclass_</p>
-<p>#end file</p>
-The first row and first column are related to the first criteria (reclass_slope in our case); the second row and second column are related to the second criteria (reclass_sand in our case) and the third row and third column are related to the third criteria
- ( reclass_elev in our cas), and so on.
-<p>In the work directory should be generated a log.txt file were you can find additional information like: eigenvectors, eigenvalues, weights</p>
-<h2>TODO</h2>
-<h2>SEE ALSO</h2>
-<em>
-<a href="r.roughset.html">r.roughset</a>,
-<a href="r.mcda.regime.html">r.mcda.regime</a>,
-<a href="r.mcda.fuzzy.html">r.mcda.fuzzy</a>
-<a href="r.mcda.electre.html">r.mcda.electre</a>,
-<a href="r.mcda.roughset.html">r.mcda.roughset</a>
-<a href="r.in.drsa.html">r.in.drsa</a>
-<a href="r.to.drsa.html">r.to.drsa</a>
-</em>
-<h2>AUTHORS</h2>
-Antonio Boggia - Gianluca Massei<br>
-Department of Economics and Appraisal - University of Perugia - Italy
-<p><i>Last changed: $Date$</i>
-
Modified: grass-addons/grass7/raster/r.mcda.input/Makefile
===================================================================
--- grass-addons/grass7/raster/r.mcda.input/Makefile 2014-01-21 22:00:03 UTC (rev 58757)
+++ grass-addons/grass7/raster/r.mcda.input/Makefile 2014-01-21 22:14:02 UTC (rev 58758)
@@ -1,6 +1,6 @@
MODULE_TOPDIR = ../..
-PGM = r.mcda.input.py
+PGM = r.mcda.input
include $(MODULE_TOPDIR)/include/Make/Script.make
Copied: grass-addons/grass7/raster/r.mcda.input/r.mcda.input.html (from rev 58746, grass-addons/grass7/raster/r.mcda.input/r.mcda.input.py.html)
===================================================================
--- grass-addons/grass7/raster/r.mcda.input/r.mcda.input.html (rev 0)
+++ grass-addons/grass7/raster/r.mcda.input/r.mcda.input.html 2014-01-21 22:14:02 UTC (rev 58758)
@@ -0,0 +1,33 @@
+<h2>DESCRIPTION</h2>
+<p>The <em>r.mcda.input</em> module will read a *rls file output from
+jMAF, JAMM or 4eMka2 sofware <a href="http://idss.cs.put.poznan.pl/">
+Laboratory of Intelligent Decision Support Systems - Poznan University.</a>
+and returns maps of the rules </p>
+
+<em>(GRASS python Script)</em>
+
+<h2>NOTES</h2>
+
+
+<h2>TODO</h2>
+
+
+<h2>SEE ALSO</h2>
+
+<em>
+<a href="r.roughset.html">r.roughset</a>,
+<a href="r.mcda.regime.html">r.mcda.regime</a>,
+<a href="r.mcda.fuzzy.html">r.mcda.fuzzy</a>
+<a href="r.mcda.electre.html">r.mcda.electre</a>,
+<a href="r.mcda.ahp.html">r.mcda.ahp</a>
+<a href="r.mcda.roughset.html">r.mcda.roughset</a>
+<a href="r.mcda.input.html">r.mcda.input</a>
+<a href="r.mcda.output.html">r.mcda.output</a>
+</em>
+
+<h2>AUTHORS</h2>
+Antonio Boggia - Gianluca Massei<br>
+Department of Economics and Appraisal - University of Perugia - Italy
+<p>
+
+<i>Last changed: $Date$</i>
Deleted: grass-addons/grass7/raster/r.mcda.input/r.mcda.input.py.html
===================================================================
--- grass-addons/grass7/raster/r.mcda.input/r.mcda.input.py.html 2014-01-21 22:00:03 UTC (rev 58757)
+++ grass-addons/grass7/raster/r.mcda.input/r.mcda.input.py.html 2014-01-21 22:14:02 UTC (rev 58758)
@@ -1,33 +0,0 @@
-<h2>DESCRIPTION</h2>
-<p>The <em>r.mcda.input</em> module will read a *rls file output from
-jMAF, JAMM or 4eMka2 sofware <a href="http://idss.cs.put.poznan.pl/">
-Laboratory of Intelligent Decision Support Systems - Poznan University.</a>
-and returns maps of the rules </p>
-
-<em>(GRASS python Script)</em>
-
-<h2>NOTES</h2>
-
-
-<h2>TODO</h2>
-
-
-<h2>SEE ALSO</h2>
-
-<em>
-<a href="r.roughset.html">r.roughset</a>,
-<a href="r.mcda.regime.html">r.mcda.regime</a>,
-<a href="r.mcda.fuzzy.html">r.mcda.fuzzy</a>
-<a href="r.mcda.electre.html">r.mcda.electre</a>,
-<a href="r.mcda.ahp.html">r.mcda.ahp</a>
-<a href="r.mcda.roughset.html">r.mcda.roughset</a>
-<a href="r.mcda.input.html">r.mcda.input</a>
-<a href="r.mcda.output.html">r.mcda.output</a>
-</em>
-
-<h2>AUTHORS</h2>
-Antonio Boggia - Gianluca Massei<br>
-Department of Economics and Appraisal - University of Perugia - Italy
-<p>
-
-<i>Last changed: $Date$</i>
Modified: grass-addons/grass7/raster/r.mcda.output/Makefile
===================================================================
--- grass-addons/grass7/raster/r.mcda.output/Makefile 2014-01-21 22:00:03 UTC (rev 58757)
+++ grass-addons/grass7/raster/r.mcda.output/Makefile 2014-01-21 22:14:02 UTC (rev 58758)
@@ -1,6 +1,6 @@
MODULE_TOPDIR = ../..
-PGM = r.mcda.output.py
+PGM = r.mcda.output
include $(MODULE_TOPDIR)/include/Make/Script.make
Copied: grass-addons/grass7/raster/r.mcda.output/r.mcda.output.html (from rev 58746, grass-addons/grass7/raster/r.mcda.output/r.mcda.output.py.html)
===================================================================
--- grass-addons/grass7/raster/r.mcda.output/r.mcda.output.html (rev 0)
+++ grass-addons/grass7/raster/r.mcda.output/r.mcda.output.html 2014-01-21 22:14:02 UTC (rev 58758)
@@ -0,0 +1,36 @@
+<h2>DESCRIPTION</h2>
+
+The <em>r.mcda.output</em> module will export raster maps as a *isf file
+readable in jMAF, JAMM or 4eMka2 sofware <a href="http://idss.cs.put.poznan.pl/">Laboratory of Intelligent Decision Support Systems - Poznan University.</a>
+<p>
+<em>(GRASS python Script)</em>
+
+<h2>NOTES</h2>
+
+
+<p>
+This module, as all GRASS raster modules, will export cells based on the
+current region settings. See the <em>g.region</em> module for details.
+
+
+<h2>TODO</h2>
+
+
+
+
+<h2>SEE ALSO</h2>
+
+<em>
+<a href="r.roughset.html">r.roughset</a>,
+<a href="r.mcda.regime.html">r.mcda.regime</a>
+<a href="r.mcda.fuzzy.html">r.mcda.fuzzy</a>
+<a href="r.mcda.electre.html">r.mcda.electre</a>
+<a href="r.mcda.roughset.html">r.mcda.roughset</a>,
+<a href="r.mcda.input.html">r.mcda.input</a>
+</em>
+
+<h2>AUTHORS</h2>
+Antonio Boggia - Gianluca Massei<br>
+Department of Economics and Appraisal - University of Perugia - Italy
+<p>
+<i>Last changed: $Date$</i>
Deleted: grass-addons/grass7/raster/r.mcda.output/r.mcda.output.py.html
===================================================================
--- grass-addons/grass7/raster/r.mcda.output/r.mcda.output.py.html 2014-01-21 22:00:03 UTC (rev 58757)
+++ grass-addons/grass7/raster/r.mcda.output/r.mcda.output.py.html 2014-01-21 22:14:02 UTC (rev 58758)
@@ -1,36 +0,0 @@
-<h2>DESCRIPTION</h2>
-
-The <em>r.mcda.output</em> module will export raster maps as a *isf file
-readable in jMAF, JAMM or 4eMka2 sofware <a href="http://idss.cs.put.poznan.pl/">Laboratory of Intelligent Decision Support Systems - Poznan University.</a>
-<p>
-<em>(GRASS python Script)</em>
-
-<h2>NOTES</h2>
-
-
-<p>
-This module, as all GRASS raster modules, will export cells based on the
-current region settings. See the <em>g.region</em> module for details.
-
-
-<h2>TODO</h2>
-
-
-
-
-<h2>SEE ALSO</h2>
-
-<em>
-<a href="r.roughset.html">r.roughset</a>,
-<a href="r.mcda.regime.html">r.mcda.regime</a>
-<a href="r.mcda.fuzzy.html">r.mcda.fuzzy</a>
-<a href="r.mcda.electre.html">r.mcda.electre</a>
-<a href="r.mcda.roughset.html">r.mcda.roughset</a>,
-<a href="r.mcda.input.html">r.mcda.input</a>
-</em>
-
-<h2>AUTHORS</h2>
-Antonio Boggia - Gianluca Massei<br>
-Department of Economics and Appraisal - University of Perugia - Italy
-<p>
-<i>Last changed: $Date$</i>
Modified: grass-addons/grass7/raster/r.mcda.roughset/Makefile
===================================================================
--- grass-addons/grass7/raster/r.mcda.roughset/Makefile 2014-01-21 22:00:03 UTC (rev 58757)
+++ grass-addons/grass7/raster/r.mcda.roughset/Makefile 2014-01-21 22:14:02 UTC (rev 58758)
@@ -1,6 +1,6 @@
-#MODULE_TOPDIR = ../..
+MODULE_TOPDIR = ../..
-PGM = r.mcda.roughset.py
+PGM = r.mcda.roughset
include $(MODULE_TOPDIR)/include/Make/Script.make
Copied: grass-addons/grass7/raster/r.mcda.roughset/r.mcda.roughset.html (from rev 58746, grass-addons/grass7/raster/r.mcda.roughset/r.mcda.roughset.py.html)
===================================================================
--- grass-addons/grass7/raster/r.mcda.roughset/r.mcda.roughset.html (rev 0)
+++ grass-addons/grass7/raster/r.mcda.roughset/r.mcda.roughset.html 2014-01-21 22:14:02 UTC (rev 58758)
@@ -0,0 +1,31 @@
+<h2>DESCRIPTION</h2>
+
+<em>r.mcda.roughset</em> is the python implementation of the dominance rough set approach (Domlem algorithm) in GRASS GIS environment. It requires the following input:
+<br>1. the geographical criteria constituting the information system for the rough set analysis; they have to describe environmental, economic or social issues(<b>criteria</b>=<em>name[,name,...]</em>);<br> 2. the preference (<b>preferences</b>=<em>character</em>)for each criteria used in analysis (gain or cost with comma separator)<br>3. the theme in which areas with the issues to be studied are classified (with crescent preference values) (<b>decision</b>=<em>string</em>).
+
+<p>An information system is generated and Domlem algorithm is applied for extraction a minimal set of rules.</P> The algorithm builds two text files (<b>outputTxt</b>=<em>name</em>): the first with isf extension for more deep analysis with non geographic software like 4emka and JAMM ; the second file with rls extension hold all the set of rules generate. An output map (<b>outputMap</b>=<em>string</em>)is generated for region classification with the rules finded and the criteria stored in GRASS geodb.
+
+<h2>NOTES</h2>
+<p> The module can work very slowly with high number of criteria and sample. For bug please contact Gianluca Massei (g_mass at libero.it)</P>
+
+
+<h2>REFERENCE</h2>
+<ol>
+ <li><p>Greco S., Matarazzo B., Slowinski R.: <i>Rough sets theory for multicriteria decision analysis</i>. European Journal of Operational Research, 129, 1 (2001) 1-47.</P>
+ <li><p>Greco S., Matarazzo B., Slowinski R.:<i> Multicriteria classification by dominance-based rough set approach</i>. In: W.Kloesgen and J.Zytkow (eds.), Handbook of Data Mining and Knowledge Discovery, Oxford University Press, New York, 2002.</P>
+ <li><p>Greco S., Matarazzo B., Slowinski, R., Stefanowski, J.: <i>An Algorithm for Induction of Decision Rules Consistent with the Dominance Principle</i>. In W. Ziarko, Y. Yao (eds.): Rough Sets and Current Trends in Computing. Lecture Notes in Artificial Intelligence 2005 (2001) 304 - 313. Springer-Verlag</P>
+ <li><p>Greco, S., B. Matarazzo, R. Slowinski and J. Stefanowski:<i> Variable consistency model of dominance-based rough set approach.</i> In W.Ziarko, Y.Yao (eds.): Rough Sets and Current Trends in Computing. Lecture Notes in Artificial Intelligence 2005 (2001) 170 - 181. Springer-Verlag</P>
+ <li><p><a href="http://en.wikipedia.org/wiki/Dominance-based_rough_set_approach">http://en.wikipedia.org/wiki/Dominance-based_rough_set_approach</a> - “Dominance-based rough set approach”</P>
+ <li><p><a href="http://idss.cs.put.poznan.pl/site/software.html">http://idss.cs.put.poznan.pl/site/software.html</a> - Software from Laboratory of intelligent decision support system in Poznam University of Technology
+ </P>
+</ol>
+
+<h2>SEE ALSO</h2>
+<p><em>r.mcda.fuzzy, r.mcda.electre, r.mcda.regime, r.to.drsa, r.in.drsa</em></P>
+
+<h2>AUTHORS</h2>
+Antonio Boggia - Gianluca Massei<br>
+Department of Economics and Appraisal - University of Perugia - Italy
+
+<p>
+<i>Last changed: $Date$</i>
Deleted: grass-addons/grass7/raster/r.mcda.roughset/r.mcda.roughset.py.html
===================================================================
--- grass-addons/grass7/raster/r.mcda.roughset/r.mcda.roughset.py.html 2014-01-21 22:00:03 UTC (rev 58757)
+++ grass-addons/grass7/raster/r.mcda.roughset/r.mcda.roughset.py.html 2014-01-21 22:14:02 UTC (rev 58758)
@@ -1,31 +0,0 @@
-<h2>DESCRIPTION</h2>
-
-<em>r.mcda.roughset</em> is the python implementation of the dominance rough set approach (Domlem algorithm) in GRASS GIS environment. It requires the following input:
-<br>1. the geographical criteria constituting the information system for the rough set analysis; they have to describe environmental, economic or social issues(<b>criteria</b>=<em>name[,name,...]</em>);<br> 2. the preference (<b>preferences</b>=<em>character</em>)for each criteria used in analysis (gain or cost with comma separator)<br>3. the theme in which areas with the issues to be studied are classified (with crescent preference values) (<b>decision</b>=<em>string</em>).
-
-<p>An information system is generated and Domlem algorithm is applied for extraction a minimal set of rules.</P> The algorithm builds two text files (<b>outputTxt</b>=<em>name</em>): the first with isf extension for more deep analysis with non geographic software like 4emka and JAMM ; the second file with rls extension hold all the set of rules generate. An output map (<b>outputMap</b>=<em>string</em>)is generated for region classification with the rules finded and the criteria stored in GRASS geodb.
-
-<h2>NOTES</h2>
-<p> The module can work very slowly with high number of criteria and sample. For bug please contact Gianluca Massei (g_mass at libero.it)</P>
-
-
-<h2>REFERENCE</h2>
-<ol>
- <li><p>Greco S., Matarazzo B., Slowinski R.: <i>Rough sets theory for multicriteria decision analysis</i>. European Journal of Operational Research, 129, 1 (2001) 1-47.</P>
- <li><p>Greco S., Matarazzo B., Slowinski R.:<i> Multicriteria classification by dominance-based rough set approach</i>. In: W.Kloesgen and J.Zytkow (eds.), Handbook of Data Mining and Knowledge Discovery, Oxford University Press, New York, 2002.</P>
- <li><p>Greco S., Matarazzo B., Slowinski, R., Stefanowski, J.: <i>An Algorithm for Induction of Decision Rules Consistent with the Dominance Principle</i>. In W. Ziarko, Y. Yao (eds.): Rough Sets and Current Trends in Computing. Lecture Notes in Artificial Intelligence 2005 (2001) 304 - 313. Springer-Verlag</P>
- <li><p>Greco, S., B. Matarazzo, R. Slowinski and J. Stefanowski:<i> Variable consistency model of dominance-based rough set approach.</i> In W.Ziarko, Y.Yao (eds.): Rough Sets and Current Trends in Computing. Lecture Notes in Artificial Intelligence 2005 (2001) 170 - 181. Springer-Verlag</P>
- <li><p><a href="http://en.wikipedia.org/wiki/Dominance-based_rough_set_approach">http://en.wikipedia.org/wiki/Dominance-based_rough_set_approach</a> - “Dominance-based rough set approach”</P>
- <li><p><a href="http://idss.cs.put.poznan.pl/site/software.html">http://idss.cs.put.poznan.pl/site/software.html</a> - Software from Laboratory of intelligent decision support system in Poznam University of Technology
- </P>
-</ol>
-
-<h2>SEE ALSO</h2>
-<p><em>r.mcda.fuzzy, r.mcda.electre, r.mcda.regime, r.to.drsa, r.in.drsa</em></P>
-
-<h2>AUTHORS</h2>
-Antonio Boggia - Gianluca Massei<br>
-Department of Economics and Appraisal - University of Perugia - Italy
-
-<p>
-<i>Last changed: $Date$</i>
Deleted: grass-addons/grass7/raster/r.width.funct/r.width.funct
===================================================================
--- grass-addons/grass7/raster/r.width.funct/r.width.funct 2014-01-21 22:00:03 UTC (rev 58757)
+++ grass-addons/grass7/raster/r.width.funct/r.width.funct 2014-01-21 22:14:02 UTC (rev 58758)
@@ -1,131 +0,0 @@
-#!/usr/bin/env python
-################################################################################
-#
-# MODULE: r.width.funct
-#
-# AUTHOR(S): Massimo Di Stefano, Francesco Di Stefano, Margherita Di Leo
-#
-#
-# PURPOSE: The module produces the Width Function of a basin. The Width
-# Function W(x) gives the number of the cells in a basin at a
-# flow distance x from the outlet (distance-area function)
-#
-# COPYRIGHT: (c) 2010 Massimo Di Stefano, Francesco Di Stefano, Margherita Di Leo
-#
-# This program is free software under the GNU General Public
-# License (>=v2). Read the file COPYING that comes with GRASS
-# for details.
-#
-# REQUIRES: Matplotlib
-# http://matplotlib.sourceforge.net/
-#
-#
-################################################################################
-#%module
-#% description:
-#% keywords: raster
-#%end
-
-#%option G_OPT_R_INPUT
-#% key: map
-#% description: Distance to outlet map (from r.stream.distance)
-#% required: yes
-#%end
-
-#%option G_OPT_F_OUTPUT
-#% key: image
-#% key_desc: image
-#% description: Name for output graph file (png)
-#% required: yes
-#%END
-
-
-import sys
-import os
-import matplotlib #required by windows
-matplotlib.use('wx') #required by windows
-import matplotlib.pyplot as plt
-import grass.script as grass
-import numpy as np
-
-def main():
- stats = grass.read_command('r.stats', input = options['map'], sep = 'space', nv = '*', nsteps = '255', flags = 'Anc').split('\n')[:-1]
-
- # res = cellsize
- res = float(grass.read_command('g.region', rast = options['map'], flags = 'm').strip().split('\n')[4].split('=')[1])
- zn = np.zeros((len(stats),4),float)
- kl = np.zeros((len(stats),2),float)
- prc = np.zeros((9,2),float)
-
- for i in range(len(stats)):
- if i == 0:
- zn[i,0], zn[i,1] = map(float, stats[i].split(' '))
- zn[i,1] = zn[i,1]
- zn[i,2] = zn[i,1] * res
- if i != 0:
- zn[i,0], zn[i,1] = map(float, stats[i].split(' '))
- zn[i,2] = zn[i,1] + zn[i-1,2]
- zn[i,3] = zn[i,1] * (res**2)
-
- totcell = sum(zn[:,1])
- print "Tot. cells", totcell
- totarea = totcell * (res**2)
- print "Tot. area", totarea
- maxdist = max(zn[:,0])
- print "Max distance", maxdist
-
- for i in range(len(stats)):
- kl[i,0] = zn[i,0]
- kl[i,1] = zn[i,2] / totcell
-
- # quantiles
- prc[0,0] , prc[0,1] = findint(kl,0.05) , 0.05
- prc[1,0] , prc[1,1] = findint(kl,0.15) , 0.15
- prc[2,0] , prc[2,1] = findint(kl,0.3) , 0.3
- prc[3,0] , prc[3,1] = findint(kl,0.4) , 0.4
- prc[4,0] , prc[4,1] = findint(kl,0.5) , 0.5
- prc[5,0] , prc[5,1] = findint(kl,0.6) , 0.6
- prc[6,0] , prc[6,1] = findint(kl,0.7) , 0.7
- prc[7,0] , prc[7,1] = findint(kl,0.85) , 0.85
- prc[8,0] , prc[8,1] = findint(kl,0.95) , 0.95
-
- # plot
- plotImage(zn[:,0], zn[:,3], options['image']+'_width_function.png','-','x','W(x)','Width Function')
-
- print "==========================="
- print "Whidth Function | quantiles"
- print "==========================="
- print '%.0f' %findint(kl,0.05) , "|", 0.05
- print '%.0f' %findint(kl,0.15) , "|", 0.15
- print '%.0f' %findint(kl,0.3) , "|", 0.3
- print '%.0f' %findint(kl,0.4) , "|", 0.4
- print '%.0f' %findint(kl,0.5) , "|", 0.5
- print '%.0f' %findint(kl,0.6) , "|", 0.6
- print '%.0f' %findint(kl,0.7) , "|", 0.7
- print '%.0f' %findint(kl,0.85) , "|", 0.85
- print '%.0f' %findint(kl,0.95) , "|", 0.95
- print '\n'
- print 'Done!'
-
-def plotImage(x,y,image,type,xlabel,ylabel,title):
- plt.plot(x, y, type)
- plt.ylabel(ylabel)
- plt.xlabel(xlabel)
- plt.xlim( min(x), max(x) )
- plt.ylim( min(y), max(y) )
- plt.title(title)
- plt.grid(True)
- plt.savefig(image)
- plt.close('all')
-
-def findint(kl,f):
- Xf = np.abs(kl-f); Xf = np.where(Xf==Xf.min())
- z1 , z2 , f1 , f2 = kl[float(Xf[0])][0] , kl[float(Xf[0]-1)][0] , kl[float(Xf[0])][1] , kl[float(Xf[0]-1)][1]
- z = z1 + ((z2 - z1) / (f2 - f1)) * (f - f1)
- return z
-
-
-if __name__ == "__main__":
- options, flags = grass.parser()
- sys.exit(main())
-
Copied: grass-addons/grass7/raster/r.width.funct/r.width.funct.py (from rev 58746, grass-addons/grass7/raster/r.width.funct/r.width.funct)
===================================================================
--- grass-addons/grass7/raster/r.width.funct/r.width.funct.py (rev 0)
+++ grass-addons/grass7/raster/r.width.funct/r.width.funct.py 2014-01-21 22:14:02 UTC (rev 58758)
@@ -0,0 +1,131 @@
+#!/usr/bin/env python
+################################################################################
+#
+# MODULE: r.width.funct
+#
+# AUTHOR(S): Massimo Di Stefano, Francesco Di Stefano, Margherita Di Leo
+#
+#
+# PURPOSE: The module produces the Width Function of a basin. The Width
+# Function W(x) gives the number of the cells in a basin at a
+# flow distance x from the outlet (distance-area function)
+#
+# COPYRIGHT: (c) 2010 Massimo Di Stefano, Francesco Di Stefano, Margherita Di Leo
+#
+# This program is free software under the GNU General Public
+# License (>=v2). Read the file COPYING that comes with GRASS
+# for details.
+#
+# REQUIRES: Matplotlib
+# http://matplotlib.sourceforge.net/
+#
+#
+################################################################################
+#%module
+#% description:
+#% keywords: raster
+#%end
+
+#%option G_OPT_R_INPUT
+#% key: map
+#% description: Distance to outlet map (from r.stream.distance)
+#% required: yes
+#%end
+
+#%option G_OPT_F_OUTPUT
+#% key: image
+#% key_desc: image
+#% description: Name for output graph file (png)
+#% required: yes
+#%END
+
+
+import sys
+import os
+import matplotlib #required by windows
+matplotlib.use('wx') #required by windows
+import matplotlib.pyplot as plt
+import grass.script as grass
+import numpy as np
+
+def main():
+ stats = grass.read_command('r.stats', input = options['map'], sep = 'space', nv = '*', nsteps = '255', flags = 'Anc').split('\n')[:-1]
+
+ # res = cellsize
+ res = float(grass.read_command('g.region', rast = options['map'], flags = 'm').strip().split('\n')[4].split('=')[1])
+ zn = np.zeros((len(stats),4),float)
+ kl = np.zeros((len(stats),2),float)
+ prc = np.zeros((9,2),float)
+
+ for i in range(len(stats)):
+ if i == 0:
+ zn[i,0], zn[i,1] = map(float, stats[i].split(' '))
+ zn[i,1] = zn[i,1]
+ zn[i,2] = zn[i,1] * res
+ if i != 0:
+ zn[i,0], zn[i,1] = map(float, stats[i].split(' '))
+ zn[i,2] = zn[i,1] + zn[i-1,2]
+ zn[i,3] = zn[i,1] * (res**2)
+
+ totcell = sum(zn[:,1])
+ print "Tot. cells", totcell
+ totarea = totcell * (res**2)
+ print "Tot. area", totarea
+ maxdist = max(zn[:,0])
+ print "Max distance", maxdist
+
+ for i in range(len(stats)):
+ kl[i,0] = zn[i,0]
+ kl[i,1] = zn[i,2] / totcell
+
+ # quantiles
+ prc[0,0] , prc[0,1] = findint(kl,0.05) , 0.05
+ prc[1,0] , prc[1,1] = findint(kl,0.15) , 0.15
+ prc[2,0] , prc[2,1] = findint(kl,0.3) , 0.3
+ prc[3,0] , prc[3,1] = findint(kl,0.4) , 0.4
+ prc[4,0] , prc[4,1] = findint(kl,0.5) , 0.5
+ prc[5,0] , prc[5,1] = findint(kl,0.6) , 0.6
+ prc[6,0] , prc[6,1] = findint(kl,0.7) , 0.7
+ prc[7,0] , prc[7,1] = findint(kl,0.85) , 0.85
+ prc[8,0] , prc[8,1] = findint(kl,0.95) , 0.95
+
+ # plot
+ plotImage(zn[:,0], zn[:,3], options['image']+'_width_function.png','-','x','W(x)','Width Function')
+
+ print "==========================="
+ print "Whidth Function | quantiles"
+ print "==========================="
+ print '%.0f' %findint(kl,0.05) , "|", 0.05
+ print '%.0f' %findint(kl,0.15) , "|", 0.15
+ print '%.0f' %findint(kl,0.3) , "|", 0.3
+ print '%.0f' %findint(kl,0.4) , "|", 0.4
+ print '%.0f' %findint(kl,0.5) , "|", 0.5
+ print '%.0f' %findint(kl,0.6) , "|", 0.6
+ print '%.0f' %findint(kl,0.7) , "|", 0.7
+ print '%.0f' %findint(kl,0.85) , "|", 0.85
+ print '%.0f' %findint(kl,0.95) , "|", 0.95
+ print '\n'
+ print 'Done!'
+
+def plotImage(x,y,image,type,xlabel,ylabel,title):
+ plt.plot(x, y, type)
+ plt.ylabel(ylabel)
+ plt.xlabel(xlabel)
+ plt.xlim( min(x), max(x) )
+ plt.ylim( min(y), max(y) )
+ plt.title(title)
+ plt.grid(True)
+ plt.savefig(image)
+ plt.close('all')
+
+def findint(kl,f):
+ Xf = np.abs(kl-f); Xf = np.where(Xf==Xf.min())
+ z1 , z2 , f1 , f2 = kl[float(Xf[0])][0] , kl[float(Xf[0]-1)][0] , kl[float(Xf[0])][1] , kl[float(Xf[0]-1)][1]
+ z = z1 + ((z2 - z1) / (f2 - f1)) * (f - f1)
+ return z
+
+
+if __name__ == "__main__":
+ options, flags = grass.parser()
+ sys.exit(main())
+
More information about the grass-commit
mailing list