[GRASS-user] i.landsat.rgb problem

Tim Holland timothyholland at gmail.com
Thu Mar 5 02:07:08 EST 2009


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 at 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 at PERMANENT green=brov.green at PERMANENT
>> blue=brov.blue at PERMANENT strength=90
>> Processing [brov.red at 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 at 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 at 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 at PERMANENT> set to rules
>> Color table for <brov.green at PERMANENT> set to rules
>> Color table for <brov.blue at PERMANENT> set to rules
>>
>>
>> Thank you
>> Leonardo
>> _______________________________________________
>> grass-user mailing list
>> grass-user at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/grass-user
>>
> 
> 
> -- 
> Martin Landa <landa.martin at 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 at 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.



More information about the grass-user mailing list