[GRASS-user] summing rasters with a condition given by other rasters

Nikos Alexandris nik at nikosalexandris.net
Mon May 18 00:43:51 PDT 2015


* Martin_Brandt <martin.brandt at mailbox.org> [2015-05-17 12:44:33 -0700]:

> I have the following issue to solve:
> There is a MODIS NDVI time series with 23 images for one year, named ndvi_01
> to ndvi_23. Then i have a
> raster with integer values from 1-23 representing the start of the growing
> season (SOS), and the end (EOS), the values differ for each pixel. What i am
> trying to do is to create a raster which averages (or sums) all NDVI values
> from ndvi_01 to ndvi_23 which are between SOS and EOS, for an example pixel
> where SOS is 13 and EOS is 21 that would be an average of the 9 pixels in
> ndvi_13 to ndvi_21.
> 
> Is this possible with GRASS 7 under Ubuntu?
> 
> kind regards,
> Martin 


Dear Martin,

this sounds like a perfect use-case for the spatio-temporal framework.
Take care to timestamp your maps correctly (each NDVI image should carry
the time of acquisition of its originating MODIS scene I guess).

Then, create a spatio-temporal raster data set (strds) with `t.create` and register
your maps in it with `t.register`.

Though I don't understand the pattern in the SOS image, you have the
`t.rast.mapcalc` tool to do all sorts of magic for the strds (as you would regularly do for
single raster images).

Check in the GRASS wiki an example on using the temporal framework
<http://grasswiki.osgeo.org/wiki/Temporal_data_processing>.
There is also the tutotial at
<http://ncsu-osgeorel.github.io/grass-temporal-workshop/>.  Both are
excellent.

Best of success, Nikos


More information about the grass-user mailing list