-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathREADME.Rmd
140 lines (104 loc) · 5.28 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
131
132
133
134
135
136
137
138
139
140
---
output:
github_document
---
# rnpn
```{r echo=FALSE}
knitr::opts_chunk$set(
comment = "#>",
collapse = TRUE,
warning = FALSE,
message = FALSE,
fig.path='inst/img/'
)
```
<!-- badges: start -->
[](https://www.repostatus.org/)
[](https://CRAN.R-project.org/package=rnpn)
[](https://github.com/usa-npn/rnpn/actions/workflows/R-CMD-check.yaml)
[](https://app.codecov.io/gh/usa-npn/rnpn)
<!-- badges: end -->
`rnpn` is an R client for interacting with the USA National Phenology Network data web services.
These services include access to a rich set of observer-contributed, point-based phenology records as well as geospatial data products including gridded phenological model and climatological data.
Documentation is available for the National Phenology Network [API documentation](https://docs.google.com/document/d/1yNjupricKOAXn6tY1sI7-EwkcfwdGUZ7lxYv7fcPjO8/edit?hl=en_US), which describes the full set of REST services this package wraps.
There is no need for an API key to grab data from the National Phenology Network but users are required to self identify, on an honor system, against requests that may draw upon larger datasets.
For functions that require it, simply populate the request_source parameter with your name or the name of your institution.
## Installation
CRAN version
```{r eval=FALSE}
install.packages("rnpn")
```
Development version:
```{r eval=FALSE}
install.packages("devtools")
library('devtools')
devtools::install_github("usa-npn/rnpn")
```
```{r}
library('rnpn')
```
This package has dependencies on both curl and gdal.
Some Linux based systems may require additional system dependencies for those required packages, and accordingly this package, to install correctly.
For example, on Ubuntu:
```{r eval=FALSE}
sudo apt install libcurl4-openssl-dev
sudo apt install libproj-dev libgdal-dev
```
## The Basics
Many of the functions to search for data require knowing the internal unique identifiers of some of the database entities to filter the data down efficiently.
For example, if you want to search by species, then you must know the internal identifier of the species.
To get a list of all available species use the following:
```{r eval=FALSE}
species_list <- npn_species()
```
Similarly, for phenophases:
```{r eval=FALSE}
phenophases <- npn_phenophases()
```
### Getting Observational Data
There are four main functions for accessing observational data, at various levels of aggregation.
At the most basic level you can download the raw status and intensity data.
```{r eval=FALSE}
some_data <- npn_download_status_data(
request_source = 'Your Name or Org Here',
years = c(2015),
species_id = c(35),
states = c('AZ', 'IL')
)
```
Note that through this API, data can only be filtered chronologically by full calendar years.
You can specify any number of years in each API call.
Also note that request_source is a required parameter and should be populated with your name or the name of the organization you represent.
All other parameters are optional but it is highly recommended that you filter your data search further.
### Getting Geospatial Data
This package wraps around standard WCS endpoints to facilitate the transfer of raster data.
Generally, this package does not focus on interacting with WMS services, although they are available.
To get a list of all available data layers, use the following:
```{r eval=FALSE}
layers <- npn_get_layer_details()
```
You can then use the name of the layers to select and download geospatial data as a raster.
```{r eval=FALSE}
npn_download_geospatial(
coverage_id = 'si-x:lilac_leaf_ncep_historic',
date = '2016-12-31',
format = 'geotiff',
output_path = './six-test-raster.tiff'
)
```
## Example of combined observational and geospatial data
For more details see Vignette VII
```{r, echo=FALSE, out.width = "70%", fig.pos="h"}
knitr::include_graphics("vignettes/figures/7-plot.png")
```
## What's Next
Please read and review the vignettes for this package to get further information about the full scope of functionality available.
## Acknowledgments
This code was developed, in part, as part of the integrated [Pheno-Synthesis Software Suite (PS3)](https://git.earthdata.nasa.gov/projects/APIS/repos/pheno-synthesis-software-suite/browse).
The authors acknowledge funding for this work through NASA's AIST program (80NSSC17K0582, 80NSSC17K0435, 80NSSC17K0538, and 80GSFC18T0003).
The University of Arizona and the USA National Phenology Network's efforts with this package are supported in part by US Geological Survey (G14AC00405, G18AC00135) and the US Fish and Wildlife Service (F16AC01075 and F19AC00168).
## Meta
* Please [report any issues or bugs](https://github.com/usa-npn/rnpn/issues).
* License: MIT
* Get citation information for `rnpn` in R doing `citation(package = 'rnpn')`
* Please note that this package is released with a [Contributor Code of Conduct](https://ropensci.org/code-of-conduct/). By contributing to this project, you agree to abide by its terms.