Oh! Thanks! I was using GRASS 7.0.1, which has no t.rast.algebra module. I didn't noticed there where a t.rast.mapcalc and a t.rast.algebra in newer versions... I installed grass71 and as you said,
t.rast.algebra expression="ndvi_diff = ndvi[0] - ndvi[1]" basename=ndvi_diff worked perfect! Much easy than the old mapcalc and for loop version! I'm really enjoying the grass 7 temporal framework! Thanks for the fast (and accurate) answer! 2015-08-27 10:04 GMT-03:00 Veronica Andreo <[email protected]>: > Hola Leo! > > You should use t.rast.algebra ( > https://grass.osgeo.org/grass71/manuals/t.rast.algebra.html) from GRASS > GIS 7.1 for that kind of temporal algebra operation. The command should be > like: > > t.rast.algebra expression="ndvi_a = ndvi[1] - ndvi[0]" basename=ndvi_a > > For more examples on temporal modules, you can see: > https://grasswiki.osgeo.org/wiki/Temporal_data_processing > > HTH, > Vero > > 2015-08-27 9:52 GMT-03:00 Leonardo Hardtke <[email protected]>: > >> 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@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 >> >> _______________________________________________ >> grass-user mailing list >> [email protected] >> http://lists.osgeo.org/mailman/listinfo/grass-user >> > > -- 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
_______________________________________________ grass-user mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/grass-user
