### Sidebar

spatial-ecology.org

Trainings:

Learn:

Data:

Community:
teachers
students
projects
Matera 2015
Vancouver 2015
Santa Barbara 2015
Site design
Hands on:
Installations

Donations
Spatial Ecology is a non profit organisation based in the UK. About us. Please help us in our activity
USD

GBP

wiki:exercise3a

# Exercise 3a: Study phenology from MODIS NDVI time series (forest vector)

In this exercise the following tools will be used:

• pktools: pkcreatect, pkndvi, pkgetmask, pkextract, pkstatogr
• bash: for loop, redirection (»)
• awk: basic

Create directory for this exercise

`mkdir -p \${OUTPUTDIR}/exercise3`

Remove old output

`rm -f \${OUTPUTDIR}/exercise3/forest_ndvi_mean_stdev.txt`

Extract NDVI time series from forest in Cornwall (mean value for each polygon)

```for MONTH in 01 02 03 04 05 06 07 08 09 10 11 12;do
echo "create NDVI image for month \$MONTH"
pkndvi -min 0 -max 100 -dst_s 100 -r ndvi -ot Byte -b 0 -b 1 -i \${MODIS250DIR}/2006\${MONTH}-MODIS250_CW.tif -o \${OUTPUTDIR}/exercise3/2006\${MONTH}-MODIS250_CW_NDVI.tif
echo "create NDVI mask (values smaller than 0.5 should not be forested)"
pkgetmask -i \${OUTPUTDIR}/exercise3/2006\${MONTH}-MODIS250_CW_NDVI.tif -o \${OUTPUTDIR}/exercise3/2006\${MONTH}-MODIS250_CW_MASK.tif -min 50 -max 100 -data 1 -nodata 0
rm -f \${OUTPUTDIR}/exercise3/forest_modis_\${MONTH}.shp
echo "extract NDVI for month \$MONTH"
pkextract -i \${OUTPUTDIR}/exercise3/2006\${MONTH}-MODIS250_CW_NDVI.tif -s \${OUTPUTDIR}/exercise1/cornwall_forest_3035.shp -m \${OUTPUTDIR}/exercise3/2006\${MONTH}-MODIS250_CW_MASK.tif -msknodata 0 -o \${OUTPUTDIR}/exercise3/forest_modis_\${MONTH}.shp -r mean -polygon -bn NDVI --ftype Integer
echo "calculate statistics using pkstatogr"
pkstatogr -i \${OUTPUTDIR}/exercise3/forest_modis_\${MONTH}.shp -n NDVI -mean -stdev| awk '{print \$4,\$6}' >> \${OUTPUTDIR}/exercise3/forest_ndvi_mean_stdev.txt
done```
wiki/exercise3a.txt · Last modified: 2020/07/17 06:39 (external edit)