[GRASS-user] t.rast.mapcalc question

Veronica Andreo veroandreo at gmail.com
Thu Aug 27 06:04:59 PDT 2015


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 <leohardtke at gmail.com>:

> 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
>
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20150827/71d590f5/attachment.html>


More information about the grass-user mailing list