A curated list of open technology projects to sustain a stable climate, energy supply, biodiversity and natural resources.

rnpn

R client for interacting with the USA National Phenology Network data web services.
https://github.com/usa-npn/rnpn

Category: Biosphere
Sub Category: Plants and Vegetation

Keywords

data national-phenology-network phenology r r-package rstats species web-api

Keywords from Contributors

routes cycle weather genome occurrence biodiversity climate spocc inaturalist gbif

Last synced: about 14 hours ago
JSON representation

Repository metadata

R client for the National Phenology Network database API

README.Rmd

          ---
output:
  github_document
---

# rnpn

```{r echo=FALSE}
knitr::opts_chunk$set(
  comment = "#>",
  collapse = TRUE,
  warning = FALSE,
  message = FALSE,
  fig.path='inst/img/'
)
```


[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/)
[![CRAN status](https://www.r-pkg.org/badges/version/rnpn)](https://CRAN.R-project.org/package=rnpn)
[![R build status](https://github.com/usa-npn/rnpn//workflows/R-CMD-check/badge.svg)](https://github.com/usa-npn/rnpn/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/usa-npn/rnpn/graph/badge.svg)](https://app.codecov.io/gh/usa-npn/rnpn)


`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.

        

Citation (CITATION.cff)

# --------------------------------------------
# CITATION file created with {cffr} R package
# See also: https://docs.ropensci.org/cffr/
# --------------------------------------------
 
cff-version: 1.2.0
message: 'To cite package "rnpn" in publications use:'
type: software
license: MIT
title: 'rnpn: Interface to the National ''Phenology'' Network ''API'''
version: 1.4.0
doi: 10.32614/CRAN.package.rnpn
abstract: Programmatic interface to the Web Service methods provided by the National
  'Phenology' Network (<https://usanpn.org/>), which includes data on various life
  history events that occur at specific times.
authors:
- family-names: Switzer
  given-names: Jeff
  email: [email protected]
- family-names: Chamberlain
  given-names: Scott
- family-names: Marsh
  given-names: Lee
- family-names: Wong
  given-names: Kevin
- family-names: Scott
  given-names: Eric R
  orcid: https://orcid.org/0000-0002-7430-7879
repository: https://CRAN.R-project.org/package=rnpn
repository-code: https://github.com/usa-npn/rnpn
url: http://usa-npn.github.io/rnpn/
date-released: '2025-03-25'
contact:
- family-names: Switzer
  given-names: Jeff
  email: [email protected]
keywords:
- data
- national-phenology-network
- phenology
- r
- r-package
- rstats
- species
- web-api


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 5 days ago

Total Commits: 450
Total Committers: 11
Avg Commits per committer: 40.909
Development Distribution Score (DDS): 0.518

Commits in past year: 216
Committers in past year: 2
Avg Commits per committer in past year: 108.0
Development Distribution Score (DDS) in past year: 0.065

Name Email Commits
Eric Scott s****r@g****m 217
Scott Chamberlain m****s@g****m 105
npnlee85 l****e@u****g 45
[email protected] n****5@g****m 32
alyssarosemartin a****n@g****m 19
Jeff Switzer j****r@g****m 18
David LeBauer d****r@a****u 6
Maëlle Salmon m****n@y****e 3
Kevin Wong k****n@u****g 3
steven2249 s****w@b****u 1
Jeroen Ooms j****s@g****m 1

Committer domains:


Issue and Pull Request metadata

Last synced: about 14 hours ago

Total issues: 86
Total pull requests: 40
Average time to close issues: 8 months
Average time to close pull requests: about 2 months
Total issue authors: 13
Total pull request authors: 5
Average comments per issue: 1.73
Average comments per pull request: 0.8
Merged pull request: 33
Bot issues: 0
Bot pull requests: 0

Past year issues: 62
Past year pull requests: 29
Past year average time to close issues: about 1 month
Past year average time to close pull requests: 16 days
Past year issue authors: 3
Past year pull request authors: 1
Past year average comments per issue: 1.23
Past year average comments per pull request: 0.59
Past year merged pull request: 23
Past year bot issues: 0
Past year bot pull requests: 0

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/usa-npn/rnpn

Top Issue Authors

  • Aariq (57)
  • sckott (13)
  • jeffswitzer (4)
  • ezylstra (2)
  • tdlan80 (2)
  • maelle (1)
  • Peter9192 (1)
  • rsbivand (1)
  • lzachmann (1)
  • cboettig (1)
  • vijaybarve (1)
  • ahhurlbert (1)
  • djhocking (1)

Top Pull Request Authors

  • Aariq (32)
  • npnlee85 (4)
  • dlebauer (2)
  • maelle (1)
  • stevenysw (1)

Top Issue Labels

  • bug (18)
  • API (10)
  • feature (8)
  • priority: low (6)
  • refactor (5)
  • priority: high (1)
  • testing (1)
  • good first issue (1)

Top Pull Request Labels


Package metadata

cran.r-project.org: rnpn

Interface to the National 'Phenology' Network 'API'

  • Homepage: https://github.com/usa-npn/rnpn
  • Documentation: http://cran.r-project.org/web/packages/rnpn/rnpn.pdf
  • Licenses: MIT + file LICENSE
  • Latest release: 1.4.0 (published about 1 month ago)
  • Last Synced: 2025-04-25T12:08:16.762Z (1 day ago)
  • Versions: 14
  • Dependent Packages: 0
  • Dependent Repositories: 2
  • Downloads: 703 Last month
  • Docker Downloads: 88,633
  • Rankings:
    • Docker downloads count: 0.018%
    • Forks count: 6.901%
    • Stargazers count: 13.388%
    • Average: 14.539%
    • Downloads: 19.528%
    • Dependent repos count: 19.546%
    • Dependent packages count: 27.852%
  • Maintainers (1)

Dependencies

DESCRIPTION cran
  • R >= 3.5.0 depends
  • XML * imports
  • curl * imports
  • data.table >= 1.9.6 imports
  • httr >= 1.1.0 imports
  • jsonlite >= 0.9.19 imports
  • magrittr * imports
  • plyr * imports
  • raster * imports
  • rgdal * imports
  • sp >= 1.1 imports
  • tibble * imports
  • RColorBrewer * suggests
  • covr * suggests
  • ggplot2 * suggests
  • knitr * suggests
  • markdown * suggests
  • rmarkdown * suggests
  • testthat * suggests
  • vcr * suggests
.github/workflows/R-CMD-check.yaml actions
  • actions/cache v2 composite
  • actions/checkout v2 composite
  • actions/upload-artifact main composite
  • r-lib/actions/setup-pandoc v1 composite
  • r-lib/actions/setup-r v1 composite

Score: 17.648258662546432