Title: | Interface to the National 'Phenology' Network 'API' |
---|---|
Description: | 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: | Jeff Switzer [aut, cre],
Scott Chamberlain [aut],
Lee Marsh [aut],
Kevin Wong [aut],
Eric R Scott [aut] |
Maintainer: | Jeff Switzer <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.3.0.9000 |
Built: | 2025-03-11 21:17:51 UTC |
Source: | https://github.com/usa-npn/rnpn |
This package allows for easy access to the National Phenology Network's Data API. To learn more, take a look at the vignettes.
Maintainer: Jeff Switzer [email protected]
Authors:
Scott Chamberlain
Lee Marsh
Kevin Wong
Eric R Scott (ORCID)
Other contributors:
David LeBauer [contributor]
Useful links:
Report bugs at https://github.com/usa-npn/rnpn/issues
Gets data on all abundance/intensity categories and includes a data frame of applicable abundance/intensity values for each category
npn_abundance_categories(...)
npn_abundance_categories(...)
... |
Currently unused. |
A data frame listing all abundance/intensity categories and their corresponding values.
## Not run: ac <- npn_abundance_categories() ## End(Not run)
## Not run: ac <- npn_abundance_categories() ## End(Not run)
Returns a complete list of information about all datasets integrated into the NPN dataset. Data can then be pulled for individual datasets using their unique IDs.
npn_datasets(...)
npn_datasets(...)
... |
Currently unused. |
tibble of datasets and their IDs.
## Not run: npn_datasets() ## End(Not run)
## Not run: npn_datasets() ## End(Not run)
Function for directly downloading any arbitrary Geospatial layer data from the NPN Geospatial web services.
npn_download_geospatial( coverage_id, date, format = "geotiff", output_path = NULL )
npn_download_geospatial( coverage_id, date, format = "geotiff", output_path = NULL )
coverage_id |
The coverage id (machine name) of the layer for which to
retrieve. Applicable values can be found via the |
date |
Specify the date param for the layer retrieved. This can be a
calendar date formatted YYYY-mm-dd or it could be a string integer
representing day of year. It can also be |
format |
The output format of the raster layer retrieved. Defaults to
|
output_path |
Optional value. When set, the raster will be piped to the file path specified. When left unset, this function will return a terra::SpatRaster object. |
Information about the layers can also be viewed at the getCapbilities page directly: https://geoserver.usanpn.org/geoserver/wms?request=GetCapabilities
returns nothing when output_path
is set, otherwise a
terra::SpatRaster object meeting the coverage_id
, date
and format
parameters specified.
## Not run: ras <- npn_download_geospatial("si-x:30yr_avg_six_bloom", "255") ## End(Not run)
## Not run: ras <- npn_download_geospatial("si-x:30yr_avg_six_bloom", "255") ## End(Not run)
This function allows for a parameterized search of all individual phenometrics records in the USA-NPN database, returning all records as per the search parameters in a data table. Data fetched from NPN services is returned as raw JSON before being channeled into a data table. Optionally results can be directed to an output file in which case raw JSON is converted to CSV and saved to file; in that case, data is also streamed to file which allows for more easily handling of the data if the search otherwise returns more data than can be handled at once in memory.
npn_download_individual_phenometrics( request_source, years, period_start = "01-01", period_end = "12-31", coords = NULL, individual_ids = NULL, species_ids = NULL, station_ids = NULL, species_types = NULL, network_ids = NULL, states = NULL, phenophase_ids = NULL, functional_types = NULL, additional_fields = NULL, climate_data = FALSE, ip_address = NULL, dataset_ids = NULL, genus_ids = NULL, family_ids = NULL, order_ids = NULL, class_ids = NULL, pheno_class_ids = NULL, email = NULL, download_path = NULL, six_leaf_layer = FALSE, six_bloom_layer = FALSE, agdd_layer = NULL, six_sub_model = NULL, additional_layers = NULL, wkt = NULL )
npn_download_individual_phenometrics( request_source, years, period_start = "01-01", period_end = "12-31", coords = NULL, individual_ids = NULL, species_ids = NULL, station_ids = NULL, species_types = NULL, network_ids = NULL, states = NULL, phenophase_ids = NULL, functional_types = NULL, additional_fields = NULL, climate_data = FALSE, ip_address = NULL, dataset_ids = NULL, genus_ids = NULL, family_ids = NULL, order_ids = NULL, class_ids = NULL, pheno_class_ids = NULL, email = NULL, download_path = NULL, six_leaf_layer = FALSE, six_bloom_layer = FALSE, agdd_layer = NULL, six_sub_model = NULL, additional_layers = NULL, wkt = NULL )
request_source |
Required field, character Self-identify who is making requests to the data service. |
years |
Required field, character vector. Specify the years to include
in the search, e.g. |
period_start , period_end
|
Character vectors of the form "MM-DD". Used to
determine the period over which phenophase status records are summarized.
For example, to use a "water year" set |
coords |
Numeric vector, used to specify a bounding box as a search
parameter, e.g. |
individual_ids |
Comma-separated string of unique IDs for individual plants/animal species by which to filter the data. |
species_ids |
Integer vector of unique IDs for searching based on
species, e.g. |
station_ids |
Integer vector of unique IDs for searching based on site
location, e.g. |
species_types |
Character vector of unique species type names for
searching based on species types, e.g. |
network_ids |
Integer vector of unique IDs for searching based on
partner group/network, e.g. |
states |
Character vector of US postal states to be used as search
params, e.g. |
phenophase_ids |
Integer vector of unique IDs for searching based on
phenophase, e.g. |
functional_types |
Character vector of unique functional type names, e.g. 'c("Birds"). |
additional_fields |
Character vector of additional fields to be included
in the search results, e.g. |
climate_data |
Boolean value indicating that all climate variables
should be included in |
ip_address |
Optional field, string. IP Address of user requesting data. Used for generating data reports. |
dataset_ids |
Integer vector of unique IDs for searching based on
dataset, e.g. NEON or GRSM |
genus_ids |
Integer vector of unique IDs for searching based on
taxonomic family, e.g. |
family_ids |
Integer vector of unique IDs for searching based on
taxonomic family, e.g. |
order_ids |
Integer vector of unique IDs for searching based on
taxonomic order, e.g. |
class_ids |
Integer vector of unique IDs for searching based on
taxonomic class, e.g. |
pheno_class_ids |
Integer vector of unique IDs for searching based on
pheno class. Note that if both |
email |
Optional field, string. Email of user requesting data. |
download_path |
Character, optional file path to the file for which to output the results. |
six_leaf_layer |
Boolean value when set to |
six_bloom_layer |
Boolean value when set to |
agdd_layer |
Numeric value, accepts |
six_sub_model |
Affects the results of the six layers returned. Can be
used to specify one of three submodels used to calculate the spring index
values. Thus setting this field will change the results of |
additional_layers |
Data frame with first column named |
wkt |
WKT geometry by which filter data. Specifying a valid WKT within the contiguous US will filter data based on the locations which fall within that WKT. |
This data type includes estimates of the dates of phenophase onsets and ends for individual plants and for animal species at a site during a user-defined time period. Each row represents a series of consecutive "yes" phenophase status records, beginning with the date of the first "yes" and ending with the date of the last "yes", submitted for a given phenophase on a given organism. Note that more than one consecutive series for an organism may be present within a single growing season or year.
Most search parameters are optional, however, users are encouraged to supply
additional search parameters to get results that are easier to work with.
request_source
must be provided. This is a self-identifying string, telling
the service who is asking for the data or from where the request is being
made. It is recommended you provide your name or organization name. If the
call to this function is acting as an intermediary for a client, then you may
also optionally provide a user email and/or IP address for usage data
reporting later.
Additional fields provides the ability to specify additional, non-critical fields to include in the search results. A complete list of additional fields can be found in the NPN service's companion documentation Metadata on all fields can be found in the following Excel sheet: https://www.usanpn.org/files/metadata/individual_phenometrics_datafield_descriptions.xlsx
A tibble of all status records returned as per the search
parameters. If download_path
is specified, the file path is returned
instead.
## Not run: #Download all saguaro data for 2013 and 2014 using "water year" as the period npn_download_individual_phenometrics( request_source = "Your Name or Org Here", years = c(2013, 2014), period_start = "10-01", period_end = "09-30", species_id = 210, download_path = "saguaro_data_2013_2014.csv" ) ## End(Not run)
## Not run: #Download all saguaro data for 2013 and 2014 using "water year" as the period npn_download_individual_phenometrics( request_source = "Your Name or Org Here", years = c(2013, 2014), period_start = "10-01", period_end = "09-30", species_id = 210, download_path = "saguaro_data_2013_2014.csv" ) ## End(Not run)
This function allows for a parameterized search of all magnitude phenometrics in the USA-NPN database, returning all records as per the search results in a data table. Data fetched from NPN services is returned as raw JSON before being channeled into a data table. Optionally results can be directed to an output file in which case raw JSON is saved to file; in that case, data is also streamed to file which allows for more easily handling of the data if the search otherwise returns more data than can be handled at once in memory.
npn_download_magnitude_phenometrics( request_source, years, period_frequency = "30", coords = NULL, species_ids = NULL, genus_ids = NULL, family_ids = NULL, order_ids = NULL, class_ids = NULL, pheno_class_ids = NULL, station_ids = NULL, species_types = NULL, network_ids = NULL, states = NULL, phenophase_ids = NULL, functional_types = NULL, additional_fields = NULL, climate_data = FALSE, ip_address = NULL, dataset_ids = NULL, email = NULL, download_path = NULL, taxonomy_aggregate = NULL, pheno_class_aggregate = NULL, wkt = NULL )
npn_download_magnitude_phenometrics( request_source, years, period_frequency = "30", coords = NULL, species_ids = NULL, genus_ids = NULL, family_ids = NULL, order_ids = NULL, class_ids = NULL, pheno_class_ids = NULL, station_ids = NULL, species_types = NULL, network_ids = NULL, states = NULL, phenophase_ids = NULL, functional_types = NULL, additional_fields = NULL, climate_data = FALSE, ip_address = NULL, dataset_ids = NULL, email = NULL, download_path = NULL, taxonomy_aggregate = NULL, pheno_class_aggregate = NULL, wkt = NULL )
request_source |
Required field, character Self-identify who is making requests to the data service. |
years |
Required field, character vector. Specify the years to include
in the search, e.g. |
period_frequency |
Required field, integer. The integer value specifies
the number of days by which to delineate the period of time specified by
the start_date and end_date, i.e. a value of 7 will delineate the period of
time weekly. Any remainder days are grouped into the final delineation.
This parameter, while typically an int, also allows for a "special" string
value, "months" to be passed in. Specifying this parameter as "months" will
delineate the period of time by the calendar months regardless of how many
days are in each month. Defaults to |
coords |
Numeric vector, used to specify a bounding box as a search
parameter, e.g. |
species_ids |
Integer vector of unique IDs for searching based on
species, e.g. |
genus_ids |
Integer vector of unique IDs for searching based on
taxonomic family, e.g. |
family_ids |
Integer vector of unique IDs for searching based on
taxonomic family, e.g. |
order_ids |
Integer vector of unique IDs for searching based on
taxonomic order, e.g. |
class_ids |
Integer vector of unique IDs for searching based on
taxonomic class, e.g. |
pheno_class_ids |
Integer vector of unique IDs for searching based on
pheno class. Note that if both |
station_ids |
Integer vector of unique IDs for searching based on site
location, e.g. |
species_types |
Character vector of unique species type names for
searching based on species types, e.g. |
network_ids |
Integer vector of unique IDs for searching based on
partner group/network, e.g. |
states |
Character vector of US postal states to be used as search
params, e.g. |
phenophase_ids |
Integer vector of unique IDs for searching based on
phenophase, e.g. |
functional_types |
Character vector of unique functional type names, e.g. 'c("Birds"). |
additional_fields |
Character vector of additional fields to be included
in the search results, e.g. |
climate_data |
Boolean value indicating that all climate variables
should be included in |
ip_address |
Optional field, string. IP Address of user requesting data. Used for generating data reports. |
dataset_ids |
Integer vector of unique IDs for searching based on
dataset, e.g. NEON or GRSM |
email |
Optional field, string. Email of user requesting data. |
download_path |
Character, optional file path to the file for which to output the results. |
taxonomy_aggregate |
Boolean value indicating whether to aggregate data
by a taxonomic order higher than species. This will be based on the values
set in |
pheno_class_aggregate |
Boolean value indicating whether to aggregate
data by the pheno class ids as per the |
wkt |
WKT geometry by which filter data. Specifying a valid WKT within the contiguous US will filter data based on the locations which fall within that WKT. |
This data type includes various measures of the extent to which a phenophase for a plant or animal species is expressed across multiple individuals and sites over a user-selected set of time intervals. Each row provides up to eight calculated measures summarized weekly, bi-weekly, monthly or over a custom time interval. These measures include approaches to evaluate the shape of an annual activity curve, including the total number of "yes" records and the proportion of "yes" records relative to the total number of status records over the course of a calendar year for a region of interest. They also include several approaches for standardizing animal abundances by observer effort over time and space (e.g. mean active bird individuals per hour). See the Metadata window for more information.
Most search parameters are optional, however, failing to provide even a single search parameter will return all results in the database. Request_Source must be provided. This is a self-identifying string, telling the service who is asking for the data or from where the request is being made. It is recommended you provide your name or organization name. If the call to this function is acting as an intermediary for a client, then you may also optionally provide a user email and/or IP address for usage data reporting later.
Additional fields provides the ability to specify more, non-critical fields to include in the search results. A complete list of additional fields can be found in the NPN service's companion documentation. Metadata on all fields can be found in the following Excel sheet: https://www.usanpn.org/files/metadata/magnitude_phenometrics_datafield_descriptions.xlsx
A tibble of the requested data. If a download_path
was specified,
the file path is returned.
## Not run: #Download book all saguaro data for 2013 npn_download_magnitude_phenometrics( request_source="Your Name or Org Here", years=c(2013), species_id=c(210), download_path="saguaro_data_2013.csv" ) ## End(Not run)
## Not run: #Download book all saguaro data for 2013 npn_download_magnitude_phenometrics( request_source="Your Name or Org Here", years=c(2013), species_id=c(210), download_path="saguaro_data_2013.csv" ) ## End(Not run)
This function allows for a parameterized search of all site phenometrics records in the USA-NPN database, returning all records as per the search parameters in a data table. Data fetched from NPN services is returned as raw JSON before being channeled into a data table. Optionally results can be directed to an output file in which case raw JSON is converted to CSV and saved to file; in that case, data is also streamed to file which allows for more easily handling of the data if the search otherwise returns more data than can be handled at once in memory.
npn_download_site_phenometrics( request_source, years, period_start = "01-01", period_end = "12-31", num_days_quality_filter = "30", coords = NULL, species_ids = NULL, genus_ids = NULL, family_ids = NULL, order_ids = NULL, class_ids = NULL, pheno_class_ids = NULL, station_ids = NULL, species_types = NULL, network_ids = NULL, states = NULL, phenophase_ids = NULL, functional_types = NULL, additional_fields = NULL, climate_data = FALSE, ip_address = NULL, dataset_ids = NULL, email = NULL, download_path = NULL, six_leaf_layer = FALSE, six_bloom_layer = FALSE, agdd_layer = NULL, six_sub_model = NULL, additional_layers = NULL, taxonomy_aggregate = NULL, pheno_class_aggregate = NULL, wkt = NULL )
npn_download_site_phenometrics( request_source, years, period_start = "01-01", period_end = "12-31", num_days_quality_filter = "30", coords = NULL, species_ids = NULL, genus_ids = NULL, family_ids = NULL, order_ids = NULL, class_ids = NULL, pheno_class_ids = NULL, station_ids = NULL, species_types = NULL, network_ids = NULL, states = NULL, phenophase_ids = NULL, functional_types = NULL, additional_fields = NULL, climate_data = FALSE, ip_address = NULL, dataset_ids = NULL, email = NULL, download_path = NULL, six_leaf_layer = FALSE, six_bloom_layer = FALSE, agdd_layer = NULL, six_sub_model = NULL, additional_layers = NULL, taxonomy_aggregate = NULL, pheno_class_aggregate = NULL, wkt = NULL )
request_source |
Required field, character Self-identify who is making requests to the data service. |
years |
Required field, character vector. Specify the years to include
in the search, e.g. |
period_start , period_end
|
Character vectors of the form "MM-DD". Used to
determine the period over which phenophase status records are summarized.
For example, to use a "water year" set |
num_days_quality_filter |
Required field, defaults to |
coords |
Numeric vector, used to specify a bounding box as a search
parameter, e.g. |
species_ids |
Integer vector of unique IDs for searching based on
species, e.g. |
genus_ids |
Integer vector of unique IDs for searching based on
taxonomic family, e.g. |
family_ids |
Integer vector of unique IDs for searching based on
taxonomic family, e.g. |
order_ids |
Integer vector of unique IDs for searching based on
taxonomic order, e.g. |
class_ids |
Integer vector of unique IDs for searching based on
taxonomic class, e.g. |
pheno_class_ids |
Integer vector of unique IDs for searching based on
pheno class. Note that if both |
station_ids |
Integer vector of unique IDs for searching based on site
location, e.g. |
species_types |
Character vector of unique species type names for
searching based on species types, e.g. |
network_ids |
Integer vector of unique IDs for searching based on
partner group/network, e.g. |
states |
Character vector of US postal states to be used as search
params, e.g. |
phenophase_ids |
Integer vector of unique IDs for searching based on
phenophase, e.g. |
functional_types |
Character vector of unique functional type names, e.g. 'c("Birds"). |
additional_fields |
Character vector of additional fields to be included
in the search results, e.g. |
climate_data |
Boolean value indicating that all climate variables
should be included in |
ip_address |
Optional field, string. IP Address of user requesting data. Used for generating data reports. |
dataset_ids |
Integer vector of unique IDs for searching based on
dataset, e.g. NEON or GRSM |
email |
Optional field, string. Email of user requesting data. |
download_path |
Character, optional file path to the file for which to output the results. |
six_leaf_layer |
Boolean value when set to |
six_bloom_layer |
Boolean value when set to |
agdd_layer |
Numeric value, accepts |
six_sub_model |
Affects the results of the six layers returned. Can be
used to specify one of three submodels used to calculate the spring index
values. Thus setting this field will change the results of |
additional_layers |
Data frame with first column named |
taxonomy_aggregate |
Boolean value indicating whether to aggregate data
by a taxonomic order higher than species. This will be based on the values
set in |
pheno_class_aggregate |
Boolean value indicating whether to aggregate
data by the pheno class ids as per the |
wkt |
WKT geometry by which filter data. Specifying a valid WKT within the contiguous US will filter data based on the locations which fall within that WKT. |
This data type includes estimates of the overall onset and end of phenophase activity for plant and animal species at a site over a user-defined time period. Each row provides the first and last occurrences of a given phenophase on a given species, beginning with the date of the first observed "yes" phenophase status record and ending with the date of the last observed "yes" record of the user-defined time period. For plant species where multiple individuals are monitored at the site, the date provided for "first yes" is the mean of the first "yes" records for each individual plant at the site, and the date for "last yes" is the mean of the last "yes" records. Note that a phenophase may have ended and restarted during the overall period of its activity at the site. These more fine-scale patterns can be explored in the individual phenometrics data.
Most search parameters are optional, however, users are encouraged to supply
additional search parameters to get results that are easier to work with.
request_source
must be provided. This is a self-identifying string, telling
the service who is asking for the data or from where the request is being
made. It is recommended you provide your name or organization name. If the
call to this function is acting as an intermediary for a client, then you may
also optionally provide a user email and/or IP address for usage data
reporting later.
Additional fields provides the ability to specify additional, non-critical fields to include in the search results. A complete list of additional fields can be found in the NPN service's companion documentation. Metadata on all fields can be found in the following Excel sheet: https://www.usanpn.org/files/metadata/site_phenometrics_datafield_descriptions.xlsx
A tibble of all status records returned as per the search
parameters. If download_path
is specified, the file path is returned
instead.
## Not run: #Download all saguaro data for 2013 and 2014 npn_download_site_phenometrics( request_source = "Your Name or Org Here", years = c(2013, 2014), species_id = 210, download_path = "saguaro_data_2013_2014.csv" ) ## End(Not run)
## Not run: #Download all saguaro data for 2013 and 2014 npn_download_site_phenometrics( request_source = "Your Name or Org Here", years = c(2013, 2014), species_id = 210, download_path = "saguaro_data_2013_2014.csv" ) ## End(Not run)
This function allows for a parameterized search of all status records in the USA-NPN database, returning all records as per the search parameters in a data table. Data fetched from NPN services is returned as raw JSON before being channeled into a data table. Optionally results can be directed to an output file in which case the raw JSON is converted to CSV and saved to file; in that case, data is also streamed to file which allows for more easily handling of the data if the search otherwise returns more data than can be handled at once in memory.
npn_download_status_data( request_source, years, coords = NULL, species_ids = NULL, genus_ids = NULL, family_ids = NULL, order_ids = NULL, class_ids = NULL, station_ids = NULL, species_types = NULL, network_ids = NULL, states = NULL, phenophase_ids = NULL, functional_types = NULL, additional_fields = NULL, climate_data = FALSE, ip_address = NULL, dataset_ids = NULL, email = NULL, download_path = NULL, six_leaf_layer = FALSE, six_bloom_layer = FALSE, agdd_layer = NULL, six_sub_model = NULL, additional_layers = NULL, pheno_class_ids = NULL, wkt = NULL )
npn_download_status_data( request_source, years, coords = NULL, species_ids = NULL, genus_ids = NULL, family_ids = NULL, order_ids = NULL, class_ids = NULL, station_ids = NULL, species_types = NULL, network_ids = NULL, states = NULL, phenophase_ids = NULL, functional_types = NULL, additional_fields = NULL, climate_data = FALSE, ip_address = NULL, dataset_ids = NULL, email = NULL, download_path = NULL, six_leaf_layer = FALSE, six_bloom_layer = FALSE, agdd_layer = NULL, six_sub_model = NULL, additional_layers = NULL, pheno_class_ids = NULL, wkt = NULL )
request_source |
Required field, character Self-identify who is making requests to the data service. |
years |
Required field, character vector. Specify the years to include
in the search, e.g. |
coords |
Numeric vector, used to specify a bounding box as a search
parameter, e.g. |
species_ids |
Integer vector of unique IDs for searching based on
species, e.g. |
genus_ids |
Integer vector of unique IDs for searching based on
taxonomic family, e.g. |
family_ids |
Integer vector of unique IDs for searching based on
taxonomic family, e.g. |
order_ids |
Integer vector of unique IDs for searching based on
taxonomic order, e.g. |
class_ids |
Integer vector of unique IDs for searching based on
taxonomic class, e.g. |
station_ids |
Integer vector of unique IDs for searching based on site
location, e.g. |
species_types |
Character vector of unique species type names for
searching based on species types, e.g. |
network_ids |
Integer vector of unique IDs for searching based on
partner group/network, e.g. |
states |
Character vector of US postal states to be used as search
params, e.g. |
phenophase_ids |
Integer vector of unique IDs for searching based on
phenophase, e.g. |
functional_types |
Character vector of unique functional type names, e.g. 'c("Birds"). |
additional_fields |
Character vector of additional fields to be included
in the search results, e.g. |
climate_data |
Boolean value indicating that all climate variables
should be included in |
ip_address |
Optional field, string. IP Address of user requesting data. Used for generating data reports. |
dataset_ids |
Integer vector of unique IDs for searching based on
dataset, e.g. NEON or GRSM |
email |
Optional field, string. Email of user requesting data. |
download_path |
Character, optional file path to the file for which to output the results. |
six_leaf_layer |
Boolean value when set to |
six_bloom_layer |
Boolean value when set to |
agdd_layer |
Numeric value, accepts |
six_sub_model |
Affects the results of the six layers returned. Can be
used to specify one of three submodels used to calculate the spring index
values. Thus setting this field will change the results of |
additional_layers |
Data frame with first column named |
pheno_class_ids |
Integer vector of unique IDs for searching based on
pheno class. Note that if both |
wkt |
WKT geometry by which filter data. Specifying a valid WKT within the contiguous US will filter data based on the locations which fall within that WKT. |
Most search parameters are optional. However, users are encouraged to supply
additional search parameters to get results that are easier to work with.
request_source
must be provided. This is a self-identifying string, telling
the service who is asking for the data or from where the request is being
made. It is recommended you provide your name or organization name. If the
call to this function is acting as an intermediary for a client, then you may
also optionally provide a user email and/or IP address for usage data
reporting later.
Additional fields provides the ability to specify more, non-critical fields to include in the search results. A complete list of additional fields can be found in the NPN service's companion documentation. Metadata on all fields can be found in the following Excel sheet: https://www.usanpn.org/files/metadata/status_intensity_datafield_descriptions.xlsx
A tibble of all status records returned as per the search
parameters. If download_path
is specified, the file path is returned
instead.
## Not run: #Download all saguaro data for 2016 npn_download_status_data( request_source = "Your Name or Org Here", years = c(2016), species_id = c(210), download_path = "saguaro_data_2016.csv" ) ## End(Not run)
## Not run: #Download all saguaro data for 2016 npn_download_status_data( request_source = "Your Name or Org Here", years = c(2016), species_id = c(210), download_path = "saguaro_data_2016.csv" ) ## End(Not run)
This function is for requesting AGDD point values. Because the NPN has a separate data service that can provide AGDD values which is more accurate than Geoserver this function is ideal when requested AGDD point values.
npn_get_agdd_point_data(layer, lat, long, date, store_data = TRUE)
npn_get_agdd_point_data(layer, lat, long, date, store_data = TRUE)
layer |
The name of the queried layer. |
lat |
The latitude of the queried point. |
long |
The longitude of the queried point. |
date |
The queried date. |
store_data |
Boolean value. If set |
As this function only works for AGDD point values, if it's necessary to
retrieve point values for other layers please try the npn_get_point_data()
function.
Returns a numeric value of the AGDD value at the specified
lat/long/date. If no value can be retrieved, then -9999
is returned.
## Not run: npn_get_agdd_point_data( layer = "gdd:agdd", lat = 32.4, long = -110, date = "2020-01-15" ) ## End(Not run)
## Not run: npn_get_agdd_point_data( layer = "gdd:agdd", lat = 32.4, long = -110, date = "2020-01-15" ) ## End(Not run)
This function takes a series of variables used in calculating AGDD and returns a raster of the continental USA with each pixel representing the calculated AGDD value based on start and end date. This function leverages the USA-NPN geo web services.
npn_get_custom_agdd_raster( method, climate_data_source, temp_unit, start_date, end_date, base_temp, upper_threshold = NULL )
npn_get_custom_agdd_raster( method, climate_data_source, temp_unit, start_date, end_date, base_temp, upper_threshold = NULL )
method |
Takes |
climate_data_source |
Specified the climate data set to use. Takes
either |
temp_unit |
The unit of temperature to use in the calculation. Takes
either |
start_date |
Date at which to begin the AGDD calculations. |
end_date |
Date at which to end the AGDD calculations. |
base_temp |
This is the lowest temperature for each day for it to be considered in the calculation. |
upper_threshold |
This parameter is only applicable for the double-sine method. This sets the highest temperature to be considered in any given day's AGDD calculation. |
A terra::SpatRaster object of each calculated AGDD numeric values based on specified time period/method/base temp/data source.
## Not run: res <- npn_get_custom_agdd_raster( method = "simple", climate_data_source = "NCEP", temp_unit = "Fahrenheit", start_date = "2020-01-01", end_date = "2020-01-15", base_temp = 32 ) ## End(Not run)
## Not run: res <- npn_get_custom_agdd_raster( method = "simple", climate_data_source = "NCEP", temp_unit = "Fahrenheit", start_date = "2020-01-01", end_date = "2020-01-15", base_temp = 32 ) ## End(Not run)
This function takes a series of variables used in calculating AGDD and returns an AGDD time series, based on start and end date, for a given location in the continental US. This function leverages the USA-NPN geo web services
npn_get_custom_agdd_time_series( method, start_date, end_date, base_temp, climate_data_source, temp_unit, lat, long, upper_threshold = NULL )
npn_get_custom_agdd_time_series( method, start_date, end_date, base_temp, climate_data_source, temp_unit, lat, long, upper_threshold = NULL )
method |
Takes |
start_date |
Date at which to begin the AGDD calculations. |
end_date |
Date at which to end the AGDD calculations. |
base_temp |
This is the lowest temperature for each day for it to be considered in the calculation. |
climate_data_source |
Specified the climate data set to use. Takes
either |
temp_unit |
The unit of temperature to use in the calculation. Takes
either |
lat |
The latitude of the location for which to calculate the time series. |
long |
The longitude of the location for which to calculate the time series. |
upper_threshold |
This parameter is only applicable for the double-sine method. This sets the highest temperature to be considered in any given day's AGDD calculation. |
A data frame containing the numeric AGDD values for each day for the specified time period/location/method/base temp/data source.
## Not run: res <- npn_get_custom_agdd_time_series( method = "double-sine", start_date = "2019-01-01", end_date = "2019-01-15", base_temp = 25, climate_data_source = "NCEP", temp_unit = "fahrenheit", lat = 39.7, long = -107.5, upper_threshold = 90 ) ## End(Not run)
## Not run: res <- npn_get_custom_agdd_time_series( method = "double-sine", start_date = "2019-01-01", end_date = "2019-01-15", base_temp = 25, climate_data_source = "NCEP", temp_unit = "fahrenheit", lat = 39.7, long = -107.5, upper_threshold = 90 ) ## End(Not run)
This function will return information about the various data layers available via the NPN's geospatial web services. Specifically, this function will query the NPN's GetCapabilities endpoint and parse the information on that page about the layers. For each layer, this function will retrieve the layer name (as to be specified elsewhere programmatically), the title (human readable), the abstract, which describes the data in the layer, the dimension name and dimension range for specifying specific date values from the layer.
npn_get_layer_details()
npn_get_layer_details()
Information about the layers can also be viewed at the getCapbilities page directly: https://geoserver.usanpn.org/geoserver/wms?request=GetCapabilities
A tibble containing all layer details as specified in function description.
## Not run: layers <- npn_get_layer_details() ## End(Not run)
## Not run: layers <- npn_get_layer_details() ## End(Not run)
This function gets a list of phenophases that are applicable for a provided taxonomic grouping, e.g. family, order. Note that since a higher taxononmic order will aggregate individual species not every phenophase returned through this function will be applicable for every species belonging to that taxonomic group.
npn_get_phenophases_for_taxon( family_ids = NULL, order_ids = NULL, class_ids = NULL, genus_ids = NULL, date = NULL, return_all = 0, ... )
npn_get_phenophases_for_taxon( family_ids = NULL, order_ids = NULL, class_ids = NULL, genus_ids = NULL, date = NULL, return_all = 0, ... )
family_ids |
Integer vector of taxonomic family ids to search for. |
order_ids |
Integer vector of taxonomic order ids to search for. |
class_ids |
Integer vector of taxonomic class ids to search for |
genus_ids |
Integer vector of taxonomic genus ids to search for |
date |
Specify the date of interest. For this function to return
anything, either this value must be set or |
return_all |
Takes either |
... |
Currently unused. |
It's also important to note that phenophase definitions can change for individual species over time, so there's a need to specify either a date of interest, or to explicitly state that the function should return all phenophases that were ever applicable for any species belonging to the specified taxonomic group.
When called, this function requires of these three parameters, exactly one of
family_ids
, order_ids
or class_ids
to be set.
A data frame listing phenophases in the NPN database for the specified taxon and date.
## Not run: npn_get_phenophases_for_taxon(class_ids = c(5, 6), date = "2018-05-05") npn_get_phenophases_for_taxon(family_ids = c(267, 268), date = "2018-05-05") #if you supply two or more "ids" arguments, the highest classification takes precedence pheno <- npn_get_phenophases_for_taxon( class_ids = 4, family_ids = c(103, 104), genus_ids = c(409, 957, 610), date = "2018-05-05" ) colnames(pheno) # [1] "family_id" "family_name" "phenophases" ## End(Not run)
## Not run: npn_get_phenophases_for_taxon(class_ids = c(5, 6), date = "2018-05-05") npn_get_phenophases_for_taxon(family_ids = c(267, 268), date = "2018-05-05") #if you supply two or more "ids" arguments, the highest classification takes precedence pheno <- npn_get_phenophases_for_taxon( class_ids = 4, family_ids = c(103, 104), genus_ids = c(409, 957, 610), date = "2018-05-05" ) colnames(pheno) # [1] "family_id" "family_name" "phenophases" ## End(Not run)
This function can get point data about any of the NPN geospatial layers.
npn_get_point_data(layer, lat, long, date, store_data = TRUE)
npn_get_point_data(layer, lat, long, date, store_data = TRUE)
layer |
The coverage id (machine name) of the layer for which to
retrieve. Applicable values can be found via the |
lat |
The latitude of the point. |
long |
The longitude of the point. |
date |
The date for which to get a value. |
store_data |
Boolean value. If set |
Please note that this function pulls this from the NPN's WCS service so the
data may not be totally precise. If you need precise AGDD values try using
the npn_get_agdd_point_data()
function.
Returns a numeric value for any NPN geospatial data layer at the
specified lat/long/date. If no value can be retrieved, then -9999
is
returned.
## Not run: value <- npn_get_point_data( layer = "gdd:agdd", lat = 38.8, long = -110.5, date = "2022-05-05" ) ## End(Not run)
## Not run: value <- npn_get_point_data( layer = "gdd:agdd", lat = 38.8, long = -110.5, date = "2022-05-05" ) ## End(Not run)
Returns a list of all groups participating in the NPN's data collection program. These details can be used to further filter other service endpoints' results.
npn_groups(use_hierarchy = FALSE, ...)
npn_groups(use_hierarchy = FALSE, ...)
use_hierarchy |
Boolean indicating whether or not the list of networks
should be represented in a hierarchy. If |
... |
Currently unused. |
A tibble (or nested list if use_hierarchy = TRUE
) of partner
groups, including network_id
and network_name
.
## Not run: npn_groups() npn_groups(use_heirarchy = TRUE) ## End(Not run)
## Not run: npn_groups() npn_groups(use_heirarchy = TRUE) ## End(Not run)
Look up species IDs by taxonomic or common name
npn_lookup_names(name, type = "genus", fuzzy = FALSE)
npn_lookup_names(name, type = "genus", fuzzy = FALSE)
name |
A scientific or common name. |
type |
One of |
fuzzy |
Logical; if |
A data frame with species ID numbers based on the name and type parameters.
## Not run: npn_lookup_names(name = 'Pinus', type = 'genus') npn_lookup_names(name = 'pine', type = 'common_name') npn_lookup_names(name = 'bird', type = 'common_name', fuzzy = TRUE) ## End(Not run)
## Not run: npn_lookup_names(name = 'Pinus', type = 'genus') npn_lookup_names(name = 'pine', type = 'common_name') npn_lookup_names(name = 'bird', type = 'common_name', fuzzy = TRUE) ## End(Not run)
Gets information about all pheno classes, which are a higher-level order of phenophases.
npn_pheno_classes(...)
npn_pheno_classes(...)
... |
Currently unused. |
A tibble listing the pheno classes in the NPN database.
## Not run: pc <- npn_pheno_classes() ## End(Not run)
## Not run: pc <- npn_pheno_classes() ## End(Not run)
Retrieves a complete list of all phenophase definitions.
npn_phenophase_definitions(...)
npn_phenophase_definitions(...)
... |
Currently unused. |
A tibble listing all phenophases in the NPN database and their definitions.
## Not run: pp <- npn_phenophase_definitions() ## End(Not run)
## Not run: pp <- npn_phenophase_definitions() ## End(Not run)
Retrieves additional details for select phenophases, including full list of applicable phenophase definition IDs and phenophase revision notes over time
npn_phenophase_details(ids = NULL, ...)
npn_phenophase_details(ids = NULL, ...)
ids |
Takes a vector of phenophase ids for which to retrieve additional details. |
... |
Currently unused. |
A tibble listing phenophases in the NPN database, including detailed information for each, filtered by the phenophase ID.
## Not run: pd <- npn_phenophase_details(c(56, 57)) ## End(Not run)
## Not run: pd <- npn_phenophase_details(c(56, 57)) ## End(Not run)
Retrieves a complete list of all phenophases in the NPN database.
npn_phenophases(...)
npn_phenophases(...)
... |
Currently unused. |
A tibble listing all phenophases available in the NPN database.
## Not run: phenophases <- npn_phenophases() ## End(Not run)
## Not run: phenophases <- npn_phenophases() ## End(Not run)
Retrieves the phenophases applicable to species for a given date. It's important to specify a date since protocols/phenophases for any given species can change from year to year.
npn_phenophases_by_species(species_ids, date, ...)
npn_phenophases_by_species(species_ids, date, ...)
species_ids |
Integer vector of species IDs for which to get phenophase information. |
date |
The applicable date for which to retrieve phenophases for the given species. |
... |
Currently unused. |
A tibble listing phenophases in the NPN database for the specified species and date.
## Not run: pp <- npn_phenophases_by_species(3, "2018-05-05") ## End(Not run)
## Not run: pp <- npn_phenophases_by_species(3, "2018-05-05") ## End(Not run)
By default this library will call the NPN's production services but in some cases it's preferable to access the development web services so this function allows for manually setting the web service endpoints to use DEV instead. Just pass in "dev" to this function to change the endpoints to use.
npn_set_env(env = "ops")
npn_set_env(env = "ops")
env |
The environment to use. Should be "ops" or "dev" |
Returns a complete list of all species information of species represented in the NPN database.
Returns information about a species based on the NPN's unique ID for that species
Search for species by state
Search NPN species information using a number of different parameters, which can be used in conjunction with one another, including:
Species on which a particular group or groups are actually collecting data
What species were observed in a given date range
What species were observed at a particular station or stations
npn_species(...) npn_species_id(ids, ...) npn_species_state(state, kingdom = NULL, ...) npn_species_search( network = NULL, start_date = NULL, end_date = NULL, station_id = NULL, ... )
npn_species(...) npn_species_id(ids, ...) npn_species_state(state, kingdom = NULL, ...) npn_species_search( network = NULL, start_date = NULL, end_date = NULL, station_id = NULL, ... )
... |
Currently unused. |
ids |
Integer vector of species ids for which to retrieve information. |
state |
A US postal state code to filter results. |
kingdom |
Filters results by taxonomic kingdom. Valid values include
|
network |
filter species based on identifiers of NPN groups that are actually observing data on the species. Takes a single numeric ID. |
start_date |
filter species by date observed. This sets the start date
of the date range and must be used in conjunction with |
end_date |
filter species by date observed. This sets the end date of
the date range and must be used in conjunction with |
station_id |
filter species by a numeric vector of unique site identifiers. |
A tibble with information on species in the NPN database and their IDs.
A tibble with information on species in the NPN database and their IDs, filtered by the species ID parameter.
A tibble with information on species in the NPN database whose distribution includes a given state.
A tibble with information on species in the NPN database filtered by partner group, dates and station/site IDs.
## Not run: npn_species() ## End(Not run) ## Not run: npn_species_id(ids = 3) ## End(Not run) ## Not run: npn_species_state(state = "AZ") npn_species_state(state = "AZ", kingdom = "Plantae") ## End(Not run) ## Not run: species <- npn_species_search( start_date = "2013-01-01", end_date = "2013-05-15" ) ## End(Not run)
## Not run: npn_species() ## End(Not run) ## Not run: npn_species_id(ids = 3) ## End(Not run) ## Not run: npn_species_state(state = "AZ") npn_species_state(state = "AZ", kingdom = "Plantae") ## End(Not run) ## Not run: species <- npn_species_search( start_date = "2013-01-01", end_date = "2013-05-15" ) ## End(Not run)
Return all plant or animal functional types used in the NPN database.
npn_species_types(kingdom = "Plantae", ...)
npn_species_types(kingdom = "Plantae", ...)
kingdom |
Filters results by taxonomic kingdom. Valid values include
|
... |
Currently unused. |
A data frame with a list of the functional types used in the NPN database, filtered by the specified kingdom.
## Not run: npn_species_types("Plantae") ## End(Not run)
## Not run: npn_species_types("Plantae") ## End(Not run)
Get a list of all stations, optionally filtered by state
npn_stations(state_code = NULL, ...)
npn_stations(state_code = NULL, ...)
state_code |
The postal code of the US state by which to filter the results returned. Leave empty to get all stations. |
... |
Currently unused. |
A data frame with stations' latitude and longitude, names, and ids.
## Not run: npn_stations() npn_stations('AZ') ## End(Not run)
## Not run: npn_stations() npn_stations('AZ') ## End(Not run)
Takes a Well-Known Text based geography as input and returns data for all stations, including unique IDs, within that boundary.
npn_stations_by_location(wkt, ...)
npn_stations_by_location(wkt, ...)
wkt |
Required field specifying the WKT geography to use. |
... |
Currently unused. |
A data frame listing stations filtered based on the WKT geography.
## Not run: head(npn_stations_by_state(wkt = "POLYGON(( -110.94484396954107 32.23623109416672,-110.96166678448247 32.23594069208043, -110.95960684795904 32.21328646993733,-110.94244071026372 32.21343170728929, -110.93935080547857 32.23216538049456,-110.94484396954107 32.23623109416672))") ) ## End(Not run)
## Not run: head(npn_stations_by_state(wkt = "POLYGON(( -110.94484396954107 32.23623109416672,-110.96166678448247 32.23594069208043, -110.95960684795904 32.21328646993733,-110.94244071026372 32.21343170728929, -110.93935080547857 32.23216538049456,-110.94484396954107 32.23623109416672))") ) ## End(Not run)
Get number of stations by state.
npn_stations_by_state(...)
npn_stations_by_state(...)
... |
Currently unused. |
A data frame listing stations by state.
## Not run: head(npn_stations_by_state()) ## End(Not run)
## Not run: head(npn_stations_by_state()) ## End(Not run)
Get a list of all stations which have an individual whom is a member of a set of species.
npn_stations_with_spp(species_id, ..., speciesid = deprecated())
npn_stations_with_spp(species_id, ..., speciesid = deprecated())
species_id |
Required. Species id numbers, from 1 to infinity,
potentially, use e.g., |
... |
Currently unused. |
speciesid |
Deprecated. Use |
A data frame with stations' latitude and longitude, names, and ids.
## Not run: npn_stations_with_spp(species_id = c(52, 53, 54)) npn_stations_with_spp(species_id = 53) ## End(Not run)
## Not run: npn_stations_with_spp(species_id = c(52, 53, 54)) npn_stations_with_spp(species_id = 53) ## End(Not run)
npn_obsspbyday()
: Removed.
npn_allobssp()
: Removed.
npn_indspatstations()
: Removed.
npn_indsatstations()
: Removed.
npn_stationsbystate()
: Removed.
npn_stationswithspp()
: Removed.