[GRASS-SVN] r60403 - grass-addons/grass7/raster/r.diversity
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed May 21 23:52:36 PDT 2014
Author: neteler
Date: 2014-05-21 23:52:36 -0700 (Wed, 21 May 2014)
New Revision: 60403
Modified:
grass-addons/grass7/raster/r.diversity/r.diversity.html
grass-addons/grass7/raster/r.diversity/r.diversity.py
Log:
r.diversity: portable grass_config_dir; message fixes; example fixes
Modified: grass-addons/grass7/raster/r.diversity/r.diversity.html
===================================================================
--- grass-addons/grass7/raster/r.diversity/r.diversity.html 2014-05-22 03:11:37 UTC (rev 60402)
+++ grass-addons/grass7/raster/r.diversity/r.diversity.html 2014-05-22 06:52:36 UTC (rev 60403)
@@ -32,25 +32,25 @@
To calculate the set of indices from a NDVI map, with a moving window
of 3 x 3 pixel, run:
<div class="code"><pre>
-r.diversity input=ndvi_map output=diversity alpha=0.5
+r.diversity input=ndvi_map prefix=diversity alpha=0.5
</pre></div>
To calculate the set of indices from a NDVI map, with a moving window
of 7 x 7 pixel, run:
<div class="code"><pre>
-r.diversity input=ndvi_map output=diversity alpha=0.5 size=7
+r.diversity input=ndvi_map prefix=diversity alpha=0.5 size=7
</pre></div>
To calculate only Pielou and Simpson indices from a NDVI map, with
several moving window (3 x 3, 5 x 5, 7 x 7, 9 x 9), run:
<div class="code"><pre>
-r.diversity input=ndvi_map output=diversity size=3-9 method=pielou,simpson
+r.diversity input=ndvi_map prefix=diversity size=3-9 method=pielou,simpson
</pre></div>
To calculate all methods excluding Pielou from a NDVI map, with two moving
window (3 x 3, 9 x 9), run:
<div class="code"><pre>
-r.diversity input=ndvi_map output=diversity size=3,9 exclude=pielou alpha=3
+r.diversity input=ndvi_map prefix=diversity size=3,9 exclude=pielou alpha=3
</pre></div>
<h2>SEE ALSO</h2>
Modified: grass-addons/grass7/raster/r.diversity/r.diversity.py
===================================================================
--- grass-addons/grass7/raster/r.diversity/r.diversity.py 2014-05-22 03:11:37 UTC (rev 60402)
+++ grass-addons/grass7/raster/r.diversity/r.diversity.py 2014-05-22 06:52:36 UTC (rev 60403)
@@ -83,8 +83,15 @@
# main function
def main():
# set the home path
- home = os.path.expanduser('~')
- rlidir = os.path.join(home, '.grass7', 'r.li')
+ grass_env_file = None # see check_shell()
+ if sys.platform == 'win32':
+ grass_config_dirname = "GRASS7"
+ grass_config_dir = os.path.join(os.getenv('APPDATA'), grass_config_dirname)
+ else:
+ grass_config_dirname = ".grass7"
+ grass_config_dir = os.path.join(os.getenv('HOME'), grass_config_dirname)
+ # configuration directory
+ rlidir = os.path.join(grass_config_dir, 'r.li')
# check if GISBASE is set
if "GISBASE" not in os.environ:
# return an error advice
@@ -124,7 +131,7 @@
quiet = False
# if method and exclude option are not null return an error
if methods != '' and excludes != '':
- grass.fatal(_("You can use method or exclude option not both"))
+ grass.fatal(_("You can either use 'method' or 'exclude' option but not both"))
# calculate method
elif methods != '':
methods = methods.split(',')
@@ -139,7 +146,7 @@
quiet, overwrite)
# remove configuration files
removeConfFile(resolution, rlidir)
- print 'All works are terminated'
+ grass.message(_("Done."))
# calculate only method included in method option
@@ -196,11 +203,11 @@
# it's used when we check the exclude option
if negative:
if method.count('renyi') != 1 and alpha == '':
- grass.fatal(_("Please you must set alpha value for Renyi entropy"))
+ grass.fatal(_("You must set alpha value for Renyi entropy"))
# it's used when we check the method option
else:
if method.count('renyi') == 1 and alpha == '':
- grass.fatal(_("Please you must set alpha value for Renyi entropy"))
+ grass.fatal(_("You must set alpha value for Renyi entropy"))
#create configuration file instead using r.li.setup
@@ -256,7 +263,7 @@
# create a range
if typ == 'range':
if alpha:
- grass.fatal(_("Range for alpha values it isn't supported"))
+ grass.fatal(_("Range for alpha values is not supported"))
else:
reso = range(reso[0], reso[1] + 1, 2)
return reso
More information about the grass-commit
mailing list