# Spectral-temporal metrics

## Learning goals

• Exploring the spectral-temporal characteristics of pastures and croplands in the Brazilian Amazon.
• Generate spectral-temporal metrics from an intra-annual time series of Tasseled Cap components.
• Map post-deforestation land use in deforested areas.

## Background

Understanding post-deforestation land use is essential to disentangle the drivers of deforestation. In the study region of last session, intensive agriculture and cattle ranching are the dominant land uses on deforested lands.

From a remote sensing perspective, separating cropland and grassland is challenging due to similar spectral signatures in most periods of the year. In selected periods however, differences in land surface phenology become apparent. We can investigate these differences by creating an intra-annual time series of Tasseled Cap Greenness (TCG).

Let´s investigate differences between pastures and croplands over time. We collected 50 reference samples for pastures and 50 for cropland in the study region. We then extract the TCG value for all those locations in each of the time series bands. In a next step, we can create class-wise boxplots for each observation date. The boxplots reveal the land surface dynamics for each class.

Can you identify differences between the classes? Looking at the above graph suggests that croplands have a somewhat higher variability throughout the year, but on average, pastures show a slightly higher TCG. We can try to verify this by calculating descriptive statistics of all TCG observations in the year and then comparing those between the classes. Let´s take a look at the maximum, mean, minimum, and standard deviation of TCG throughout 2010.

We can see that these “temporal statistics” can be useful to discriminate the two spectrally similar classes. Features combining the spectral appearance of a surface with its behaviour over time are increasingly popular in the remote sensing community. We refer to such features as spectral-temporal metrics (STM). STM are descriptive statistics of the spectral behaviour over time. They provide an efficient means to capture seasonal variations of land surface dynamics, while reducing the impact of clouds and cloud-shadows as well as reducing the dimensionality of dense time series. STM can be calculated from indices such as the NDVI or TC components, but also directly from the spectral bands.

Different metrics might be more or less useful depending on the application. Good process understanding is key in finding out which STM are relevant for the problem at hand. We should decide on the type of spectral information and a set of statistics (metrics) to compute. Providing such information to a classifier can enable the production of thematically detailed land cover maps over large areas, such as a pan-European land cover map.

## Assignment

In this assignment you will map pastures and croplands in deforested areas of the Brazilian Amazon. You will use and generate spectral-temporal metrics to separate these two land covers which are difficult to discriminate using single images. The resulting map enables you to determine which land use is primarily replacing forests in the region.

We provide the following data in our repository:

1. …ts_stacks/: cloud-masked stacks of TC brightness (TCB), TC greenness (TCG), TC wetness (TCW) derived from 30 Landsat images acquired throughout 2010. Observation dates and sensors for each band in the stacks are listed in *.csv file.

2. …spectemp/: eight spectral-temporal metrics for TCB, TCG and TCW:

• min, max, mean: minimum, maximum and mean value
• p25, p50, p75: 25%, 50%, 75% percentile values
• iqr: interquartile-range (25%-75%)
• std: standard deviation
3. …vector/: a shapefile and *.kmz file with the study area and pixel extents.

4. ….TerraClass2010/: the TerraClass 2010 map product and a corresponding QGIS layer style file which contains the class catalogue.

5. …training/: a set of points to explore the spectral-temporal behaviour of your classes and to train your classification model.

6. …validation/: a set of points to assess the accuracy of your final classification.

### 1) Inspect the input data

Open a new QGIS project and inspect the spectral-temporal metrics. Choose one indicator (e.g. Tasseled Cap Greenness) and load all layers. Make sure you understand what the metrics represent and discuss their meaning, robustness (e.g. against cloud contamination), and behavior over different land cover types within your group.

Feel free to use the RasterDataPlotting QGIS plugin for advanced visualization of scatterplots. Here you can interactively select spectral regions of interest within the scatterplot which are then highlighted in your map canvas, or vice versa.

### 2) Assess suitability of spectral-temporal metrics

We provide a shapefile with training points for the following classes

classID Class
1 Pasture
2 Cropland
3 Others

The below graph visualizes the TC brightness, greenness, and wetness values at the training locations for each band in the temporal stacks (e.g., …/ts_stacks/TCG.tif).

Compare the temporal behavior of the two classes, identify the main characteristics and differences. Please record your insights as comments in your script. Select spectral-temporal metrics that you believe capture the differences between croplands and pastures well. Select at most six different metrics from the ones provided.

### 3) Compute additional spectral-temporal metrics

Let´s generate two additional spectral-temporal metrics from the time series stacks. First, answer the following conceptual questions:

1. Which temporal subset of your time series highlights the seasonal differences between croplands and pastures best (e.g. ‘dry season’, ‘third quarter’ or ‘August’)?

2. Which statistics provide a high information content? Your metrics can be for instance additional percentiles, information on the timing of specific events, such as the observation date of the minimum value, or differences between metrics. Be creative!

Now the practical part. A number of summarizing functions can be applied directly to raster stacks (mean(), max(), min(), range()). If you want to calculate metrics other than those, you need to convert your raster stack into a matrix using as.matrix(). The below figure helps to understand how a three-dimensional raster stack is being transformed into a two-dimensional matrix.

Based on the resulting matrix, you can create temporal subsets by selecting the desired columns, and perform basic calculations using, e.g., apply(). You can then write the results back into a new raster, which you create using raster() and assign the results of your computation with the vals parameter.

The following code template gives an example for computing the median Tasseled Cap Greenness. Computation might take several minutes - make use of the processing time by preparing the subsequent tasks.

# Read TCG time series stack
tcg_stack <- stack('course.dir/S08/data/ts_stacks/TCG_stack.tif')

# Convert to matrix
tcg_matrix <- as.matrix(tcg_stack)

# Calculate median across rows in matrix
tcg_median <- apply(tcg_matrix, 1, FUN=median, na.rm=T)

# Write results to empty raster
tcg_median_raster <- raster(nrows=tcg_stack@nrows,
ncols=tcg_stack@ncols,
crs=tcg_stack@crs,
vals=tcg_median,
ext=extent(tcg_stack))

# Plot result
plot(tcg_median_raster)

### 4) Classify post-deforestation land use

1. Train a RF or SVM model based on your selected and computed spectral-temporal metrics. As always, make an informed decision about the model parameters.

2. Produce a map using your model and mask() the result with last week´s forest map, so only non-forest areas in 2010 are left. Write the result to disk using the appropriate datatype.

### 5) Accuracy assessment and area estimates

1. Assess the accuracy of the map using the validation data we provided. Run an additional iteration using different metrics in case you are not satisifed with your results.

2. Combine the resulting map with your forest change map from last week to get a better insight into the land change processes of the study area. Calculate the fractions of deforested land occupied by pasture or cropland for each of the two time periods. Was forest primarily replaced by pastures or by cropland? Did this process change over the periods 2001-2005 and 2006-2010? Please enter your main results in this table. ——