https://github.com/brownag/acis
R interface to Applied Climate Information System (ACIS) Web Services
https://github.com/brownag/acis
Last synced: about 2 months ago
JSON representation
R interface to Applied Climate Information System (ACIS) Web Services
- Host: GitHub
- URL: https://github.com/brownag/acis
- Owner: brownag
- License: gpl-3.0
- Created: 2022-09-24T00:04:57.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-13T00:14:30.000Z (about 2 years ago)
- Last Synced: 2025-02-08T08:47:10.059Z (4 months ago)
- Language: R
- Size: 103 KB
- Stars: 1
- 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%"
)
```# acis
The goal of acis is to provide wrapper functions for Applied Climate Information System (ACIS) Web Services.
ACIS Web Services (described at ) are accessed by seven types of calls: station metadata (StnMeta), raw or summarized climate data for a single station for a range of dates (StnData), data for multiple stations (MultiStnData), gridded data sets (GridData & GridData2), hourly data (StnHourly), and metadata for a geographic area (General).
## Installation
You can install the development version of acis from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("brownag/rACIS")
```## Example
See for information on how to construct ACIS queries.
The following examples demonstrate some capabilities of `acis_query()` a low-level function for constructing queries from a parameter list, and handling output types.
```{r example}
library(acis)# ITHACA CORNELL UNIV (sid: 304174; -76.44905, 42.44915; 960m elev)
s <- 304174# get metadata for a station
acis_query(
"StnMeta",
params = list(
sids = s,
output = 'json'
)
)# get average+max temperature, and precipitation for January 2020
acis_query(
"StnData",
params = list(
sid = s,
sdate = '2020-01-01',
edate = '2020-01-31',
elems = 'avgt,maxt,pcpn',
output = 'csv'
)
)library(terra)
# CONUS NRCC Interpolated Average Monthly Temperature (June 2020)
# specify params as raw JSON, and output=image in params list
g <- acis_query(
"GridData",
params = list(
params = '{"state":"me,ca,fl,wa","grid":"1","output":"image","date":"2020-6","elems":[{"name":"avgt","interval":"mly","duration":"mly","reduce":"mean"}],"image":{"proj":"lcc","overlays":["county:0.25:gray","state:0.5:black"],"interp":"cspline","width":350}}',
output = 'image'
)
)
plotRGB(g)
```