Hi,

the attached patch should fix the problem with floating point arithmetic.

Martin

2008/1/17, Leonardo Lami <[EMAIL PROTECTED]>:
> Hi all,
> i tried i.landsat.rgb on GRASS 6.3 but I have this error message and the
> color tables of the three raster are setted with all values white.
> I obtained this three brov raster from i.fusion.brovey applied on
> Landsat images.
>
> i.landsat.rgb -p [EMAIL PROTECTED] [EMAIL PROTECTED]
> [EMAIL PROTECTED] strength=90
> Processing [EMAIL PROTECTED] ..
> /usr/lib/grass/scripts/i.landsat.rgb: line 138: [: 36.9801: integer
> expression expected
> /usr/lib/grass/scripts/i.landsat.rgb: line 141: [: 15.7707: integer
> expression expected
> Processing [EMAIL PROTECTED] ..
> /usr/lib/grass/scripts/i.landsat.rgb: line 138: [: 39.6825: integer
> expression expected
> /usr/lib/grass/scripts/i.landsat.rgb: line 141: [: 15.1483: integer
> expression expected
> Processing [EMAIL PROTECTED] ..
> /usr/lib/grass/scripts/i.landsat.rgb: line 138: [: 24.107: integer
> expression expected
> /usr/lib/grass/scripts/i.landsat.rgb: line 141: [: 13.1111: integer
> expression expected
> Color table for <[EMAIL PROTECTED]> set to rules
> Color table for <[EMAIL PROTECTED]> set to rules
> Color table for <[EMAIL PROTECTED]> set to rules
>
>
> Thank you
> Leonardo
> _______________________________________________
> grass-user mailing list
> grass-user@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
>


-- 
Martin Landa <[EMAIL PROTECTED]> * http://gama.fsv.cvut.cz/~landa *
Index: scripts/i.landsat.rgb/i.landsat.rgb
===================================================================
--- scripts/i.landsat.rgb/i.landsat.rgb	(revision 29738)
+++ scripts/i.landsat.rgb/i.landsat.rgb	(working copy)
@@ -71,6 +71,12 @@
  exit 1
 fi
 
+# check if we have awk
+if [ ! -x "`which awk`" ] ; then
+    g.message -e "awk required, please install awk or gawk first" 
+    exit 1
+fi
+
 # save command line
 if [ "$1" != "@ARGS_PARSED@" ] ; then
     CMDLINE="`basename $0`"
@@ -116,7 +122,7 @@
 
 if [ 0 -eq $GIS_FLAG_P ] ; then
    for i in $RED $GREEN $BLUE ; do
-      g.message "Processing [$i] .."
+      g.message "Processing <$i>..."
       MIN=`r.univar -ge $i perc=2 | grep "^percentile_" | cut -d'=' -f2`
       MAX=`r.univar -ge $i perc=$BRIGHTNESS | grep "^percentile_" | cut -d'=' -f2`
       #echo "[$i]:  min=$MIN   max=$MAX"
@@ -131,18 +137,14 @@
    ALL_MAX=0
    ALL_MIN=255
    for i in $RED $GREEN $BLUE ; do
-      g.message "Processing [$i] .."
+      g.message "Processing <$i>..."
       MIN=`r.univar -ge $i perc=2  | grep "^percentile_" | cut -d'=' -f2`
       MAX=`r.univar -ge $i perc=$BRIGHTNESS | grep "^percentile_" | cut -d'=' -f2`
-      #echo "[$i]:  min=$MIN   max=$MAX"
-      if [ $MAX -gt $ALL_MAX ] ; then
-	ALL_MAX=$MAX
-      fi
-      if [ $MIN -lt $ALL_MIN ] ; then
-	ALL_MIN=$MIN
-      fi
+      # echo "[$i]:  min=$MIN   max=$MAX"
+      ALL_MAX=`echo "$MAX $ALL_MAX" | awk '{if ($1 > $2) print $1; else print $2}'`
+      ALL_MIN=`echo "$MIN $ALL_MIN" | awk '{if ($1 < $2) print $1; else print $2}'`
    done
-   #echo "all_min=$ALL_MIN   all_max=$ALL_MAX"
+   # echo "all_min=$ALL_MIN   all_max=$ALL_MAX"
    for i in $RED $GREEN $BLUE ; do
       r.colors $i col=rules << EOF
 	0% black
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to