Event
Spatio-Temporal Workshop
Apr 12-13, 2016
Hosted By:
NEON & DATA CARPENTRY
This two day workshop, taught at the USGS National Training Center at the Federal Center in Denver, CO on April 12-13, 2016, will cover how to work with spatio-temporal data in R.
Things You’ll Need To For The Workshop
Software
R & RStudio
To participant in this workshop, you will need a laptop with the most current version of R, and, preferably, RStudio loaded on your computer. You will also need the bash shell installed
If you already have these installed on your laptop, please be sure that you are running the most current version of RStudio, R and all packages that we'll be using in the workshop (listed below).
For details on installing RStudio in Mac, PC, or Linux operating systems, please see the Additional Set Up Instructions section at the bottom of this page.
Bash shell
You will need bash shell to complete this workshop. If you use a Mac, this is the default shell ("Terminal") on your computer. If you use a PC or Linux operating system you may need to install it. For complete installation instructions, please see the Additional Set Up Instructions section below.
Download Data
To be prepared for this workshop, please download & unzip the following files in advance:
NEON Teaching Data Subset: Site Layout Shapefiles
These vector data provide information on the site characterization and infrastructure at the National Ecological Observatory Network's Harvard Forest field site. The Harvard Forest shapefiles are from the Harvard Forest GIS & Map archives. US Country and State Boundary layers are from the US Census Bureau.
NEON Teaching Data Subset: Airborne Remote Sensing Data
The LiDAR and imagery data used to create this raster teaching data subset were collected over the National Ecological Observatory Network's Harvard Forest and San Joaquin Experimental Range field sites and processed at NEON headquarters. The entire dataset can be accessed by request from the NEON Data Portal.
NEON Teaching Data Subset: Landsat-derived NDVI raster files
The imagery data used to create this raster teaching data subset were collected over the National Ecological Observatory Network's Harvard Forest and San Joaquin Experimental Range field sites.
The imagery was created by the U.S. Geological Survey (USGS) using a multispectral scanner on a Landsat Satellite. The data files are Geographic Tagged Image-File Format (GeoTIFF).
Optional: you can download the global boundary files below if you wish to follow along with the data management demonstration on Coordinate Reference Systems.
-
Download "land" - Natural Earth Global Continent Boundary Layer
-
Download all Graticules - Natural Earth Global Graticules Layer
So that your code will mirror that of the instructors, your R working directory should be set to a parent directory data that contains all of the above data files (unzipped). For complete directions, please see the Additional Set Up Instructions section below.
Install R Packages
You can chose to install each library individually if you already have some installed.
- raster:
install.packages("raster")
- rasterVis:
install.packages("rasterVis")
- ggplot2:
install.packages("ggplot2")
- sp:
install.packages("sp")
- rgeos
install.packages
("rgeos") - rgdal (windows):
install.packages("rgdal")
- rgdal (mac):
install.packages("rgdal",configure.args="--with-proj-include=/Library/Frameworks/PROJ.framework/unix/include --with-gdal-config=/Library/Frameworks/GDAL.framework/unix/bin/gdal-config --with-proj-lib=/Library/Frameworks/PROJ.framework/unix/lib")
Optional installation If you want to work through the metadata lesson which includes a section on the Ecological Metadata Language (EML), please install the following:
- devtools:
install.packages("devtools")
- eml
install_github("ropensci/EML", build=FALSE, dependencies=c("DEPENDS", "IMPORTS"))
NOTE: You have to run the devtools librarylibrary(devtools)
first, and theninstall_github
will work the EML package is under development which is why the install occurs from GitHub and not can!
Update R Packages
In RStudio, you can go to Tools --> Check for package updates
to update already installed libraries on your computer! Or, you can use update.packages()
to update all packages that are installed in R automatically.
Workshop Instructors
- Leah Wasser; @leahawasser; Supervising Scientist, NEON
- Megan A. Jones; @meganahjones; Staff Scientists/Science Educator, NEON
- Natalie Robinson; Staff Scientist, NEON
Please get in touch with the instructors prior to the workshop with any questions.
Twitter?
Please tweet @NEON_sci and with the #WorkWithData hashtag during the workshop.
Schedule
Please note that the schedule listed below may change depending upon the pace of the workshop!
Day One
Time | Topic |
---|---|
8:00 | Please come early if you have any setup or installation problems |
9:00 | Geospatial Data Management - Intro to Geospatial Concepts |
10:30 | --------- BREAK --------- |
10:45 | Data Management: Coordinate Reference Systems |
12:00 | --------- Lunch --------- |
1:00 | Vector Data in R |
2:30 | --------- BREAK --------- |
2:45 | Vector Data in R, continued |
4:15 | Wrap-Up Day 1 |
Day Two
Time | Topic |
---|---|
9:00 | Questions From Day One |
9:15 | Getting Started with Raster Data in R |
10:30 | --------- BREAK --------- |
10:45 | Getting Started with Raster Data in R, continued |
12:00 | --------- Lunch --------- |
1:00 | Multi-band Raster & Raster Time Series Data in R |
2:30 | --------- BREAK --------- |
2:45 | Multi-band Raster & Raster Time Series Data in R, continued |
4:15 | Wrap-Up Day Two! |
Additional Set Up Resources
Setting Up R & RStudio
Windows R/RStudio Setup
- Download R for Windows here
- Run the .exe file that was just downloaded
- Go to the RStudio Download page
- Under Installers select RStudio X.XX.XXX - Windows Vista/7/8/10
- Double click the file to install it
Once R and RStudio are installed, click to open RStudio. If you don't get any error messages you are set. If there is an error message, you will need to re-install the program.
Mac R/RStudio Setup
- Go to CRAN and click on Download R for (Mac) OS X
- Select the .pkg file for the version of OS X that you have and the file will download.
- Double click on the file that was downloaded and R will install
- Go to the RStudio Download page
- Under Installers select RStudio 0.98.1103 - Mac OS X XX.X (64-bit) to download it.
- Once it's downloaded, double click the file to install it
Once R and RStudio are installed, click to open RStudio. If you don't get any error messages you are set. If there is an error message, you will need to re-install the program.
Linux R/RStudio Setup
- R is available through most Linux package managers. You can download the binary files for your distribution from CRAN. Or you can use your package manager (e.g. for Debian/Ubuntu run
sudo apt-get install r-base
and for Fedora runsudo yum install R
). - To install RStudi, go to the RStudio Download page
- Under Installers select the version for your distribution.
- Once it's downloaded, double click the file to install it
Once R and RStudio are installed, click to open RStudio. If you don't get any error messages you are set. If there is an error message, you will need to re-install the program.
Set Working Directory to Downloaded Data
1) Download Data
After clicking on the Download Data button, the data will automatically download to the computer.
2) Locate .zip file
Second, find the downloaded .zip file. Many browsers save downloaded files to your computer’s Downloads directory. If you have previously specified a specific directory (folder) for downloaded files, the .zip file will download there.
3) Move to **data** directory
Third, move the downloaded file to a directory called data within the Documents directory on your computer. You can choose to place the data in other locations, however, you will need to remember to set your R Working Directory to that location and not as we demonstrate in the workshop.
4) Unzip/uncompress
Fourth, we need to unzip/uncompress the file so that the data files can be accessed. Use your favorite tool that can unpackage/open .zip files (e.g., winzip, Archive Utility, etc). The files will now be accessible in three directories:
These directories contain all of the subdirectories and files that we will use in this workshop.
5) Set working directory
Fifth, we need to set the working directory in R to this data directory that is parent to the directories containing the data we want. For complete directions, on how to do that check out the Set A Working Directory in R tutorial.
GDAL installation for MAC
You may need to install GDAL in order for rgdal to work properly. Click here to watch a video on installing gdal using homebrew on your Mac. Or, you can visit this link to install GDAL 1.11 complete.
Location:
TBD