Skip to content

eco-data-science/climateR-intro

 
 

Repository files navigation

Gridded climate data with R

These notes are prepared for the UCSB ecodata science club. The goal is to introduce the concepts of gridded climate data, the process for remote data access, and workflows for easy data retrieval in R. Specifically, we will cover the following:


1. Multi-diminsional raster data model:





2. Concepts & workflows for ingesting subsets of remote climate data





3. Example Implementations

The simplest example would answer a question like:

“What was the temperture and rainfall rate in Florida on Janury 1st-3rd, 2010?”

library(AOI)
library(climateR)
library(rasterVis)

AOI  <- aoi_get(state = "FL")

rain <-  getGridMET(AOI, 
                  param = c("prcp", "tmax"), 
                  startDate = "2010-01-01", 
                  endDate = "2010-01-03")

levelplot(rain$prcp, par.settings = BTCTheme, main = "Rainfall (mm)")
levelplot(rain$tmax, par.settings = BuRdTheme, main = "Maximum Temperture (k)")

Other examples covered will include:

  • time series extraction at points and sets of points,
  • working with ensemble data from climate projections;
  • basic zonal statistics and
  • raster animation…

Hurricane Harvey: Pixel vs. County viewHurricane Harvey: Pixel vs. County view

Hurricane Harvey: Pixel vs. County view

If successful, you will not leave this session as experts at any of these tasks but will have a grasp on the tools need to implement them and an understanding of the data models behind them that will allow you to tackle your own climate-related projects.


Required libraries

You will need the following libraries to reproduce the content in these notes:

sf, raster, rasterVis, ggplot2, remotes, exactextractr, RNetCDF, tidyr, dplyr

all of which are on CRAN and can be installed using install.packages().

For example:

install.packages('sf')

Additionally, you will need to install climateR and AOI from github using remotes as they are not on CRAN:

remotes::install_github("mikejohnson51/AOI")
remotes::install_github("mikejohnson51/climateR")

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 27.5%
  • SCSS 23.2%
  • Less 21.1%
  • HTML 18.6%
  • CSS 9.6%