Devoted to open data and open source in science and education.

View All Tutorials


LiDAR (7)
R programming (51)
Remote Sensing (12)
Data Visualization (4)
Hyperspectral Remote Sensing (7)
Hierarchical Data Formats (HDF5) (9)
Spatial Data & GIS (18)
Time Series (15)
Phenology (7)
Raster Data (8)
Vector Data (6)
Metadata (1)
Git & GitHub (6)
(1) (1)

Tutorial by R Package

dplyr (7)
ggplot2 (17)
h5py (1)
lubridate (time series) (6)
maps (1)
maptools (2)
plyr (2)
raster (26)
rasterVis (raster time series) (3)
rgdal (GIS) (22)
rgeos (3)
rhdf5 (11)
sp (5)
scales (4)
gridExtra (4)
ggtheme (0)
grid (2)
reshape2 (3)
plotly (5)

View ALL Tutorial Series

Twitter Youtube Github


R Bloggers



This activity will utilize the skills that you learned in the previous lessons. You will

  1. Import several rasters into R
  2. Perform raster math to calculate NDVI (Normalized Difference Vegetation Index)
  3. Create a color coded plot of NDVI
  4. Export the NDVI file as a georeferenced tiff.

What you'll need

  1. R or R studio loaded on your computer
  2. rgdal, raster, sp libraries installed on you computer.

Data to Download

Download NEON Teaching Data Subset: Field Site Spatial Data
These remote sensing data files provide information on the vegetation at the National Ecological Observatory Network's San Joaquin Experimental Range and Soaproot Saddle field sites. This data is intended for educational purposes, for access to all the data for research purposes visit the NEON Data Portal.

Recommended Reading

All of the topics and concepts you need to complete this capstone were covered in the links on this page.

Build Your Own Adventure!

The last hour of this workshop will be on your own! Please select one of the optional activities below to work on!

Option One - Create an HDF5 file

If you have some of your own data that you’d like to explore for this activity, feel free to do so. Otherwise, use the vegetation structure data that we’ve provided in the data downloads for this workshop.

  1. Create a new HDF5 file using the the SJER vegetation structure data D17_2013_vegStr.csv.
  2. Create two groups wtihin a California group:
    • one for the San Joaquin field site
    • one for the Soaproot saddle field site.
  3. Attribute each of the above groups with information about the field sites. HINT you can explore the < a href=”” target=_blank”> NEON field site page</a> for more information about each site. 4.Extract the vegetation structure data for San Joaquin and add it as a dataset to the San Joaquin group. Do the same for the Soaproot dataset.
  4. Add the plot centroids data to the SJER group. Include relevant attributes for this dataset including the CRS string, and any other metadata with the dataset.
  5. If there’s time, open the metadata file for the vegetation structure data. Attribute the structure dataset as you see fit to make it usable. As you do this, think about the following:

  6. Is there a better way to provide / store these metadata?
  7. Is there a way to automate adding the metadata to the H5 file?

Option Two - Calculate NDVI for the SJER field sites

The Normalized Difference Vegetation Index is calculated using the following equation: (NIR - Red) / (NIR + Red) where:

  1. NIR is the near infrared band in an image
  2. Red is the red band in an image.

Use the Red (Band 58 in the tiff files) and the NIR (band 90 in the tiff files) tiff files to

  1. Calculate NDVI in R.
  2. Plot NDVI. Make sure your plot has a title and a legend. Assign a colormap to the plot and specify the breaks for the colors to represent NDVI values that make sense to you. For instance, you might chose to color the data using breaks at .25,.5, .75 and 1.
  3. Expore your final NDVI dataset as a geotiff. Make sure the CRS is correct.
  4. To test your work, bring it into QGIS. Does it line up with the other tiffs (for example the band 19 tiff). Did it import properly?

Option Three - Guided – Working with Imagery in R

Work through the lesson on imagery in R.