NEON EDUCATION bio photo

NEON EDUCATION

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

View All Tutorials

Tags

R programming (52)
Hierarchical Data Formats (HDF5) (11)
Spatial Data & GIS (22)
LiDAR (7)
Raster Data (11)
Remote Sensing (11)
Data Visualization (4)
Hyperspectral Remote Sensing (7)
Time Series (15)
Phenology (7)
Vector Data (6)
Metadata (1)
Git & GitHub (6)
(1) (1)

Tutorial by R Package

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

View ALL Tutorial Series




Twitter Youtube Github


Blog.Roll

R Bloggers
Date(s): Mar 15 - Mar 16, 2016

Click here to visit workshop Etherpad

Click here to view workshop schedule.

Things You’ll Need To For The Workshop

Download Data

To be prepared for this workshop, please download the following files in advance:

Download 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.

Download 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 Airborne Data Request Page on the NEON website.

Download 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 lesson on Coordinate Reference Systems.

Download “land” - Natural Earth Global Continent Boundary Layer

Download all Graticules - Natural Earth Global Graticules Layer


Once you have downloaded the data, setup your working directory. Click here to view working directory setup.


Software Installation

Next, you will need: access to the software described below (R, R studio, required R packages and Bash). In addition, you will need an up-to-date web browser.

Install R & R Studio

To participate in the workshop, we recommend that you come with R and RStudio installed. R is a programming language that specializes in statistical computing. It is a powerful tool for exploratory data analysis. To interact with R, we STRONGLY recommend RStudio, an interactive development environment (IDE).

If You Already Have R/RStudio Installed – please update

If you already have R / RStudio installed on your laptop, please be sure that you are running the most current version of R-Studio, R AND all packages that we’ll be using in the workshop (listed below).

If you don’t have R / Rstudio installed - Please follow the instructions below:


Install R Packages

You can chose to install each library individually if you already have some installed.

  • raster: install.packages("raster")
  • 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")
  • rasterVis: install.packages("rasterVis")
  • ggplot2: install.packages("ggplot2")
  • sp: install.packages("sp")
  • rgeos install.packages(“rgeos”)

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")

NOTE: You have to run the devtools library library(devtools) first, and then install_github will work. the EML package is under development which is why the install occurs from GitHub and not can!

  • eml install_github("ropensci/EML", build=FALSE, dependencies=c("DEPENDS", "IMPORTS"))

Make Sure R Packages Are Current

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.

More on Packages in R. ***

Install Bash

Bash is a commonly-used shell that gives you the power to do simple tasks more quickly.

We maintain a list of common issues that occur during installation as a reference for instructors that may be useful on the Configuration Problems and Solutions wiki page.

If you don’t have Bash installed - Please follow the instructions below:

Workshop Instructors

  • Leah Wasser; @leahawasser, Supervising Scientist, NEON, Inc
  • Michael Heeremans
  • Anne Claire Fouilloux
  • Arnstein Orten
  • Hans Peter Verne

Please get in touch with the instructors prior to the workshop with any questions.

#WorkWithData Hashtag

Please tweet using the hashtag: #WorkWithData

SCHEDULE

Please note that the schedule listed below may change depending upon the pace of the workshop!

Day One

Time Topic Instructor
8:00 Please come early if you have any setup / installation issues  
9:00 The Shell - command line for data exploration Michael, Anne
10:30 ——- Coffee / Tea BREAK ——-  
10:45 Data Management: Spatial Data Formats Michael
11:30 Data Management: Coordinate Reference Systems Michael
12:00 - 1:00 PM Lunch  
1:00 Introduction to Vector Data in R Leah
3:00 ——- BREAK ——-  
3:15 Introduction to Vector Data in R Leah
4:45 Wrap-Up Day 1  

Day Two

Time Topic Instructor
9:00 Questions From Previous Day  
9:15 Getting Started with Raster Data in R Leah
10:30 —— BREAK ——  
10:45 Getting Started with Raster Data in R Leah
12:00 - 1:00 PM Lunch  
1:00 - 1:30 PM Data Management: Understanding Metadata Michael
1:00 Raster Time Series Data in R Leah
3:00 —— BREAK ——  
3:15 Raster Time Series Data in R Leah
4:45 Wrap-Up Day Two!  

Additional Set Up Instructions

Windows R/RStudio Setup

Once R and R studio are installed, open RStudio to make sure it works and you don’t get any error messages.

Mac R/RStudio Setup

  • If your Mac is set up for UiO use, you can install R from Managed Software Center

  • 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 10.6+ (64-bit) to download it.
  • Once it’s downloaded, double click the file to install it

Once R and R studio are installed, open RStudio to make sure it works and you don’t get any error messages.

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 run sudo 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 R studio are installed, open RStudio to make sure it works and you don’t get any error messages.


Bash/Shell Setup

Install Bash for Windows

  1. Download the Git for Windows installer.
  2. Run the installer and follow the steps bellow:
    1. Click on "Next".
    2. Click on "Next".
    3. Click on "Next".
    4. Click on "Next".
    5. Click on "Next".
    6. Select "Use Git from the Windows Command Prompt" and click on "Next". If you forgot to do this programs that you need for the workshop will not work properly. If this happens rerun the installer and select the appropriate option.
    7. Click on "Next". Keep "Checkout Windows-style, commit Unix-style line endings" selected.
    8. Select "Use Windows' default console window" and click on "Next".
    9. Click on "Next".
    10. Click on "Finish".

This will provide you with both Git and Bash in the Git Bash program.

Install Bash for Mac OS X

The default shell in all versions of Mac OS X is bash, so no need to install anything. You access bash from the Terminal (found in /Applications/Utilities). You may want to keep Terminal in your dock for this workshop.

Install Bash for Linux

The default shell is usually Bash, but if your machine is set up differently you can run it by opening a terminal and typing bash. There is no need to install anything.


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.


Set Working Directory

1) Download Data

First, download the data linked in the blue buttons above.

  • NEON Teaching Data Subset: Site Layout Shapefiles
  • NEON Teaching Data Subset: Airborne Remote Sensing Data
  • NEON Teaching Data Subset: Landsat NDVI
Screenshot of the Data that you should download, prior to the workshop. Source: National Ecological Observatory Network (NEON)

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 default to downloading to the Downloads directory on your computer. Note: You may have previously specified a specific directory (folder) for files downloaded from the internet, if so, the .zip file will download there.

3) Move to data directory

Third, move the data files to a directory called data directory within the Documents directory on your computer. If you have other files in this data directory, you may decide to create a sub-directory in your data directory called spatial-workshop. However you set it up, your final working directory should look similar to the graphic below.

Screenshot of the computer's Downloads folder containing the new NEONDSMetTimeSeries.zip file. Source: National Ecological Observatory Network (NEON)

Note that the “Global/boundaries” directory is optional! If you downloaded the optional global layers, we suggestion you place them in a directory called Global/boundaries.

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:

  • NEON-DS-Airborne-Remote-Sensing
  • NEON-DS-Landsat-NDVI
  • NEON-DS-Site-Layout-Files

These directories contain all of the subdirectories and files that we will use in this workshop.

We will set up an R-Studio project within this working directory. Read more about R-Studio projects, here. In R studio, your working directory space will look like this:

Your working directory in R should look like the above image. It is OK if you don't have the "Global" directory setup. The data in this directory is OPTIONAL to download.

NOTE: we will setup an OSLO2015.Rproj file together at the beginning of the workshop.