[GRASS-user] t.rast.mapcalc question

Leonardo Hardtke leohardtke at gmail.com
Thu Aug 27 05:52:45 PDT 2015


Dear GRASS users:
I'm experienced grass user...  I use GRASS since I started my PhD research
in landscape ecology back in 2009...
I'm trying to calculate the difference of NDVI between consecutive dates. I
used to do it like:

i=0
for map in $(g.list rast pattern=MOD13Q1*_01_*); do
    NDVI[i]=$map
    echo "Adding: " $map
    let i=i+1
done

for id in $(seq 0 $(echo ${#NDVI[@]})); do
echo $id
 r.mapcalc "ndvi_dif2_$id = ${NDVI[$id+1]} - ${NDVI[id]}"
done

But i thing there must be an easier way using the grass 7 temporal
framework. So i registred my dataset and tried the following....

t.rast.list input=ndvi at ts
MOD13Q1.A2009001.h12v12.005.2009019145228_01_4326|ts|2009-01-01
00:00:00|2009-01-17 00:00:00
MOD13Q1.A2009017.h12v12.005.2009035110230_01_4326|ts|2009-01-17
00:00:00|2009-02-02 00:00:00
............................................................................................
MOD13Q1.A2010337.h12v12.005.2010355100650_01_4326|ts|2010-12-03
00:00:00|2010-12-19 00:00:00
MOD13Q1.A2010353.h12v12.005.2011005202724_01_4326|ts|2010-12-19
00:00:00|2011-01-04 00:00:00


t.rast.mapcalc input=ndvi expression="ndvi[1] - ndvi[0]" output=ndvi_a
basename=ndvi_a

But the output is not good (see attached file: left is OK, rigth is wrong)
Am I doing something wrong?
Thanks!
Dr. Leonardo A. Hardtke
Laboratorio de Teledetección y S.I.G.
Centro Nacional Patagónico (CONICET)
Bvd. Brown 2825, 9120
Puerto Madryn, Chubut, Argentina
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20150827/a2694d39/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: send.png
Type: image/png
Size: 137328 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20150827/a2694d39/attachment-0001.png>


More information about the grass-user mailing list