Manipulation and visualization of WELD single pixel time series

The WELD product WYSIWYG web distribution interface (http://weld.cr.usgs.gov/) allows selection and ordering of a single 30m pixel time series.

The time series is provided via e-mail in a simple comma separated text format with the relevant WELD band scale factors and offsets already applied.

Set your working directory:

DIR=/home/user/ost4sem/exercise/weld_data_processing/pixel_time_series
cd $DIR

We can check that this Linux variable is correct by typing: echo $DIR

In this exercise pixels falling in burned and unburned areas of the Anaktuvuk River Fire, that occurred September 2007 in a Tundra region of the Alaskan North Slope, are selected:


To save time, we have pre-download two email orders for 9 year time series extracted from weekly WELD products from 2003 to 2011. Two orders, one for the burned pixel and one for the unburned pixel (locations illustrated above), are stored at /home/user/ost4sem/exercise/weld_data_processing/pixel_time_series/

Examine the times series:

The time series are provided via e-mail in a simple comma separated text (ASCII) format with the relevant WELD band scale factors and offsets already applied. Each row defines the 14 WELD band values for the pixel for a given year and date, the WELD FILL values (no data values) in any band are designated with a pixel value of -32768. For example:



We can examine the first 8 lines of the unburned pixel file as:

head -8 $DIR/weld.alaska.timeseries.weekly.h06v02.long-150.351113.lat69.179178.v1.5.txt

We can examine the first 12 lines of the burned pixel file as:

head -12 $DIR/weld.alaska.timeseries.weekly.h06v02.long-150.583834.lat69.124245.v1.5.txt


Extract values to make NDVI time series plots:

The Normalized Difference Vegetation Index (NDVI) is the most commonly used spectral band index and is positively correlated with vegetation greeness. We will make a simple NDVI time series plot for the unburned and burned pixels. To do this we will extract the “Year”, “Day_Of_Year”, and “NDVI” values from each file using the awk command and we will ensure that we do not extract dates with NDVI FILL values (-32768). The “Year”, “Day_Of_Year”, and “NDVI” values are stored in columns 1, 2 and 11 of each file and so this extraction can be done as:

awk '{gsub(","," "); if($11!=-32768){ print$1,$2,$11}}' $DIR/weld.alaska.timeseries.weekly.h06v02.long-150.351113.lat69.179178.v1.5.txt | sort -k 1,1 -k 2,2 -g > $DIR/week_ndvi_unburned.txt

 
awk '{gsub(","," "); if($11!=-32768){ print$1,$2,$11}}' $DIR/weld.alaska.timeseries.weekly.h06v02.long-150.583834.lat69.124245.v1.5.txt | sort -k 1,1 -k 2,2 -g > $DIR/week_ndvi_burned.txt

To examine the time series you made:

head -10 week_ndvi_unburned.txt week_ndvi_burned.txt

Note, you could also use the “DT_Cloud_State” and “ACCA_State” and “Saturation_Flag” pixel values to remove cloudy and saturated pixel observations with an awk if condition (check out AWK language). We cover this in the “Burned Area Mapping using Support Vector Machine and Combined Segmentation Random Forest classifiers” training later on.

Make NDVI time series plots:

We will make the plots using the R software package.

To enter R type:

R

If you enter R correctly, you will see several lines that describe the version of R you have and how to search for help in R.
The symbol ”>” is the R terminal prompt where you can type R commands.

R script for plotting WELD time series:

############## import the two files #######################
 

week_ndvi_burned    <- read.delim("/home/user/ost4sem/exercise/weld_data_processing/pixel_time_series/week_ndvi_burned.txt", header = TRUE , sep = " " )
week_ndvi_unburned <- read.delim("/home/user/ost4sem/exercise/weld_data_processing/pixel_time_series/week_ndvi_unburned.txt", header = TRUE , sep = " "  )

 
############## create equal interval for the x axis (time) for the unburned and the burned pixels #####################
 
week_ndvi_burned$xlab <- as.integer(((week_ndvi_burned$Day_Of_Year/365)+(week_ndvi_burned$Year-2003))*1000)

week_ndvi_unburned$xlab  <- as.integer(((week_ndvi_unburned$Day_Of_Year/365)+(week_ndvi_unburned$Year-2003))*1000)
 
############ plot burned pixel NDVI time series #######################

 
jpeg("/home/user/ost4sem/exercise/weld_data_processing/pixel_time_series/plot_ndvi_burned.jpg", width=1500, height=600)
par(mar=c(2, 4.5, 4, 2), oma=c(3, 3, 2, 2))

plot(week_ndvi_burned$xlab, week_ndvi_burned$NDVI_TOA, cex.main=2, cex.lab=1.5, cex.axis=1.5, ylab="TOANDVI", xlab="", xaxt="n", pch=19, ylim=c(0, 0.80))

 
axis(1, at=week_ndvi_burned$xlab, lab=FALSE, lwd.ticks=1)
axis(1,  at=seq(0,10000,1000) , lab=FALSE, lwd.ticks=3)

axis(1, at=seq(500,8500,1000) , lab=unique(week_ndvi_burned$Year), tick=FALSE, line=1, cex.axis=1.5)

 
mtext("Year", side=1, at=4000, 3.5, cex=1.5)
dev.off()

 
########## plot unburned pixel NDVI time series #######################
 
jpeg("/home/user/ost4sem/exercise/weld_data_processing/pixel_time_series/plot_ndvi_unburned.jpg", width=1500, height=600)
par(mar=c(2, 4.5, 4, 2), oma=c(3, 3, 2, 2))

plot(week_ndvi_unburned$xlab, week_ndvi_unburned$NDVI_TOA, cex.main=2, cex.lab=1.5, cex.axis=1.5, ylab="TOANDVI", xlab="", xaxt="n", pch=19, ylim=c(0, 0.80))

 
axis(1, at=week_ndvi_unburned$xlab, lab=FALSE, lwd.ticks=1)
axis(1, at=seq(0,10000,1000), lab=FALSE, lwd.ticks=3)

axis(1, at=seq(500,8500,1000), lab=unique(week_ndvi_unburned$Year), tick=FALSE, line=1, cex.axis=1.5)

 
mtext("Year", side=1, at=4000, 3.5, cex=1.5)
dev.off()

Now close R (do not save the workspace image when prompted, just type “n”):

q()


You can simply click on the folder /home/user/ost4sem/exercise/weld_data_processing/pixel_time_series and then click on plot_ndvi_burned.jpg and plot_ndvi_unburned.jpg to see the stored images.

NDVI time series of the burned pixel


plot_ndvi_burned.jpg


In September 2007 the fire occurred and it is possible to see a drop in the NDVI values and then recovery/regeneration of the vegetation in the following years.

NDVI time series of the unburned pixel


plot_ndvi_no_burned.jpg

This web site is hosted at the Geographic Information Science Center of Excellence (GIScCE), South Dakota State University.
The contents of this web site were written by the GIScCE WELD staff. This site was last updated December 3rd 2012.