[GRASS-SVN] r59778 - grass/branches/develbranch_6/raster/r.li

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Apr 17 13:57:56 PDT 2014


Author: neteler
Date: 2014-04-17 13:57:56 -0700 (Thu, 17 Apr 2014)
New Revision: 59778

Added:
   grass/branches/develbranch_6/raster/r.li/r.li.testing_nc_asc.sh
   grass/branches/develbranch_6/raster/r.li/r.li.testing_sp_mov.sh
Modified:
   grass/branches/develbranch_6/raster/r.li/TODO
Log:
r.li: test scripts added

Modified: grass/branches/develbranch_6/raster/r.li/TODO
===================================================================
--- grass/branches/develbranch_6/raster/r.li/TODO	2014-04-17 20:57:24 UTC (rev 59777)
+++ grass/branches/develbranch_6/raster/r.li/TODO	2014-04-17 20:57:56 UTC (rev 59778)
@@ -1,64 +1,11 @@
 TODO list
 =========
 
-Brute-force testing
--------------------
-# TODO: change to/add 3x3 example
+# TODO: change the examples to North Carolina wherever possible:
 
-# 7x7 moving window test:
-# still Spearfish...
-
-# created as described in EXAMPLES, moving window r.li.setup/description.html:
-echo "SAMPLINGFRAME 0|0|1|1
-SAMPLEAREA -1|-1|0.015021459227467811|0.011058451816745656
-MOVINGWINDOW" > $HOME/.r.li/history/movwindow7
-
-export GRASS_OVERWRITE=1
+# Spearfish tests
 g.region rast=landcover.30m -p
 r.mapcalc "forests = if(landcover.30m >= 41 && landcover.30m <= 43,1,null())"
-
-MEASURE="dominance edgedensity mpa mps padcv padrange padsd patchdensity patchnum pielou richness shannon shape simpson"
-
-for mymeasure in $MEASURE ; do
-  r.li.${mymeasure} input=forests conf=movwindow7 out=forests_${mymeasure}_mov7
-  r.univar forests_${mymeasure}_mov7
-done
-
-# also alpha:
-r.li.renyi input=forests conf=movwindow7 out=forests_renyi_mov7_a06 alpha=0.6
-r.univar forests_renyi_mov7_a06
-
-echo "End of r.li tests"
-
-
-========================
-North Carolina tests
-
-echo "SAMPLINGFRAME 0|0|1|1
-SAMPLEAREA 0.0|0.0|1.0|1.0" > $HOME/.r.li/history/landsat_test
-
-g.region rast=lsat7_2002_40 -p
-r.li.shannon input=lsat7_2002_40 conf=landsat_test out=landsat_shannon
---> Result written to ASCII file <$HOME/.r.li/output/landsat_shannon>
-
-
-
-===============================================================
-GRASS 6
--------
-
-TODO: backport all GRASS 7 fixes
-
-A few remaining things should be done soon:
-- add relevant references
-- use English variable names in C code
-
-Please change the examples to North Carolina wherever possible:
-
-
-# Spearfish
-g.region rast=landcover.30m -p
-r.mapcalc "forests = if(landcover.30m >= 41 && landcover.30m <= 43,1,null())"
 d.mon x0
 d.rast forests
 
@@ -74,6 +21,7 @@
 r.to.vect forests out=forests feature=area
 d.vect forests type=boundary
 
+## CHECK THIS:
 
 # MASK test
 g.copy rast=fields,MASK
@@ -90,8 +38,17 @@
 max=19.841270
 # -> all cells are 19.841270 ?!
 
----------
 
-Add example which results in an ASCII output file
+========================
+North Carolina tests
 
+# Tests with return an ASCII output file
+sh ./r.li.testing_nc_asc.sh
 
+---------
+echo "SAMPLINGFRAME 0|0|1|1
+SAMPLEAREA 0.0|0.0|1.0|1.0" > $HOME/.r.li/history/landsat_test
+
+g.region rast=lsat7_2002_40 -p
+r.li.shannon input=lsat7_2002_40 conf=landsat_test out=landsat_shannon
+--> Result written to ASCII file <$HOME/.r.li/output/landsat_shannon>

Added: grass/branches/develbranch_6/raster/r.li/r.li.testing_nc_asc.sh
===================================================================
--- grass/branches/develbranch_6/raster/r.li/r.li.testing_nc_asc.sh	                        (rev 0)
+++ grass/branches/develbranch_6/raster/r.li/r.li.testing_nc_asc.sh	2014-04-17 20:57:56 UTC (rev 59778)
@@ -0,0 +1,77 @@
+#!/bin/sh
+
+#========================
+# North Carolina tests
+
+G6RLI=$HOME/.r.li
+G7RLI=$HOME/.grass7/r.li
+
+# switch GRASS GIS version here:
+G_RLI=$G6RLI
+
+echo "SAMPLINGFRAME 0|0|1|1
+SAMPLEAREA 0.0|0.0|1.0|1.0" > $G7RLI/landcover_whole_whole # GRASS7
+
+echo "SAMPLINGFRAME 0|0|1|1
+SAMPLEAREA 0.0|0.0|1.0|1.0" > $G6RLI/history/landcover_whole_whole # GRASS6
+
+
+# North Carolina location:
+export GRASS_OVERWRITE=1
+g.region rast=landclass96 -p
+RASTER_MAP=landclass96
+#r.to.vect in=basin_50K out=basin_50K feature=area
+
+echo "-------------------------"
+r.li.dominance $RASTER_MAP conf=landcover_whole_whole out=forests_dominance_whole
+cat $G_RLI/output/forests_dominance_whole
+
+echo "-------------------------"
+r.li.edgedensity $RASTER_MAP conf=landcover_whole_whole out=forests_edgedens_whole
+cat $G_RLI/output/forests_edgedens_whole
+
+echo "-------------------------"
+r.li.mpa $RASTER_MAP conf=landcover_whole_whole out=forests_mpa_whole
+cat $G_RLI/output/forests_mpa_whole
+
+echo "-------------------------"
+r.li.mps $RASTER_MAP conf=landcover_whole_whole out=forests_mps_whole
+cat $G_RLI/output/forests_mps_whole
+
+echo "-------------------------"
+r.li.padcv $RASTER_MAP conf=landcover_whole_whole out=forests_padcv_whole
+cat $G_RLI/output/forests_padcv_whole
+
+echo "-------------------------"
+r.li.padrange $RASTER_MAP conf=landcover_whole_whole out=forests_padrange_whole
+cat $G_RLI/output/forests_padrange_whole
+
+echo "-------------------------"
+r.li.padsd $RASTER_MAP conf=landcover_whole_whole out=forests_padsd_whole
+cat $G_RLI/output/forests_padsd_whole
+
+echo "-------------------------"
+r.li.patchdensity $RASTER_MAP conf=landcover_whole_whole out=forests_p_dens_whole
+cat $G_RLI/output/forests_p_dens_whole
+
+echo "-------------------------"
+r.li.patchnum $RASTER_MAP conf=landcover_whole_whole out=forests_patchnum_whole
+cat $G_RLI/output/forests_patchnum_whole
+
+echo "-------------------------"
+r.li.pielou $RASTER_MAP conf=landcover_whole_whole out=forests_pielou_whole
+cat $G_RLI/output/forests_pielou_whole
+
+echo "-------------------------"
+r.li.renyi $RASTER_MAP conf=landcover_whole_whole out=forests_renyi_whole7_a06 alpha=0.6
+cat $G_RLI/output/forests_renyi_whole7_a06
+
+echo "-------------------------"
+r.li.richness $RASTER_MAP conf=landcover_whole_whole out=forests_richness_whole
+cat $G_RLI/output/forests_richness_whole
+
+echo "-------------------------"
+r.li.shannon $RASTER_MAP conf=landcover_whole_whole out=forests_shannon_whole
+cat $G_RLI/output/forests_shannon_whole
+
+echo "====== End of r.li tests ========================"


Property changes on: grass/branches/develbranch_6/raster/r.li/r.li.testing_nc_asc.sh
___________________________________________________________________
Added: svn:executable
   + *
Added: svn:mime-type
   + text/x-sh
Added: svn:eol-style
   + native

Added: grass/branches/develbranch_6/raster/r.li/r.li.testing_sp_mov.sh
===================================================================
--- grass/branches/develbranch_6/raster/r.li/r.li.testing_sp_mov.sh	                        (rev 0)
+++ grass/branches/develbranch_6/raster/r.li/r.li.testing_sp_mov.sh	2014-04-17 20:57:56 UTC (rev 59778)
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+#========================
+#Spearfish tests
+# 7x7 moving window test
+# Brute-force testing in a loop
+
+# TODO: change to/add 3x3 example
+
+# created conf file as described in EXAMPLES, moving window, r.li.setup/description.html:
+echo "SAMPLINGFRAME 0|0|1|1
+SAMPLEAREA -1|-1|0.015021459227467811|0.011058451816745656
+MOVINGWINDOW" > $HOME/.r.li/history/movwindow7
+
+export GRASS_OVERWRITE=1
+g.region rast=landcover.30m -p
+r.mapcalc "forests = if(landcover.30m >= 41 && landcover.30m <= 43,1,null())"
+
+MEASURE="dominance edgedensity mpa mps padcv padrange padsd patchdensity patchnum pielou richness shannon shape simpson"
+for mymeasure in $MEASURE ; do
+  echo "====== $mymeasure: ========================"
+  r.li.${mymeasure} forests conf=movwindow7 out=forests_${mymeasure}_mov7
+  r.univar -g forests_${mymeasure}_mov7
+done
+
+# here also alpha:
+mymeasure=renyi
+echo "====== $mymeasure: ========================"
+r.li.renyi forests conf=movwindow7 out=forests_renyi_mov7_a06 alpha=0.6
+r.univar -g forests_renyi_mov7_a06
+
+echo "====== End of r.li tests ========================"


Property changes on: grass/branches/develbranch_6/raster/r.li/r.li.testing_sp_mov.sh
___________________________________________________________________
Added: svn:executable
   + *
Added: svn:mime-type
   + text/x-sh
Added: svn:eol-style
   + native



More information about the grass-commit mailing list