This activity will utilize the skills that you learned in the previous lessons. You will
- Import several rasters into R
- Perform raster math to calculate NDVI (Normalized Difference Vegetation Index)
- Create a color coded plot of NDVI
- Export the NDVI file as a georeferenced tiff.
What you'll need
- R or R studio loaded on your computer
- rgdal, raster, sp libraries installed on you computer.
Data to DownloadNational 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 ReadingAll 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.
- Create a new HDF5 file using the the SJER vegetation structure data
- Create two groups wtihin a
- one for the San Joaquin field site
- one for the Soaproot saddle field site.
- Attribute each of the above groups with information about the field sites. HINT you can explore the < a href=”http://www.neonscience.org/science-design/field-sites/” 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.
- 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.
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:
- Is there a better way to provide / store these metadata?
- 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:
- NIR is the near infrared band in an image
- 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
- Calculate NDVI in R.
- 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.
- Expore your final NDVI dataset as a geotiff. Make sure the CRS is correct.
- 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?