/
README.Rmd
132 lines (99 loc) · 3.81 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
---
output:
github_document:
html_preview: true
---
# macleish <img src='man/figures/logo.png' align="right" height="139"/>
<!-- badges: start -->
[![R-CMD-check](https://github.com/beanumber/macleish/workflows/R-CMD-check/badge.svg)](https://github.com/beanumber/macleish/actions)
[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/macleish)](https://cran.r-project.org/package=macleish) [![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)
<!-- badges: end -->
The [Ada and Archibald MacLeish Field Station](https://www.smith.edu/about-smith/sustainable-smith/macleish) is a 260-acre patchwork of forest and farmland located in West Whately, MA that provides opportunities for faculty and students to pursue environmental research, outdoor education, and low-impact recreation.
![MacLeish Field Station](inst/extdata/macleish_600px.jpg)
This R package allows you to download and process weather data using the [ETL](https://github.com/beanumber/etl) framework from the MacLeish Field Station. It also contains shapefiles for contextualizing spatial information.
## To install
```{r, eval=FALSE}
install.packages("macleish")
```
## Use 2015 weather data
Weather data from 2015 is available immediately from both the `Whately` and `Orchard` weather stations.
```{r, message=FALSE}
library(macleish)
glimpse(whately_2015)
glimpse(orchard_2015)
```
## Live weather data
Weather readings are logged every 10 minutes. Current and historical (dating back to 1/3/2012 for `whately` and 6/27/2014 for `orchard`) meteorological readings are available through the [ETL](https://github.com/beanumber/etl) framework. Please see the documentation for that package for more information about how this works.
```{r, message=FALSE, eval=FALSE}
macleish <- etl("macleish")
macleish %>%
etl_update()
```
```{r, eval=FALSE}
whately <- macleish %>%
tbl("whately")
whately %>%
mutate(the_year = strftime('%Y', when)) %>%
group_by(the_year) %>%
summarize(N = n(), begin = min(when), end = max(when), avg_temp = mean(temperature))
orchard <- macleish %>%
tbl("orchard")
orchard %>%
mutate(the_year = strftime('%Y', when)) %>%
group_by(the_year) %>%
summarize(N = n(), begin = min(when), end = max(when), avg_temp = mean(temperature))
```
```{r, eval=FALSE, fig.width = 7, fig.height = 5, message=FALSE}
daily <- whately %>%
mutate(the_date = date(when)) %>%
group_by(the_date) %>%
summarize(N = n(), avgTemp = mean(temperature)) %>%
collect()
library(ggplot2)
ggplot(data = daily, aes(x = as.Date(the_date), y = avgTemp)) +
geom_point() + geom_smooth()
```
## Maps
Spatial data is available through the `macleish_layers` data object.
```{r}
class(macleish_layers)
names(macleish_layers)
```
```{r, eval=FALSE, fig.width=7, fig.height=7, message=FALSE}
library(leaflet)
leaflet() %>%
addTiles() %>%
addPolygons(
data = macleish_layers[["boundary"]],
weight = 1, fillOpacity = 0.1
) %>%
addPolygons(
data = macleish_layers[["buildings"]],
weight = 1, popup = ~ name
) %>%
addPolylines(
data = macleish_layers[["trails"]],
weight = 1, color = "brown",
popup = ~ name
) %>%
addPolylines(
data = macleish_layers[["streams"]],
weight = 2
) %>%
addMarkers(
data = filter(macleish_layers[["landmarks"]], grepl("Met", Label)),
popup = ~Label
)
```
## Images
You can download live and historical images from Phenocam.
```{r}
phenocam_image_url()
```
```{r figures-side, fig.show="hold", out.width="50%"}
knitr::include_graphics(phenocam_image_url())
knitr::include_graphics(phenocam_image_url("2021-12-25 12:05:05"))
```
## See also
- [Ada and Archibald MacLeish Field Station](https://www.smith.edu/about-smith/sustainable-smith/macleish)
- **[etl](https://github.com/beanumber/etl)**