Unit 25 - MODIS ST

In this unit time-series computation based LST reconstruction will be performed.

In Unit 24 - MODIS the input MODIS data was imported into GRASS by i.modis.import. The command was called with -w flag and outfile parameter to generate a timestamp 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 and Unit 21 - Sentinel spatio-temporal.

A new space time raster datasets is created by t.create.

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

In the next step imported MODIS data is registered into space time dataset by t.register. The command needs to be run twice, once for Aqua data than for Terra data.

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

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

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

Note

Check granularity. In this case a 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 is used.

MOD11A2.A2019297_mosaic_LST_Day_1km|2019-10-24|2019-11-01

Data querying

List of registered raster maps in spatio-temporal dataset can be printed by t.rast.list. In example below only relevant data from March 2019 will be listed.

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

In the example below only raster maps coming from Aqua satellite are printed.

t.rast.list input=modis order=start_time where="name LIKE 'MYD%'"

Univariate statistics can be calculated by t.rast.univar. In example below statistics only for March 2019 is calculated. Note that the command is running in the current computation region similarly as r.univar does.

t.rast.univar input=modis where="start_time > '2019-03-01' and start_time < '2019-04-01'"
id|start|end|mean|min|max|mean_of_abs|stddev|variance|coeff_var|sum|null_cells|cells
...|2019-03-06 00:00:00|2019-03-14 00:00:00|11127.9119722696|0|14548|11127.9119722696|...

Data extracting

Raster spatio-temporal data can be extracted into a new dataset using t.rast.extract. In the example below are created four new datasets containing data of different satellite and datetime.

t.rast.extract input=modis where="name LIKE 'MOD%LST_Day_1km'" output=modis_terra_day
t.rast.extract input=modis where="name LIKE 'MOD%LST_Night_1km'" output=modis_terra_night
t.rast.extract input=modis where="name LIKE 'MYD%LST_Day_1km'" output=modis_aqua_day
t.rast.extract input=modis where="name LIKE 'MYD%LST_Night_1km'" output=modis_aqua_night
t.info input=modis_terra_day

LST

Digital numbers (DN) need to be converted into Celsius scale as done in Unit 24. Instead of running r.mapcalc repeatedly there is a specialized temporal command t.rast.mapcalc which applies map algebra to all the maps registered in input space time dataset.

Tip

Many 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 maps will be created, the command requires to define basename. Note that new raster maps will be produced in the current computation region with mask respected.

t.rast.univar input=modis_c where="start_time > '2019-03-01' and start_time < '2019-04-01'"
id|start|end|mean|min|max|mean_of_abs|stddev|variance|coeff_var|sum|null_cells|cells
c_033@PERMANENT|2019-03-06 00:00:00|2019-03-14 00:00:00|8.38271624724276|-20.35|17.81|...

Color table for all the maps in a space time raster dataset can be set by t.rast.colors similarly as r.colors does for a single raster map.

t.rast.colors input=modis_c color=celsius

Data aggregation

The temporal framework enables a user to perform data aggregation by t.rast.aggregate. Based on specified granularity a new temporal dataset with aggregated data is created.

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 > '2019-07-01' and start_time < '2019-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 > '2019-03-01' and start_time < '2019-06-01'" \
output=modis_spring

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

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

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

Another aggregation method is based on t.rast.series, it allows to aggregate space time raster dataset or part of it by various methods. The module returns a single raster map as output. In example below average temperature for each seasons will be computed.

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

Univariate statistics of created raster map with average temperature values can be calculated by r.univar.

r.univar modis_spring_avg
minimum: -3.51545
maximum: 17.6643
range: 21.1797
mean: 10.7001
../_images/spring_avg.png

Fig. 121 Average temperature for spring 2019.

Data visualization

In addition to g.gui.timeline introduced in Unit 17 - Spatio-temporal intro there are other two GRASS tools for temporal data visualization: g.gui.animation (Temporal ‣ GUI tools ‣ Animation tool) and g.gui.tplot (Temporal ‣ GUI tools ‣ Temporal plot tool).

Tool g.gui.animation allows creating animations in different formats, the example below showing the monthly average values.

g.gui.animation strds=modis_cm
../_images/modis-animation.gif

Fig. 122 Monthly average dataset animation with celsius color table applied.