-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
116 lines (65 loc) · 2.12 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 = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# rcoagmet
<!-- badges: start -->
[![R-CMD-check](https://github.com/andypicke/rcoagmet/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/andypicke/rcoagmet/actions/workflows/R-CMD-check.yaml)
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
<!-- badges: end -->
The goal of [rcoagmet](https://github.com/andypicke/rcoagmet) is to provide functions for downloading data from [CoAgMet](https://coagmet.colostate.edu/) weather stations, using their [Data API](https://coagmet.colostate.edu/data/doc.html).
See also this [blog post](https://andypicke.quarto.pub/portfolio/posts/rcoagmet/rcoagmet.html) describing the package and showing some examples.
# Installation
You can install the development version of rcoagmet from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("andypicke/rcoagmet")
```
# Examples
## Download metadata for all CoAgMet stations:
```{r }
library(rcoagmet)
meta <- get_coagmet_meta()
head(meta)
```
## Download metadata for all Norther water stations:
```{r }
meta <- get_coagmet_meta(network = "nw")
head(meta)
```
## Get latest data from all CoAgMet stations:
```{r}
latest <- get_coagmet_data(station_id = "all", time_step = "latest")
head(latest)
```
## Find closest CoAgMet station to a given point:
```{r}
# coordinates for Denver
xlat <- 39.74
xlon <- -104.99
nearest_station <- find_closest_coagmet_station(xlat, xlon)
nearest_station
```
## Download data for one station:
```{r}
df <- get_coagmet_data(station_id = "den01")
head(df)
```
### Plot air temp:
```{r}
df |>
ggplot2::ggplot(ggplot2::aes(date_and_time, air_temp)) +
ggplot2::geom_line()
```
### Make an interactive plot of one variable with plotly:
```{r}
#plot_coagmet_plotly(df, "air_temp")
```