Skip to content

Commit

Permalink
added template files
Browse files Browse the repository at this point in the history
  • Loading branch information
tracykteal committed Oct 22, 2015
1 parent 1e1556f commit 658543a
Show file tree
Hide file tree
Showing 77 changed files with 3,613 additions and 0 deletions.
95 changes: 95 additions & 0 deletions 00-Example-First-File-Name.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
---
layout: post
title: "Lesson Title Goes here"
date: 2015-1-26 20:49:52
authors: "FirstName LastName, FirstName LastName"
dateCreated: 2014-11-26 20:49:52
lastModified: 2015-07-23 14:28:52
category: time-series-workshop
tags: [module-1]
mainTag: GIS-Spatial-Data
description: "This post explains the fundamental principles, functions and metadata that you need to work with raster data in R."
code1:
image:
feature: lidar_GrandMesa.png
credit: LiDAR data collected over Grand Mesa, Colorado - National Ecological Observatory Network (NEON)
creditlink: http://www.neoninc.org
permalink: /R/Raster-Data-In-R/
code1: /R/2015-07-22-Introduction-to-Raster-Data-In-R.R
comments: true

---

<section id="table-of-contents" class="toc">
<header>
<h3>Contents</h3>
</header>
<div id="drawer" markdown="1">
* Auto generated table of contents
{:toc}
</div>
</section><!-- /#table-of-contents -->

##About
This activity will walk you through the fundamental principles of working
with raster data in R.

**R Skill Level:** Intermediate - you've got the basics of `R` down.

<div id="objectives">

<h3>Goals / Objectives</h3>
After completing this activity, you will know:
<ol>
<li>What a raster dataset is and its fundamental attributes.</li>
<li>How to import rasters into `R` using the raster library.</li>
<li>How to perform raster calculations in `R`.</li>
</ol>

<h3>Things You'll Need To Complete This Lesson</h3>

<h3>R Libraries to Install:</h3>
<ul>
<li><strong>raster:</strong> <code> install.packages("raster")</code></li>
<li><strong>rgdal:</strong> <code> install.packages("rgdal")</code></li>

</ul>
<h4>Tools To Install</h4>

Please be sure you have the most current version of `R` and preferably
R studio to write your code.


<h4>Data to Download</h4>

Download the raster and *in situ* collected vegetation structure data:
<ul>
<li><a href="http://neonhighered.org/Data/LidarActivity/CHM_InSitu_Data.zip" class="btn btn-success"> DOWNLOAD Sample NEON LiDAR data in Raster Format & Vegetation Sampling Data</a></li>
<li><a href="{{ site.baseurl }}/data/rasterLayers_tif.zip" class="btn btn-success"> DOWNLOAD NEON imagery data (tiff format) California Domain 17 (D17)</a></li>
</ul>

<p>The LiDAR and imagery data used to create the rasters in this dataset were
collected over the San Joaquin field site located in California (NEON Domain 17)
and processed at <a href="http://www.neoninc.org" target="_blank" >NEON </a>
headquarters. The entire dataset can be accessed by request from the NEON website.</p>

<h4>Recommended Pre-Lesson Reading</h4>
<ul>
<li>
<a href="{{ site.baseurl }}/GIS-Spatial-Data/Working-With-Rasters/" target="_blank">
The Relationship Between Raster Resolution, Spatial extent & Number of Pixels - in R</a>
</li>
<li>
<a href="http://cran.r-project.org/web/packages/raster/raster.pdf" target="_blank">
Read more about the `raster` package in R.</a>
</li>
</ul>
</div>

#About Raster Data
Raster or "gridded" data are data that are saved in pixels. In the spatial world,
each pixel represents an area on the Earth's surface. For example in the raster
below, each pixel represents a particular land cover class that would be found in
that location in the real world.
<a href="{{ site.baseurl }}/GIS-Spatial-Data/Working-With-Rasters/"> More on
rasters here</a>.
2 changes: 2 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# NEON-DC-DataLesson-Hackathon
A repo for the spatio-temporal data lesson hackathon.
95 changes: 95 additions & 0 deletions RMarkdownTemplate.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
---
layout: post
title: "Lesson Title Goes here"
date: 2015-1-26 20:49:52
authors: "FirstName LastName, FirstName LastName"
dateCreated: 2014-11-26 20:49:52
lastModified: 2015-07-23 14:28:52
category: time-series-workshop
tags: [module-1]
mainTag: GIS-Spatial-Data
description: "This post explains the fundamental principles, functions and metadata that you need to work with raster data in R."
code1:
image:
feature: lidar_GrandMesa.png
credit: LiDAR data collected over Grand Mesa, Colorado - National Ecological Observatory Network (NEON)
creditlink: http://www.neoninc.org
permalink: /R/Raster-Data-In-R/
code1: /R/2015-07-22-Introduction-to-Raster-Data-In-R.R
comments: true

---

<section id="table-of-contents" class="toc">
<header>
<h3>Contents</h3>
</header>
<div id="drawer" markdown="1">
* Auto generated table of contents
{:toc}
</div>
</section><!-- /#table-of-contents -->

##About
This activity will walk you through the fundamental principles of working
with raster data in R.

**R Skill Level:** Intermediate - you've got the basics of `R` down.

<div id="objectives">

<h3>Goals / Objectives</h3>
After completing this activity, you will know:
<ol>
<li>What a raster dataset is and its fundamental attributes.</li>
<li>How to import rasters into `R` using the raster library.</li>
<li>How to perform raster calculations in `R`.</li>
</ol>

<h3>Things You'll Need To Complete This Lesson</h3>

<h3>R Libraries to Install:</h3>
<ul>
<li><strong>raster:</strong> <code> install.packages("raster")</code></li>
<li><strong>rgdal:</strong> <code> install.packages("rgdal")</code></li>

</ul>
<h4>Tools To Install</h4>

Please be sure you have the most current version of `R` and preferably
R studio to write your code.


<h4>Data to Download</h4>

Download the raster and *in situ* collected vegetation structure data:
<ul>
<li><a href="http://neonhighered.org/Data/LidarActivity/CHM_InSitu_Data.zip" class="btn btn-success"> DOWNLOAD Sample NEON LiDAR data in Raster Format & Vegetation Sampling Data</a></li>
<li><a href="{{ site.baseurl }}/data/rasterLayers_tif.zip" class="btn btn-success"> DOWNLOAD NEON imagery data (tiff format) California Domain 17 (D17)</a></li>
</ul>

<p>The LiDAR and imagery data used to create the rasters in this dataset were
collected over the San Joaquin field site located in California (NEON Domain 17)
and processed at <a href="http://www.neoninc.org" target="_blank" >NEON </a>
headquarters. The entire dataset can be accessed by request from the NEON website.</p>

<h4>Recommended Pre-Lesson Reading</h4>
<ul>
<li>
<a href="{{ site.baseurl }}/GIS-Spatial-Data/Working-With-Rasters/" target="_blank">
The Relationship Between Raster Resolution, Spatial extent & Number of Pixels - in R</a>
</li>
<li>
<a href="http://cran.r-project.org/web/packages/raster/raster.pdf" target="_blank">
Read more about the `raster` package in R.</a>
</li>
</ul>
</div>

#About Raster Data
Raster or "gridded" data are data that are saved in pixels. In the spatial world,
each pixel represents an area on the Earth's surface. For example in the raster
below, each pixel represents a particular land cover class that would be found in
that location in the real world.
<a href="{{ site.baseurl }}/GIS-Spatial-Data/Working-With-Rasters/"> More on
rasters here</a>.
90 changes: 90 additions & 0 deletions Rakefile.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
require "rubygems"
require "bundler/setup"
require "stringex"

## -- Config -- ##

posts_dir = "_lessons" # directory for blog files
new_post_ext = "md" # default new post file extension when using the new_post task
new_page_ext = "md" # default new page file extension when using the new_page task


#############################
# Create a new Post or Page #
#############################

# usage rake new_post
desc "Create a new post in #{posts_dir}"
task :new_post, :title do |t, args|
if args.title
title = args.title
else
title = get_stdin("Enter a title for your post: ")
end
filename = "#{posts_dir}/#{Time.now.strftime('%Y-%m-%d')}-#{title.to_url}.#{new_post_ext}"
if File.exist?(filename)
abort("rake aborted!") if ask("#{filename} already exists. Do you want to overwrite?", ['y', 'n']) == 'n'
end
category = get_stdin("Enter category name to group your post in (leave blank for none): ")
tags = get_stdin("Enter tags to classify your post (comma separated): ")
puts "Creating new post: #{filename}"
open(filename, 'w') do |post|
post.puts "---"
post.puts "layout: post"
post.puts "title: \"#{title.gsub(/&/,'&amp;')}\""
post.puts "modified: #{Time.now.strftime('%Y-%m-%d %H:%M:%S %z')}"
post.puts "category: [#{category}]"
post.puts "tags: [#{tags}]"
post.puts "image:"
post.puts " feature: "
post.puts " credit: "
post.puts " creditlink: "
post.puts "comments: "
post.puts "share: "
post.puts "---"
end
end

# usage rake new_page
desc "Create a new page"
task :new_page, :title do |t, args|
if args.title
title = args.title
else
title = get_stdin("Enter a title for your page: ")
end
filename = "#{title.to_url}.#{new_page_ext}"
if File.exist?(filename)
abort("rake aborted!") if ask("#{filename} already exists. Do you want to overwrite?", ['y', 'n']) == 'n'
end
tags = get_stdin("Enter tags to classify your page (comma separated): ")
puts "Creating new page: #{filename}"
open(filename, 'w') do |page|
page.puts "---"
page.puts "layout: page"
page.puts "permalink: /#{title.to_url}/"
page.puts "title: \"#{title}\""
page.puts "modified: #{Time.now.strftime('%Y-%m-%d %H:%M')}"
page.puts "tags: [#{tags}]"
page.puts "image:"
page.puts " feature: "
page.puts " credit: "
page.puts " creditlink: "
page.puts "share: "
page.puts "---"
end
end

def get_stdin(message)
print message
STDIN.gets.chomp
end

def ask(message, valid_options)
if valid_options
answer = get_stdin("#{message} #{valid_options.to_s.gsub(/"/, '').gsub(/, /,'/')} ") while !valid_options.include?(answer)
else
answer = get_stdin(message)
end
answer
end
Loading

0 comments on commit 658543a

Please sign in to comment.