Unit 25 - MODIS ST

In this unit we will perform time-series based LST reconstruction based on Unit 24. As we already know GRASS enables time-series data handling thanks to temporal data processing framework.

In Unit 24 - MODIS we have imported MODIS data into GRASS by i.modis.import. The command was called with -w flag and outfile parameter to generate special file which can be later used for creating space-time raster dataset (strds).

Creation of space time dataset including basic operations is explained in Unit 17 - Spatio-temporal intro. Here we just apply our knowledge on MODIS dataset.

At first we will create a new space time raster dataset by t.create.

t.create output=modis title="MODIS 2017" desc="MODIS data for Germany"

In the next step will register to the dataset imported MODIS data by t.register. We run this command twice, once for Aqua data than for Terra data.

t.register input=modis file=h18v03_04/tlist-mod.txt
t.register input=modis file=h18v03_04/tlist-myd.txt

Let’s check basic metedata about created dataset by t.info.

t.info input=modis
| Start time:................. 2017-01-01 00:00:00
| End time:................... 2018-01-04 00:00:00
| Number of registered maps:.. 184


We are using composed product from the daily 1-kilometer LST product (MOD11A1/MYD11A1) stored on a 1-km Sinusoidal grid as the average values of clear-sky LSTs during an 8-day period.


Data querying

For querying space time raster dataset is designed t.rast.list. Let’s print raster data covering March 2017.

t.rast.list input=modis order=start_time \
where="start_time > '2017-03-01' and start_time < '2017-04-01'"

Univariate statistics can be computed by t.rast.univar (note that the command is running in the current computation region similarly as r.univar does).

t.rast.univar input=modis where="start_time > '2017-03-01' and start_time < '2017-04-01'"
...|2017-03-06 00:00:00|2017-03-14 00:00:00|11127.9119722696|0|14548|11127.9119722696|...

As we can see we have to convert DN into Celsius scale as we done for selected data in Unit 24. Instead of running r.mapcalc we can use temporal command t.rast.mapcalc which applies map algebra to all the maps registered in input space time dataset.


Many of temporal data processing modules (t.*) support parallelization (see nproc option).

t.rast.mapcalc input=modis output=modis_c nproc=3 basename=c \
expression="if(modis != 0, modis * 0.02 - 273.15, null())"

The command will create a new space time raster dataset with raster maps in Celsius scale. Since new raster map will be created, the command requires to define basename for them. Note that new raster maps will be produced in current computation region with mask respected.

t.rast.univar input=modis_c where="start_time > '2017-03-01' and start_time < '2017-04-01'"

Looks better.

c_033@PERMANENT|2017-03-06 00:00:00|2017-03-14 00:00:00|8.38271624724276|-20.35|17.81|...


Color table can be easily set by t.rast.colors similarly as r.colors does for single raster map.

Data aggregation

We can aggregate data monthly by using t.rast.aggregate.

t.rast.aggregate input=modis_c output=modis_cm basename=cm granularity="1 months" nproc=3

Statistics can be computed by t.rast.univar.

t.rast.univar modis_cm

Example for July and August only.

t.rast.univar modis_cm where="start_time > '2017-07-01' and start_time < '2017-09-01'"

Data extraction

A new space time dataset only with subset of data can be created by t.rast.extract. Example for the four seasons below.

t.rast.extract input=modis_c where="start_time > '2017-03-01' and start_time < '2017-06-01'" \

t.rast.extract input=modis_c where="start_time > '2017-06-01' and start_time < '2017-09-01'" \

t.rast.extract input=modis_c where="start_time > '2017-09-01' and start_time < '2017-12-01'" \

t.rast.extract input=modis_c where="start_time > '2017-12-01' or start_time < '2017-03-01'" \

By the next command t.rast.series, we will compute average temperature for each seasons.

t.rast.series input=modis_spring output=modis_spring_avg method=average
t.rast.series input=modis_summer output=modis_summer_avg method=average
t.rast.series input=modis_autumn output=modis_autumn_avg method=average
t.rast.series input=modis_winter output=modis_winter_avg method=average

Four new raster maps are created, let’s print univariate statistics for spring by using r.univar.

r.univar modis_spring_avg
minimum: -3.51545
maximum: 17.6643
range: 21.1797
mean: 10.7001

Fig. 116 Average temperature for spring 2017.

Data visualization

In Unit 17 have been presented basic GRASS tools for temporal data visualization: g.gui.timeline and g.gui.animation. See animation example below.


Fig. 117 Monthly aggregated dataset animation.