[GRASS-user] i.landsat.rgb problem

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 red=brov.red@PERMANENT green=brov.green@PERMANENT
blue=brov.blue@PERMANENT strength=90
Processing [brov.red@PERMANENT] ..
/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 [brov.green@PERMANENT] ..
/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 [brov.blue@PERMANENT] ..
/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 <brov.red@PERMANENT> set to rules
Color table for <brov.green@PERMANENT> set to rules
Color table for <brov.blue@PERMANENT> set to rules

Thank you
Leonardo

Hi,

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

Martin

2008/1/17, Leonardo Lami <lami@faunalia.it>:

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 red=brov.red@PERMANENT green=brov.green@PERMANENT
blue=brov.blue@PERMANENT strength=90
Processing [brov.red@PERMANENT] ..
/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 [brov.green@PERMANENT] ..
/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 [brov.blue@PERMANENT] ..
/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 <brov.red@PERMANENT> set to rules
Color table for <brov.green@PERMANENT> set to rules
Color table for <brov.blue@PERMANENT> 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 <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *

(attachments)

i-landsat-rgb-awk.diff (1.71 KB)

Martin Landa ha scritto:

Hi,

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

Martin

Thank you very much.

I'm going to try it!

Hi
Leonardo

Hello,

I am responding to an old (Jan 2008) post in the hopes someone can help me
out a bit. I am trying to use i.landsat.rgb, and am finding that after I do
so, the colour tables of the rasters I am using are changed to white (same
problem as Leonardo Lami had below).

I am very much a beginner grass user. Can someone please tell me how to use
the patch that Martin Landa provided below? It sounds like it will address
my problem, but I do not know how to load it / apply it. I am running Grass
6.3 through the plug-in on QGIS 0.11.0.

Thanks,
Tim

Martin Landa wrote:

Hi,

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

Martin

2008/1/17, Leonardo Lami <lami@faunalia.it>:

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 red=brov.red@PERMANENT green=brov.green@PERMANENT
blue=brov.blue@PERMANENT strength=90
Processing [brov.red@PERMANENT] ..
/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 [brov.green@PERMANENT] ..
/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 [brov.blue@PERMANENT] ..
/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 <brov.red@PERMANENT> set to rules
Color table for <brov.green@PERMANENT> set to rules
Color table for <brov.blue@PERMANENT> 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 <landa.martin@gmail.com> * 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

--
View this message in context: http://n2.nabble.com/i.landsat.rgb-problem-tp1881284p2427855.html
Sent from the Grass - Users mailing list archive at Nabble.com.