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

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Jun 15 00:04:35 PDT 2013


Author: hamish
Date: 2013-06-15 00:04:35 -0700 (Sat, 15 Jun 2013)
New Revision: 56711

Added:
   grass/branches/develbranch_6/raster/r.li/r.li.setup/masked_area_selection.sh
Removed:
   grass/branches/develbranch_6/raster/r.li/r.li.setup/masked_area_selection
Modified:
   grass/branches/develbranch_6/raster/r.li/r.li.setup/Makefile
   grass/branches/develbranch_6/raster/r.li/r.li.setup/r.li.setup.procedures.tcl
Log:
rename script to add extension


Modified: grass/branches/develbranch_6/raster/r.li/r.li.setup/Makefile
===================================================================
--- grass/branches/develbranch_6/raster/r.li/r.li.setup/Makefile	2013-06-15 07:01:57 UTC (rev 56710)
+++ grass/branches/develbranch_6/raster/r.li/r.li.setup/Makefile	2013-06-15 07:04:35 UTC (rev 56711)
@@ -9,7 +9,7 @@
 default: script
 	$(MKDIR) $(TARGET)
 	$(INSTALL) area_query $(TARGET)/area_query
-	$(INSTALL) masked_area_selection $(TARGET)/masked_area_selection
+	$(INSTALL) masked_area_selection.sh $(TARGET)/masked_area_selection.sh
 	$(INSTALL) r.li.setup.main $(TARGET)/r.li.setup.main
 	$(INSTALL) r.li.setup.procedures.tcl $(TARGET)/r.li.setup.procedures.tcl
 	$(INSTALL) r.li.windows.tcl $(TARGET)/r.li.windows.tcl

Deleted: grass/branches/develbranch_6/raster/r.li/r.li.setup/masked_area_selection
===================================================================
--- grass/branches/develbranch_6/raster/r.li/r.li.setup/masked_area_selection	2013-06-15 07:01:57 UTC (rev 56710)
+++ grass/branches/develbranch_6/raster/r.li/r.li.setup/masked_area_selection	2013-06-15 07:04:35 UTC (rev 56711)
@@ -1,167 +0,0 @@
-#! /bin/sh -x
-#%Module 
-#%description: Select a circular or polygonal area
-#%End
-#%option
-#% key: raster
-#% type: string
-#% description: raster map to to analyse
-#% required: yes
-#%end
-#%option
-#% key: vector
-#% type: string
-#% description: vector to overlay
-#% required: no
-#%end
-#%option
-#% key: site
-#% type: string
-#% description: site to overlay
-#% required: no
-#%end
-#%option
-#% key: conf
-#% type: string
-#% description: name of configuration file where insert areas
-#% required: yes
-#%end
-#%option
-#% key: north
-#% type: string
-#% description: nothern edge (use only with f flag)
-#% required: no
-#%end
-#%option
-#% key: south
-#% type: string
-#% description:south edge (use only with f flag)
-#% required: no
-#%end
-#%option
-#% key: east
-#% type: string
-#% description: east edge(use only with f flag)
-#% required: no
-#%end
-#%option
-#% key: west 
-#% type: string
-#% description: west edge(use only with f flag)
-#% required: no
-#%end
-#%flag
-#% key: f
-#% description: sample frame yet selected 
-#%end
-#%flag
-#% key: c
-#% description: take a circular area
-#%end
-
-# Where to find the others scripts
-f_path="$GISBASE/etc/r.li.setup"
-
-# Check if we have grass
-if test "$GISBASE" = ""; then
- echo "You must be in GRASS GIS to run this program." >&2
- exit 1
- fi
-if [ "$1" != "@ARGS_PARSED@" ] ; then
-  exec g.parser "$0" "$@"
-fi
-
-#### set temporary files
-TMP="`g.tempfile pid=$$`"
-if [ $? -ne 0 ] || [ -z "$TMP" ] ; then
-    echo "ERROR: unable to create temporary files" 1>&2
-    exit 1
-fi
-
-
-#### environment variables
-g.gisenv LOCATION_NAME > $TMP.var
-read LOCATION < $TMP.var
-g.gisenv GISDBASE > $TMP.var
-read GISDBASE < $TMP.var
-g.gisenv MAPSET > $TMP.var
-read MAPSET < $TMP.var
-# show the sampling frame
-
-if [ $GIS_FLAG_f -eq 1 ] ; then
-    g.region n=$GIS_OPT_north s=$GIS_OPT_south e=$GIS_OPT_east w=$GIS_OPT_west
-else
-    g.region rast=$GIS_OPT_raster
-fi
-# open x1 monitor
-d.mon stop=x1
-d.mon start=x1
-
-d.rast -o map=$GIS_OPT_raster
-if [ -n "$GIS_OPT_vector" ] ; then
-    d.vect map=$GIS_OPT_vector
-fi
-if [ -n "$GIS_OPT_site" ] ; then 
-    d.vect  map=$GIS_OPT_site
-fi
-#let draw area
-if [ $GIS_FLAG_c -eq 1 ] ; then
-    cp $f_path/circle.txt $$.txt 
-    echo "$$" >> $$.txt 
-else
-    cp $f_path/polygon.txt  $$.txt 
-    echo "$$" >> $$.txt
-fi
- 
-r.digit < $$.txt
-
-#show the selected area
-d.rast -o map=$$ 
-export name=$$.val
-$GRASS_WISH $f_path/area_query 
-    cat $name | cut -f1 -d ' ' > $name.var
-    read ok < $name.var
-    cat $name | cut -f2 -d' ' > $name.var
-    r_name=""
-    read r_name < $name.var
-    if [ $ok -eq 1 ] ; then
-	r.to.vect input="$$" output="v$$" feature=area
-	g.region vect="v$$"
-	v.to.rast input="v$$" output=$r_name value=1 use=val
-	#write info in configuration file
-	g.region -g| grep "n=" | cut -f2 -d'='> $name.var
-	read north < $name.var
-	g.region -g| grep "s=" | cut -f2 -d'='  > $name.var
-	read south < $name.var
-	g.region -g| grep "e=" | cut -f2 -d'=' > $name.var
-	read east < $name.var
-	g.region -g| grep "w=" | cut -f2 -d'=' > $name.var
-	read west < $name.var
-	echo "SAMPLEAREAMASKED $r_name $north|$south|$east|$west" >>\
-	    $GIS_OPT_conf
-	#remove tmp raster and vector
-	g.remove rast=$$
-	g.remove vect=v$$
-        #rm -f "$GISDBASE"/"$LOCATION"/"$MAPSET"/cats/"$$" 
-	#rm -f "$GISDBASE"/"$LOCATION"/"$MAPSET"/cell/"$$" 
-	#rm -f "$GISDBASE"/"$LOCATION"/"$MAPSET"/cellhd/"$$" 
-	#rm -fR "$GISDBASE"/"$LOCATION"/"$MAPSET"/cell_misc/"$$" 
-	#rm -f  "$GISDBASE"/"$LOCATION"/"$MAPSET"/colr/"$$" 
-	#rm -f "$GISDBASE"/"$LOCATION"/"$MAPSET"/hist/"$$" 
-	#rm -fR "$GISDBASE"/"$LOCATION"/"$MAPSET"/vector/"v$$"
-	echo DROP TABLE "v$$" | db.execute
-	
-	if [ $GIS_FLAG_f -eq 1 ] ; then
-	    g.region n=$GIS_OPT_north s=$GIS_OPT_south e=$GIS_OPT_east w=$GIS_OPT_west
-	else
-	    g.region rast=$GIS_OPT_raster
-	fi
-
-    else
-	echo 0 >> $GIS_OPT_conf
-    fi
-
-d.mon stop=x1
-#clean tmp files
-rm -f $$*
-rm -f $TMP*

Copied: grass/branches/develbranch_6/raster/r.li/r.li.setup/masked_area_selection.sh (from rev 56706, grass/branches/develbranch_6/raster/r.li/r.li.setup/masked_area_selection)
===================================================================
--- grass/branches/develbranch_6/raster/r.li/r.li.setup/masked_area_selection.sh	                        (rev 0)
+++ grass/branches/develbranch_6/raster/r.li/r.li.setup/masked_area_selection.sh	2013-06-15 07:04:35 UTC (rev 56711)
@@ -0,0 +1,167 @@
+#! /bin/sh -x
+#%Module 
+#%description: Select a circular or polygonal area
+#%End
+#%option
+#% key: raster
+#% type: string
+#% description: raster map to to analyse
+#% required: yes
+#%end
+#%option
+#% key: vector
+#% type: string
+#% description: vector to overlay
+#% required: no
+#%end
+#%option
+#% key: site
+#% type: string
+#% description: site to overlay
+#% required: no
+#%end
+#%option
+#% key: conf
+#% type: string
+#% description: name of configuration file where insert areas
+#% required: yes
+#%end
+#%option
+#% key: north
+#% type: string
+#% description: nothern edge (use only with f flag)
+#% required: no
+#%end
+#%option
+#% key: south
+#% type: string
+#% description:south edge (use only with f flag)
+#% required: no
+#%end
+#%option
+#% key: east
+#% type: string
+#% description: east edge(use only with f flag)
+#% required: no
+#%end
+#%option
+#% key: west 
+#% type: string
+#% description: west edge(use only with f flag)
+#% required: no
+#%end
+#%flag
+#% key: f
+#% description: sample frame yet selected 
+#%end
+#%flag
+#% key: c
+#% description: take a circular area
+#%end
+
+# Where to find the others scripts
+f_path="$GISBASE/etc/r.li.setup"
+
+# Check if we have grass
+if test "$GISBASE" = ""; then
+ echo "You must be in GRASS GIS to run this program." >&2
+ exit 1
+ fi
+if [ "$1" != "@ARGS_PARSED@" ] ; then
+  exec g.parser "$0" "$@"
+fi
+
+#### set temporary files
+TMP="`g.tempfile pid=$$`"
+if [ $? -ne 0 ] || [ -z "$TMP" ] ; then
+    echo "ERROR: unable to create temporary files" 1>&2
+    exit 1
+fi
+
+
+#### environment variables
+g.gisenv LOCATION_NAME > $TMP.var
+read LOCATION < $TMP.var
+g.gisenv GISDBASE > $TMP.var
+read GISDBASE < $TMP.var
+g.gisenv MAPSET > $TMP.var
+read MAPSET < $TMP.var
+# show the sampling frame
+
+if [ $GIS_FLAG_f -eq 1 ] ; then
+    g.region n=$GIS_OPT_north s=$GIS_OPT_south e=$GIS_OPT_east w=$GIS_OPT_west
+else
+    g.region rast=$GIS_OPT_raster
+fi
+# open x1 monitor
+d.mon stop=x1
+d.mon start=x1
+
+d.rast -o map=$GIS_OPT_raster
+if [ -n "$GIS_OPT_vector" ] ; then
+    d.vect map=$GIS_OPT_vector
+fi
+if [ -n "$GIS_OPT_site" ] ; then 
+    d.vect  map=$GIS_OPT_site
+fi
+#let draw area
+if [ $GIS_FLAG_c -eq 1 ] ; then
+    cp $f_path/circle.txt $$.txt 
+    echo "$$" >> $$.txt 
+else
+    cp $f_path/polygon.txt  $$.txt 
+    echo "$$" >> $$.txt
+fi
+ 
+r.digit < $$.txt
+
+#show the selected area
+d.rast -o map=$$ 
+export name=$$.val
+$GRASS_WISH $f_path/area_query 
+    cat $name | cut -f1 -d ' ' > $name.var
+    read ok < $name.var
+    cat $name | cut -f2 -d' ' > $name.var
+    r_name=""
+    read r_name < $name.var
+    if [ $ok -eq 1 ] ; then
+	r.to.vect input="$$" output="v$$" feature=area
+	g.region vect="v$$"
+	v.to.rast input="v$$" output=$r_name value=1 use=val
+	#write info in configuration file
+	g.region -g| grep "n=" | cut -f2 -d'='> $name.var
+	read north < $name.var
+	g.region -g| grep "s=" | cut -f2 -d'='  > $name.var
+	read south < $name.var
+	g.region -g| grep "e=" | cut -f2 -d'=' > $name.var
+	read east < $name.var
+	g.region -g| grep "w=" | cut -f2 -d'=' > $name.var
+	read west < $name.var
+	echo "SAMPLEAREAMASKED $r_name $north|$south|$east|$west" >>\
+	    $GIS_OPT_conf
+	#remove tmp raster and vector
+	g.remove rast=$$
+	g.remove vect=v$$
+        #rm -f "$GISDBASE"/"$LOCATION"/"$MAPSET"/cats/"$$" 
+	#rm -f "$GISDBASE"/"$LOCATION"/"$MAPSET"/cell/"$$" 
+	#rm -f "$GISDBASE"/"$LOCATION"/"$MAPSET"/cellhd/"$$" 
+	#rm -fR "$GISDBASE"/"$LOCATION"/"$MAPSET"/cell_misc/"$$" 
+	#rm -f  "$GISDBASE"/"$LOCATION"/"$MAPSET"/colr/"$$" 
+	#rm -f "$GISDBASE"/"$LOCATION"/"$MAPSET"/hist/"$$" 
+	#rm -fR "$GISDBASE"/"$LOCATION"/"$MAPSET"/vector/"v$$"
+	echo DROP TABLE "v$$" | db.execute
+	
+	if [ $GIS_FLAG_f -eq 1 ] ; then
+	    g.region n=$GIS_OPT_north s=$GIS_OPT_south e=$GIS_OPT_east w=$GIS_OPT_west
+	else
+	    g.region rast=$GIS_OPT_raster
+	fi
+
+    else
+	echo 0 >> $GIS_OPT_conf
+    fi
+
+d.mon stop=x1
+#clean tmp files
+rm -f $$*
+rm -f $TMP*

Modified: grass/branches/develbranch_6/raster/r.li/r.li.setup/r.li.setup.procedures.tcl
===================================================================
--- grass/branches/develbranch_6/raster/r.li/r.li.setup/r.li.setup.procedures.tcl	2013-06-15 07:01:57 UTC (rev 56710)
+++ grass/branches/develbranch_6/raster/r.li/r.li.setup/r.li.setup.procedures.tcl	2013-06-15 07:04:35 UTC (rev 56711)
@@ -413,7 +413,7 @@
 		set ins [vectorInstruction]
 		tkwait window $ins
 		while { $i < $number } {
-		 	catch { exec $env(F_PATH)/masked_area_selection -f north=$env(SF_N) south=$env(SF_S) west=$env(SF_W) east=$env(SF_E) raster=$env(RASTER) vector=$env(VECTOR) site=$env(SITE) conf=$env(TMP).tmp }
+		 	catch { exec $env(F_PATH)/masked_area_selection.sh -f north=$env(SF_N) south=$env(SF_S) west=$env(SF_W) east=$env(SF_E) raster=$env(RASTER) vector=$env(VECTOR) site=$env(SITE) conf=$env(TMP).tmp }
 			set ok ""
 			catch {set ok [exec cat $env(TMP).tmp | grep "SAMPLEAREAMASKED" | cut -f1 -d\ ]}
 			if { $ok == "SAMPLEAREAMASKED" } then {
@@ -507,7 +507,7 @@
 			set ins [circleInstruction]
 			tkwait window $ins
 			while { $i < $num } {
-		 		catch { exec $env(F_PATH)/masked_area_selection -f -c north=$env(SF_N) south=$env(SF_S) west=$env(SF_W) east=$env(SF_E) raster=$env(RASTER) vector=$env(VECTOR) site=$env(SITE) conf=$env(TMP).tmp }
+		 		catch { exec $env(F_PATH)/masked_area_selection.sh -f -c north=$env(SF_N) south=$env(SF_S) west=$env(SF_W) east=$env(SF_E) raster=$env(RASTER) vector=$env(VECTOR) site=$env(SITE) conf=$env(TMP).tmp }
 				set ok ""
 				catch {set ok [exec cat $env(TMP).tmp | grep "SAMPLEAREAMASKED" | cut -f1 -d\ ]}
 				if { $ok == "SAMPLEAREAMASKED" } then {
@@ -596,7 +596,7 @@
 			set ins [circleInstruction]
 			tkwait window $ins
 			while { $i == 0 } {
-		 		catch { exec $env(F_PATH)/masked_area_selection -f -c north=$env(SF_N) south=$env(SF_S) west=$env(SF_W) east=$env(SF_E) raster=$env(RASTER) vector=$env(VECTOR) site=$env(SITE) conf=$env(TMP).tmp }
+		 		catch { exec $env(F_PATH)/masked_area_selection.sh -f -c north=$env(SF_N) south=$env(SF_S) west=$env(SF_W) east=$env(SF_E) raster=$env(RASTER) vector=$env(VECTOR) site=$env(SITE) conf=$env(TMP).tmp }
 				set ok ""
 				catch {set ok [exec cat $env(TMP).tmp | grep "SAMPLEAREAMASKED" | cut -f1 -d\ ]}
 				if { $ok == "SAMPLEAREAMASKED" } then {



More information about the grass-commit mailing list