forked from mikejohnson51/climateR-intro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
115 lines (79 loc) · 3.21 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
message = FALSE, warning = FALSE,
fig.align = 'center',
fig.width = 10
)
```
# Gridded climate data with R
[These notes](https://mikejohnson51.github.io/climateR-intro/) are prepared for the [UCSB ecodata science club](https://eco-data-science.github.io/). 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:
```{r, echo = FALSE}
knitr::include_graphics("img/diminsions.png")
```
<br><br><br><br>
### 2. Concepts & workflows for ingesting subsets of remote climate data
```{r, echo = FALSE, fig.width = 4}
knitr::include_graphics("img/cookie-cutter.png")
```
<br><br><br><br>
### 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?"
```{r, eval = FALSE}
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)")
```
```{r, echo = FALSE}
library(AOI)
library(climateR)
library(rasterVis)
AOI = 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)",
margins = list(0,0,0,0))
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...
```{r, echo=FALSE,out.width="49%", out.height="20%",fig.cap="Hurricane Harvey: Pixel vs. County view",fig.show='hold',fig.align='center', echo = FALSE}
knitr::include_graphics(c("img/ppt.gif","img/ppt2.gif"))
```
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:
```{r, eval = FALSE}
install.packages('sf')
```
Additionally, you will need to install `climateR` and `AOI` from github using `remotes` as they are not on CRAN:
```{r, eval = FALSE}
remotes::install_github("mikejohnson51/AOI")
remotes::install_github("mikejohnson51/climateR")
```