https://github.com/andypicke/rcoagmet
API Wrapper for CoAgMet Weather Stations
https://github.com/andypicke/rcoagmet
api colorado r weather
Last synced: 2 months ago
JSON representation
API Wrapper for CoAgMet Weather Stations
- Host: GitHub
- URL: https://github.com/andypicke/rcoagmet
- Owner: andypicke
- License: other
- Created: 2024-04-23T16:25:07.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-07-26T20:24:11.000Z (10 months ago)
- Last Synced: 2025-01-24T22:43:21.697Z (4 months ago)
- Topics: api, colorado, r, weather
- Language: R
- Homepage:
- Size: 424 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
README
---
output: github_document
---```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```# rcoagmet
[](https://github.com/andypicke/rcoagmet/actions/workflows/R-CMD-check.yaml)
[](https://lifecycle.r-lib.org/articles/stages.html#experimental)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.99nearest_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")
```