[GRASS-user] Filtering high "outliers" in Landsat reflectance imagery?

Nikos Alexandris nik at nikosalexandris.net
Thu Aug 1 13:07:57 PDT 2013


Eric Goddard wrote:
> Hi, I need to do the same thing to some WV-2 imagery. I'm using the command
> 
> grass.mapcalc("$output = if($input_rast>1.0, 1.0, $input_rast)",
> output=wv2_out, input_rast=wv2_in)

The expression seems fine -- in general.  I also see in my *bash* history 
entries like

--%<---
r.mapcalc "TopoCorr.B.Trimmed.DOS1.ToCR.1 = if( TopoCorr.B.Trimmed.DOS1.ToCR.1 
> 1.0, 1.0, TopoCorr.B.Trimmed.DOS1.ToCR.1 )"

or

for MAP in `g.mlist rast pat=TopoCorr.B.Trimmed.DOS1.ToCR.?`; do r.mapcalc 
"${MAP} = if( ${MAP} > 1.0, 1.0, ${MAP} )"; done
--->%--

Back to yours:

# in python, you instruct
grass.mapcalc(

# and put code inside
"$output = if($input_rast>1.0, 1.0, $input_rast

# then close it
)"

Maybe it should be (not tested :-p):

grass.mapcalc( "$output = if( $input_rast > 1.0, 1.0, $input_rast)" )

?

Nikos

[rest deleted]


More information about the grass-user mailing list