Learn R Programming

⚠️There's a newer version (1.3.0) of this package.Take me there.

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, 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

install.packages("rnpn")

Development version:

install.packages("devtools")
library('devtools')
devtools::install_github("usa-npn/rnpn")
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:

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:

species_list <- npn_species()

Similarly, for phenophases:

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.

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:

layers <- npn_get_layer_details()

You can then use the name of the layers to select and download geospatial data as a raster.

npn_download_geospatial(coverage_id = 'si-x:lilac_leaf_ncep_historic',date='2016-12-31',format='geotiff',output_path='./six-test-raster.tiff')

If you’re looking for a grid value at a specific latitude/longitude, that is also possible.

point_value <- npn_get_point_data('si-x:lilac_leaf_ncep_historic',date='2016-12-31',lat=38.5,long=-110.7)

What’s Next

Please read and review the vignettes for this package to get further information about the full scope of functionality available.

Acknowledgements

This code was developed, in part, as part of the integrated Pheno-Synthesis Software Suite (PS3). 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

Copy Link

Version

Install

install.packages('rnpn')

Monthly Downloads

662

Version

1.2.3

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Alyssa Rosemartin

Last Published

October 25th, 2021

Functions in rnpn (1.2.3)

npn_check_point_cached

Check Point Cached
npn_phenophase_definitions

Get Phenophase Definitions
npn_pheno_classes

Get Pheno Classes
npn_get_agdd_point_data

Get AGDD Point Value
check_geo_service

Runs a basic check to see if a valid response is returned by Geoserver and returns TRUE/FALSE
check_service

Runs a basic check to see if a valid response is returned by the NPN Portal service and returns TRUE/FALSE
npn_datasets

Get Datasets
npn_download_geospatial

Download Geospatial Data
npn_get_phenophases_for_taxon

Get Phenophases for Taxon
npn_get_common_query_vars

Get Common Query String Variables
get_additional_rasters

Get Additional Layers
npn_abundance_categories

Get Abundance Categories
npn_get_download_url

Generate Download URL
npn_download_site_phenometrics

Download Site Phenometrics
npn_download_status_data

Download Status and Intensity Records
npn_download_individual_phenometrics

Download Individual Phenometrics
npn_groups

Get Partner Groups
npn_merge_geo_data

Merge Geo Data
npn_get_layer_details

Get Geospatial Data Layer Details
npn_get_point_data

Get Point Data Value
npn_phenophases_by_species

Get Phenophase for Species
npn_lookup_names

Species Name Lookup
npn_indspatstations

This function is defunct.
npn_species

Get Species
npn_download_magnitude_phenometrics

Download Magnitude Phenometrics
npn_indsatstations

This function is defunct.
npn_get_custom_agdd_time_series

Get Custom AGDD Time Series
npn_stations_with_spp

Get Stations with Species
npn_stations_by_state

Get number of stations by state.
npn_get_custom_agdd_raster

Get Custom AGDD Raster Map
npn_stationsbystate

This function renamed to be consistent with other package function names.
npn_species_types

Get Species Types
npn_obsspbyday

This function is defunct.
rnpn-package

Interface to the National Phenology Network API
npn_phenophase_details

Get Phenophase Details
npn_stations

Get Station Data
npn_set_env

Set Environment
npn_phenophases

Get Phenophases
npn_stationswithspp

This function renamed to be consistent with other package function names.
npn_stations_by_location

Get station data based on a WKT defined geography.
rnpn-defunct

Defunct functions in rnpn
resolve_six_raster

Resolve SIX Raster
npn_allobssp

This function is defunct.
npn_get_data

Download NPN Data
npn_get_data_by_year

Get Data By Year