[GRASS-dev] Unexpected EVI range from "i.vi"

Nikos Alexandris nik at nikosalexandris.net
Wed Jun 19 16:01:21 PDT 2013


Markus M:

> >> Feeding the test values and the evi(2) formula to r.mapcalc, the
> >> results are more or less in the expected range, still beyond [-1, 1],
> >> but not much.
> > ------- [cut] -------

O-K, let's get this from the start (if there is still energy...).


First thing: the region!

# with  or  without "-a", it sets the same extent here
g.region rast=B.Trimmed.ToAR.1 -pag res=30

n=2815500
s=2621340
w=658560
e=875880
nsres=30
ewres=30
rows=6472
cols=7244
cells=46883168


As described in the first post, reflectances(?, -- using "i.landsat.toar 
method=uncorrected" in this case for testing) derived from Landsat7 bands that 
pertain to the scene LE71610432005160ASN00, range between...

# blue (required for evi)
r.info -r B.Trimmed.ToAR.1

min=0.0756932461701407
max=0.526690453931338

# red
r.info -r B.Trimmed.ToAR.3

min=0.0186573080153069
max=0.53363342702351

# nir
r.info -r B.Trimmed.ToAR.4

min=0.0122557420404096
max=0.815443599640871

# the EVI index
i.vi viname=evi blue=B.Trimmed.ToAR.1 red=B.Trimmed.ToAR.3 
nir=B.Trimmed.ToAR.4 output=evi

# ranges between...
r.info -r evi

min=-5905.44171917482
max=6952.80543731566

# locating these high values
r.stats evi -g | grep '\-5905'

784935 2695215 -5905.4417191748
786465 2694675 -5905.4417191748
766185 2685615 -5905.4417191748

# and
r.stats evi -g | grep '6952\.'

783435 2690025 6952.8054373157

# querying for DN, ToAR and respective EVIs in the end
# for example in "coordinates=783435,2690025"
r.what coordinates=783435,2690025 
map=B.Trimmed.1,B.Trimmed.ToAR.1,B.Trimmed.3,B.Trimmed.ToAR.3,B.Trimmed.4,B.Trimmed.ToAR.4,evi_DN,evi

783435|2690025||114|0.228143006540123|56|0.106632395012542|28|
0.0712654621906476|0.296610169491526|6952.80543731566

# doing the math in R
# with 0.228143006540123, 0.106632395012542 and 0.0712654621906476
# gives...

> blue <- 0.228143006540123
> red <- 0.106632395012542
> nir <- 0.0712654621906476
> evi <- ( 2.5 * ( nir - red) ) / (nir + 6 * red - 7 * blue + 1.0)
> evi
[1] -0.7751909

Right, this is nice!


> 
> Using r.mapcalc

how?  You mean for the specific coordinates/values (I guess... )

> I get the same results like in R, not
> -5905.44171917482 or 6952.80543731566, respectively. Why are the way
> out of range values correct if R produces reasonable results?

Sorry, too many things to work-out these days -- I wasn't clear I guess. I 
meant that "r.mapcalc" can't be wrong! I.e., I manually derive for the whole 
extent of the L7 bands in question, an EVI:

r.mapcalc "evi_manual = ( 2.5 * (B.Trimmed.ToAR.4 - B.Trimmed.ToAR.3) ) / 
(B.Trimmed.ToAR.4 + 6.0 * B.Trimmed.ToAR.3 - 7.5 * B.Trimmed.ToAR.1 + 1)"

This results in
r.info -r evi_manual

min=-5905.44171917482
max=6952.80543731566


What am I doing wrong?

Thanks, N


More information about the grass-dev mailing list