| Type: | Package |
| Title: | Tools for Working with 'StreamCat' and 'LakeCat' Data |
| Version: | 0.12.0 |
| Date: | 2026-09-23 |
| Author: | Marc Weber [aut, cre], Ryan Hill [aut], Selia Markley [aut], Travis Hudson [aut], Allen Brookes [aut], David Rebhuhn [ctb], Michael Dumelle [ctb], Justin Bousquin [ctb], Zachary Smith [ctb] |
| Maintainer: | Marc Weber <weber.marc@epa.gov> |
| Description: | Tools for using the 'StreamCat' and 'LakeCat' API and interacting with the 'StreamCat' and 'LakeCat' database. Convenience functions in the package wrap the API for 'StreamCat' on https://api.epa.gov/StreamCat/streams/metrics. |
| Depends: | R (≥ 4.1.0) |
| Imports: | sf, hydrogeofetch, jsonlite, httr2, curl (≥ 6.0.0), ggpattern, patchwork, cowplot, tigris, ggplot2, dplyr, tidyr, stringr, tibble, |
| Suggests: | mapview, testthat, knitr, rmarkdown, devtools, xml2, magrittr, readr, purrr, lifecycle, tidyselect, DBI, duckdb, tictoc, stats, wk |
| Encoding: | UTF-8 |
| URL: | https://usepa.github.io/StreamCatTools/, https://github.com/USEPA/StreamCatTools |
| BugReports: | https://github.com/USEPA/StreamCatTools/issues |
| VignetteBuilder: | knitr |
| License: | MIT + file LICENSE |
| NeedsCompilation: | no |
| Config/roxygen2/version: | 8.1.0 |
| Packaged: | 2026-10-02 19:15:33 UTC; mweber |
| Repository: | CRAN |
| Date/Publication: | 2026-10-02 19:50:09 UTC |
Validate COMIDs
Description
Checks user supplied COMIDs against valid COMID values in LakeCat
and returns a message if any COMIDs are not valid COMIDs.
Called internally by
lc_get_data when validate = TRUE.
Checks user supplied COMIDs against valid COMID values in StreamCat
and returns a message if any COMIDs are not valid COMIDs.
Called internally by
sc_get_data when validate = TRUE.
Usage
.parse_comids(comids)
.parse_comids(comids)
Arguments
comids |
Integer or character vector of COMIDs to validate. Accepts
the same formats as the |
Details
Validation works by querying the NLDI for valid COMIDs with the supplied COMIDs and comparing these COMIDs against those requested. Any COMID absent from the official list is considered invalid — i.e., it does not correspond to an NHDPlusV2 catchment recognized by LakeCat.
Validation works by querying the NLDI for valid COMIDs with the supplied COMIDs and comparing these COMIDs against those requested. Any COMID absent from the official list is considered invalid — i.e., it does not correspond to an NHDPlusV2 catchment recognized by StreamCat. Additionally, error is raised for any COMIDs that are part of the COMIDs connectors in the Great Lakes that are not included in StreamCat
Value
A character vector of COMIDs from comids that were
not found in the StreamCat database. Returns character(0)
if all supplied COMIDs are valid.
A character vector of COMIDs from comids that were
not found in the StreamCat database. Returns character(0)
if all supplied COMIDs are valid.
Author(s)
Marc Weber
See Also
Lookup Full Metric Name
Description
Function to retrieve a full metric name based on the short name using the LakeCat API.
Usage
lc_fullname(metric = NULL)
Arguments
metric |
Short metric name Syntax: metric=value1 Values: metric |
Value
A lookup of the full name for a given LakeCat metric
Author(s)
Marc Weber
Examples
## Not run:
fullname <- lc_fullname(metric='clay')
## End(Not run)
Get Lake COMIDs
Description
Function to return NHDPlusV2 Waterbody COMIDS using either a dataframe with coordinates and a specified CRS or an sf object. The function generates a vector of NHDPlus Waterbody COMID values a user can then pass to lc_get_data function
Usage
lc_get_comid(
dd = NULL,
xcoord = NULL,
ycoord = NULL,
crsys = NULL,
buffer = NULL
)
Arguments
dd |
Name of data frame object. Can be a simple data frame with coordinate columns in a known CRS or an sf points data frame |
xcoord |
The x coordinate column if using a raw data frame |
ycoord |
The y coordinate column if using a raw data frame |
crsys |
The epsg code if using a raw data frame |
buffer |
The amount of buffer to use to extend search for a waterbody (simply passed to hydrogeofetch::get_waterbodies) |
Value
A new sf data frame with a populated 'COMID' column
Author(s)
Marc Weber
Examples
## Not run:
dd <- data.frame(x = c(-89.198,-114.125,-122.044),
y = c(45.502,47.877,43.730))
comids <- lc_get_comid(dd, xcoord='x',
ycoord='y', crsys=4269)
dd <- data.frame(x = c(-89.198,-114.125,-122.044),
y = c(45.502,47.877,43.730)) |>
sf::st_as_sf(coords = c('x', 'y'), crs = 4326)
comids <- lc_get_comid(dd)
## End(Not run)
Get LakeCat data
Description
Function to return LakeCat metrics using the StreamCat API. The function allows a user to get specific metric data aggregated by area of interest, returned by comid(s), hydroregion(s), state(s), or county(ies).
Usage
lc_get_data(
comid = NULL,
metric = NULL,
aoi = NULL,
showAreaSqKm = NULL,
showPctFull = NULL,
state = NULL,
county = NULL,
region = NULL,
conus = NULL,
countOnly = NULL
)
Arguments
comid |
Return metric information for specific COMIDs. Can be a comma-delimited list, a character vector,
or any object that can be coerced to a comma-delimited list with |
metric |
Name(s) of metrics to query. Must be character string with comma-delimited list of metrics. Not case-sensitive. Syntax: name=<name1>,<name2> |
aoi |
Specify the area of interest described by a metric. By default, all available areas of interest for a given metric are returned. Case-sensitive. Syntax: areaOfInterest=<value1>,<value2> Values: catchment|watershed| |
showAreaSqKm |
Return the area in square kilometers of a given area of interest. The default value is false. Values: true|false |
showPctFull |
Return the pctfull for each dataset. The default value is false. Values: true|false |
state |
Return metric information for COMIDs within a specific state. Use a state's abbreviation to
query for a given state. One of |
county |
Return metric information for COMIDs within a specific county.
Users must use the FIPS code, not county name, as a way to disambiguate counties.
One of |
region |
Return metric information for COMIDs within a specified hydroregion.
Hydroregions are specified using full name i.e. |
conus |
Return all COMIDs in the conterminous United States. Character string (Not case-sensitive) or logical.
The default value is false. If true, |
countOnly |
Return a CSV containing only the row count (ROWCOUNT) and the column count (COLUMNCOUNT) that the server expects to return in a request. The default value is false. Values: true|false |
Value
A tibble of desired StreamCat metrics. If data are missing for all rows of a given metric, then the column for that metric will not exist. If data are missing for only some rows, then they will be specified with NA.
Author(s)
Marc Weber
Examples
## Not run:
df <- lc_get_data(comid='23794487', aoi='cat', metric='fert')
df <- lc_get_data(metric='pcturbmd2006', aoi='ws',
comid='24083377')
df <- lc_get_data(metric='pctgrs2006', aoi='ws', region='Region01')
df <- lc_get_data(metric='pctwdwet2006', aoi='ws', county='41003')
df <- lc_get_data(metric='pcturbmd2006', aoi='ws',
comid='24083377', showAreaSqKm=FALSE, showPctFull=TRUE)
df <- lc_get_data(metric='pcturbmd2006,damdens',
aoi='cat,ws', comid='23783629,23794487,23812618')
df <- lc_get_data(metric='pcturbmd2006,damdens',
aoi='cat,ws', comid=c('23783629','23794487','23812618'))
df <- lc_get_data(metric='pcturbmd2006,damdens',
aoi='cat,ws', comid='23783629,23794487,23812618',
countOnly=TRUE)
## End(Not run)
Get LakeCat Metric Names
Description
Function to filter LakeCat metrics metrics by category, area of interest, dataset or year. Use 'lc_get_params(categories)' or 'lc_get_params(datasets)' to see all the valid category or dataset options
Usage
lc_get_metric_names(category = NULL, aoi = NULL, year = NULL, dataset = NULL)
Arguments
category |
Filter LakeCat metrics based on the metric category |
aoi |
Filter LakeCat metrics based on the area of interest |
year |
Filter LakeCat metrics based on a particular year or years |
dataset |
Filter LakeCat metrics based on the dataset name |
Value
A dataframe of metrics and description that match filter criteria
Author(s)
Marc Weber
Examples
## Not run:
metrics <- lc_get_metric_names(category='Natural')
metrics <- lc_get_metric_names(category = c('Anthropogenic','Natural'),
aoi=c('Cat','Ws'))
## End(Not run)
Get NLCD Data
Description
'r lifecycle::badge("deprecated")' 'lc_nlcd()' was renamed to 'lc_get_nlcd()' to create a more consistent API. Function to specifically retrieve all NLCD metrics for a given year using the StreamCat API.
Usage
lc_get_nlcd(
year = "2019",
comid = NULL,
aoi = NULL,
showAreaSqKm = NULL,
showPctFull = NULL,
state = NULL,
county = NULL,
region = NULL,
conus = NULL,
countOnly = NULL
)
Arguments
year |
Years(s) of NLCD metrics to query. Only valid NLCD years are accepted (i.e. 2001, 2004, 2006, 2008, 2011, 2013, 2016, 2019) Syntax: year=<year1>,<year2> |
comid |
Return metric information for specific COMIDs Syntax: comid=<comid1>,<comid2> |
aoi |
Specify the area of interest described by a metric. By default, all available areas of interest for a given metric are returned. Syntax: areaOfInterest=<value1>,<value2> Values: catchment|watershed|riparian_catchment|riparian_watershed|other |
showAreaSqKm |
Return the area in square kilometers of a given area of interest. The default value is false. Values: true|false |
showPctFull |
Return the pctfull for each dataset. The default value is false. Values: true|false |
state |
Return metric information for COMIDs within a specific state. Use a state's abbreviation to query for a given state. Syntax: state=<state1>,<state2> |
county |
Return metric information for COMIDs within a specific county. Users must use the FIPS code, not county name, as a way to disambiguate counties. Syntax: county=<county1>,<county1> |
region |
Return metric information for COMIDs within a specified hydroregion. Syntax: region=<regionid1>,<regionid2> |
conus |
Return all COMIDs in the conterminous United States. The default value is false. Values: true|false |
countOnly |
Return a CSV containing only the row count (ROWCOUNT) and the column count (COLUMNCOUNT) that the server expects to return in a request. The default value is false. Values: true|false |
Value
A tibble of desired StreamCat metrics
Author(s)
Marc Weber
Examples
## Not run:
df <- lc_get_nlcd(comid='23783629', year='2019', aoi='ws') # Will show a deprecation warning
df <- lc_get_nlcd(comid='23783629', year='2019', aoi='ws')
df <- lc_get_nlcd(year='2016', aoi='cat',
comid='23783629,23794487,23812618', showAreaSqKm=FALSE, showPctFull=TRUE)
df <- lc_get_nlcd(year='2016', aoi='cat',
comid='23783629,23794487,23812618', countOnly=TRUE)
df <- lc_get_nlcd(year='2016, 2019', aoi='cat,ws',
comid='23783629,23794487,23812618')
## End(Not run)
Get NNI
Description
Function to get all NNI data available for a given year.
Usage
lc_get_nni(
year,
aoi = NULL,
comid = NULL,
showAreaSqKm = TRUE,
showPctFull = NULL,
countOnly = NULL
)
Arguments
year |
Years(s) of NNI metrics to query. Only valid NNI years are accepted (1987:2017) Syntax: year=<year1>,<year2> |
aoi |
Specify the area of interest described by a metric. By default, all available areas of interest for a given metric are returned. Syntax: areaOfInterest=<value1>,<value2> Values: catchment|watershed |
comid |
Return metric information for specific COMIDs Syntax: comid=<comid1>,<comid2> |
showAreaSqKm |
Return the area in square kilometers of a given area of interest. The default value is true. Values: true|false |
showPctFull |
Return the pctfull for each dataset. The default value is false. Values: true|false |
countOnly |
Return a CSV containing only the row count (ROWCOUNT) and the column count (COLUMNCOUNT) that the server expects to return in a request. The default value is false. Values: true|false |
Value
A tibble of desired StreamCat metrics
Author(s)
Selia Markley
Examples
df <- lc_get_nni(year='1987, 1990, 2005, 2017', aoi='cat,ws',
comid='23783629,23794487,23812618')
df <- lc_get_nni(year='2015', aoi='cat',
comid='23783629', countOnly=TRUE)
df <- lc_get_nni(comid='23783629', year='2011, 2012', aoi='ws')
Get LakeCat Parameters
Description
Function to return available LakeCat parameters using the StreamCat API.
Usage
lc_get_params(param = NULL)
Arguments
param |
List of available parameters in the API for the following options: name, areaofInterest, region, state, county. State and county return a data frame that includes FIPS codes, names and state abbreviations Syntax: param=<value1>,<value2> Values: name|area |
Value
A list of all the current LakeCat values for a given parameter
Author(s)
Marc Weber
Examples
## Not run:
params <- lc_get_params(param='variable_info')
params <- lc_get_params(param='metric_names')
params <- sc_get_params(param='categories')
params <- lc_get_params(param='aoi')
params <- lc_get_params(param='state')
params <- lc_get_params(param='county')
params <- sc_get_params(param='datasets')
## End(Not run)
Get LakeCat Lake Watershed
Description
Lookup function for a single COMID from S3 GeoParquet (optionally restricted to one HUC2). Queries one COMID from an S3-hosted, HUC2-partitioned GeoParquet dataset and returns an sf object. If 'huc2' is provided, only that partition is scanned (fastest). If not, the function tries a glob over all HUC2 partitions and falls back to a shallower pattern if needed. The function: - loads DuckDB httpfs (S3) extension, - pushes an equality filter on 'COMID' for row-group/file pruning, - converts WKB geometry to sf with the CRS you provide (default EPSG:4326).
Usage
lc_get_watershed(
comid,
huc2 = NA_character_,
huc2_filter = NULL,
bucket = "dmap-data-commons-ow",
prefix = "data/streamcat/LakeCatWatersheds/",
region = "us-east-1",
install_missing = FALSE,
keep_open = FALSE,
verbose = TRUE,
progress = TRUE,
threads = 4,
enable_object_cache = TRUE,
skip_describe = FALSE,
skip_counts = TRUE,
sf_crs = 4326,
retries = 5,
retry_base_delay = 0.5,
retry_max_delay = 8,
url_style = c("path", "virtual_hosted"),
s3_endpoint = NULL
)
Arguments
comid |
Scalar COMID to query (numeric or character, required). |
huc2 |
Optional two-digit HUC2 string (e.g., "01") to restrict search to one partition. |
huc2_filter |
Optional character vector of HUC2s to read (e.g., c("01","05")) for multi-partition pruning. |
bucket |
Character(1). S3 bucket (default "dmap-data-commons-ow"). |
prefix |
Character(1). S3 prefix under the bucket (default "data/streamcat/LakeCatWatersheds/"). |
region |
Character(1). S3 region (default "us-east-1"). |
install_missing |
Logical. Install missing packages (duckdb, DBI, sf, wk) if needed (default FALSE). |
keep_open |
Logical. Keep the DuckDB connection open (default FALSE). Note: the connection is not returned. |
verbose |
Logical. Print progress messages (default TRUE). |
progress |
Logical. Show a simple progress bar (default TRUE). |
threads |
Integer or NULL. If set, 'PRAGMA threads' for DuckDB (parallelism). |
enable_object_cache |
Logical. Enable DuckDB object cache to speed repeated queries (default TRUE). |
skip_describe |
Logical. Skip DESCRIBE step (default FALSE). |
skip_counts |
Logical. Skip HUC2 counts step (default TRUE; no longer returned). |
sf_crs |
Integer or character. CRS for the output sf object (default 4326). |
retries |
Integer. Number of retries for transient S3/HTTP errors (default 5). |
retry_base_delay |
Numeric. Initial exponential backoff delay in seconds (default 0.5). |
retry_max_delay |
Numeric. Maximum backoff delay per attempt in seconds (default 8). |
url_style |
Character. S3 URL style used by DuckDB httpfs, one of "path" or "virtual_hosted". Passed to 'match.arg()', default "path". |
s3_endpoint |
Optional character(1). Custom S3 endpoint hostname (e.g., "s3.amazonaws.com"). NULL uses the default for the selected region. |
Value
An sf object with zero or one+ rows (if multiple features share the same COMID).
Plot National Nutrient Inventory data for lakes
Description
Function to plot time series of nitrogen and phosphorus budgets for a given lake COMID. This function allows a user to return a time series of major inputs, outputs, and derived metrics of nitrogen and phosphorus. Plot is returned as an object
Usage
lc_plotnni(comid, include.nue = FALSE)
Arguments
comid |
Identifier of lake COMID user wants to plot NNI data for. Must be a character string with the COMID digit. Syntax: com=<COMID> |
include.nue |
Include time series of nitrogen use efficiency in the returned plot. The default value is false. Values: true|false |
Value
Return plot as an object.
Author(s)
Selia Markley
Examples
## Not run:
p <- lc_plotnni(comid='23794487')
p <- lc_plotnni(comid='23794487', include.nue=TRUE)
## End(Not run)
Lookup Full Metric Name
Description
Function to retrieve a full metric name based on the short name using the StreamCat API.
Usage
sc_fullname(metric = NULL)
Arguments
metric |
Short metric name Syntax: metric=value1 Values: metric |
Value
A lookup of the full name for a given StreamCat metric
Author(s)
Marc Weber
Examples
fullname <- sc_fullname(metric='clay')
Get COMIDs via ArcGIS batch query
Description
Retrieve NHDPlus catchment FEATUREID (COMID) for a set of point locations by batching points to an ArcGIS Feature Service /query endpoint and mapping the returned catchment geometries back to the input points via a local spatial intersection. This avoids per-point HTTP requests and is faster for moderate-to-large point sets.
Usage
sc_get_comid(
points_sf,
service_layer_url = paste0("https://watersgeo.epa.gov/arcgis/rest/services/",
"NHDPlus_NP21/Catchments_NP21_Simplified/MapServer/0"),
layer_id = NULL,
chunk_size = 1000,
feature_id_field = "FEATUREID",
verbose = TRUE,
crs = NULL,
coords = NULL
)
Arguments
points_sf |
An 'sf' POINT object containing the input locations. If you supply a plain 'data.frame', convert it to an 'sf' object first. |
service_layer_url |
URL to the ArcGIS service layer. Defaults to the EPA NHDPlus catchments endpoint. |
layer_id |
Deprecated. This argument is kept only for backward compatibility. If supplied, it is appended to 'service_layer_url' after trimming any trailing slash. |
chunk_size |
Number of points to send per batch request. Default is 1000. |
feature_id_field |
Name of the feature attribute to return as the COMID. Default is '"FEATUREID"'. |
verbose |
Logical; print progress messages for each chunk. Default is 'TRUE'. |
crs |
Optional CRS for the input points when a 'data.frame' is supplied or when an 'sf' object has no attached CRS. Use an EPSG code such as 4326. |
coords |
Optional character vector of length 2 giving x/y coordinate column names when 'points_sf' is a data frame. Example: 'c("lon", "lat")'. |
Value
An integer vector of FEATUREID (COMID) values in the same order as the input points. Missing values are returned as 'NA'.
Examples
## Not run:
pts <- sf::st_as_sf(
data.frame(
id = 1:3,
x = c(-90, -90.1, -90.2),
y = c(40, 40.1, 40.2)
),
coords = c("x", "y"),
crs = 4326
)
comids <- sc_get_comid(points_sf = pts, chunk_size = 500)
## End(Not run)
Get StreamCat data
Description
Function to return StreamCat catchment and watershed metrics using the StreamCat API. The function allows a user to get specific metric data aggregated by area of interest, returned by comid(s), hydroregion(s), state(s), or county(ies).
Usage
sc_get_data(
comid = NULL,
metric = NULL,
aoi = NULL,
showAreaSqKm = NULL,
showPctFull = NULL,
state = NULL,
county = NULL,
region = NULL,
conus = NULL,
countOnly = NULL
)
Arguments
comid |
Return metric information for specific COMIDs. Can be a comma-delimited list, a character vector,
or any object that can be coerced to a comma-delimited list with |
metric |
Name(s) of metrics to query. Must be character string with comma-delimited list of metrics,
or, if |
aoi |
Name(s) of areas of interest to query.
If a metric does not have data for a given AOI, no data is returned for that AOI.
Certain metrics that have no AOI specified for StreamCat need the AOI to be specified as Syntax: areaOfInterest=<value1>,<value2> Values: cat|ws|catrp100|wsrp100|other |
showAreaSqKm |
Return the area in square kilometers of a given area of interest. The default value is false. Values: true|false |
showPctFull |
Return the pctfull for each dataset. The default value is false. Values: true|false |
state |
Return metric information for COMIDs within a specific state. Use a state's abbreviation to
query for a given state. One of |
county |
Return metric information for COMIDs within a specific county.
Users must use the FIPS code, not county name, as a way to disambiguate counties.
One of |
region |
Return metric information for COMIDs within a specified hydroregion.
Hydroregions are specified using full name i.e. |
conus |
Return all COMIDs in the conterminous United States. Character string (Not case-sensitive) or logical.
The default value is false. If true, |
countOnly |
Return a CSV containing only the row count (ROWCOUNT) and the column count (COLUMNCOUNT) that the server expects to return in a request. The default value is false. Values: true|false |
Value
A data frame of StreamCat metrics. If data are missing for all rows of a given metric, then the column for that metric will not exist. If data are missing for only some rows, then they will be specified with NA.
Author(s)
Marc Weber
Examples
## Not run:
df <- sc_get_data(comid='179', aoi='cat', metric='fert')
df <- sc_get_data(metric='pctgrs2006', aoi='ws', region='Region01')
df <- sc_get_data(metric='pctwdwet2006', aoi='ws', county='41003')
df <- sc_get_data(metric='pcturbmd2006', aoi='ws,rp100',
comid='1337420')
df <- sc_get_data(metric='pcturbmd2006,damdens',
aoi='cat,ws', comid='179,1337,1337420')
df <- sc_get_data(metric='pcturbmd2006,damdens',
aoi='cat,ws', comid='179,1337,1337420',
showAreaSqKm='true', showPctFull='true')
df <- sc_get_data(metric='pcturbmd2006,damdens',
aoi='cat,ws', comid='179,1337,1337420', countOnly='true')
df <- sc_get_data(metric='thalwagdepth', comid='179,1337,1337420', aoi='other')
df <- sc_get_data(metric='thalwagdepth', comid=c('179','1337','1337420'), aoi='other')
df <- sc_get_data(comid='179', aoi='ws', metric='all')
## End(Not run)
Get StreamCat Metric Names
Description
Function to filter StreamCat metrics metrics by category, area of interest, dataset or year. Use 'sc_get_params(categories)' or 'sc_get_params(datasets)' to see all the valid category or dataset options
Usage
sc_get_metric_names(category = NULL, aoi = NULL, year = NULL, dataset = NULL)
Arguments
category |
Filter StreamCat metrics based on the metric category |
aoi |
Filter StreamCat metrics based on the area of interest |
year |
Filter StreamCat metrics based on a particular year or years |
dataset |
Filter StreamCat metrics based on the dataset name |
Value
A dataframe of metrics and description that match filter criteria
Author(s)
Marc Weber
Examples
## Not run:
metrics <- sc_get_metric_names(category='Wildfire')
metrics <- sc_get_metric_names(category = c('Deposition','Climate'),
aoi=c('Cat','Ws'))
metrics <- sc_get_metric_names(aoi='Other',
dataset=c('Canal Density','Predicted Channel Widths Depths'))
## End(Not run)
Get NLCD Data
Description
'r lifecycle::badge("deprecated")' 'sc_nlcd()' was renamed to 'sc_get_nlcd()' to create a more consistent API. Function to retrieve all NLCD metrics for a given year using the StreamCat API.
Usage
sc_get_nlcd(
year = "2019",
comid = NULL,
aoi = NULL,
showAreaSqKm = NULL,
showPctFull = NULL,
state = NULL,
county = NULL,
region = NULL,
conus = NULL,
countOnly = NULL
)
sc_nlcd(
year = "2019",
comid = NULL,
aoi = NULL,
showAreaSqKm = NULL,
showPctFull = NULL,
state = NULL,
county = NULL,
region = NULL,
conus = NULL,
countOnly = NULL
)
Arguments
year |
Years(s) of NLCD metrics to query. Only valid NLCD years are accepted (i.e. 2001, 2004, 2006, 2008, 2011, 2013, 2016, 2019) Syntax: year=<year1>,<year2> |
comid |
Return metric information for specific COMIDs Syntax: comid=<comid1>,<comid2> |
aoi |
Specify the area of interest described by a metric. By default, all available areas of interest for a given metric are returned. Syntax: areaOfInterest=<value1>,<value2> Values: catchment|watershed|riparian_catchment|riparian_watershed|other |
showAreaSqKm |
Return the area in square kilometers of a given area of interest. The default value is false. Values: true|false |
showPctFull |
Return the pctfull for each dataset. The default value is false. Values: true|false |
state |
Return metric information for COMIDs within a specific state. Use a state's abbreviation to query for a given state. Syntax: state=<state1>,<state2> |
county |
Return metric information for COMIDs within a specific county. Users must use the FIPS code, not county name, as a way to disambiguate counties. Syntax: county=<county1>,<county1> |
region |
Return metric information for COMIDs within a specified hydroregion. Syntax: region=<regionid1>,<regionid2> |
conus |
Return all COMIDs in the conterminous United States. The default value is false. Values: true|false |
countOnly |
Return a CSV containing only the row count (ROWCOUNT) and the column count (COLUMNCOUNT) that the server expects to return in a request. The default value is false. Values: true|false |
Value
A tibble of desired StreamCat metrics
Author(s)
Marc Weber
Examples
## Not run:
df <- sc_get_nlcd(year='2001', aoi='cat',comid='179') # Will show a deprecation warning
df <- sc_get_nlcd(year='2001', aoi='cat',comid='179,1337,1337420')
df <- sc_get_nlcd(year='2001', aoi='ws', region='Region01')
df <- sc_get_nlcd(year='2001', aoi='ws', region='Region01',
countOnly=TRUE)
df <- sc_get_nlcd(year='2001', aoi='ws', region='Region01',
showAreaSqKm=FALSE, showPctFull=TRUE)
df <- sc_get_nlcd(year='2001, 2006', aoi='cat,ws',
comid='179,1337,1337420')
## End(Not run)
Get NNI
Description
Function to get all NNI data available for a given year.
Usage
sc_get_nni(
year,
aoi = NULL,
comid = NULL,
showAreaSqKm = TRUE,
state = NULL,
county = NULL,
region = NULL,
conus = NULL,
showPctFull = NULL,
countOnly = NULL
)
Arguments
year |
Years(s) of NNI metrics to query. Only valid NNI years are accepted (1987:2017) Syntax: year=<year1>,<year2> |
aoi |
Specify the area of interest described by a metric. By default, all available areas of interest for a given metric are returned. Syntax: areaOfInterest=<value1>,<value2> Values: catchment|watershed |
comid |
Return metric information for specific COMIDs Syntax: comid=<comid1>,<comid2> |
showAreaSqKm |
Return the area in square kilometers of a given area of interest. The default value is true. Values: true|false |
state |
Return metric information for COMIDs within a specific state. Use a state's abbreviation to query for a given state. Syntax: state=<state1>,<state2> |
county |
Return metric information for COMIDs within a specific county. Users must use the FIPS code, not county name, as a way to disambiguate counties. Syntax: county=<county1>,<county1> |
region |
Return metric information for COMIDs within a specified hydroregion. Syntax: region=<regionid1>,<regionid2> |
conus |
Return all COMIDs in the conterminous United States. The default value is false. Values: true|false |
showPctFull |
Return the pctfull for each dataset. The default value is false. Values: true|false |
countOnly |
Return a CSV containing only the row count (ROWCOUNT) and the column count (COLUMNCOUNT) that the server expects to return in a request. The default value is false. Values: true|false |
Value
A tibble of desired StreamCat metrics
Author(s)
Selia Markley
Examples
## Not run:
df <- sc_get_nni(year='1987, 1990, 2005, 2017', aoi='cat,ws',
comid='179,1337,1337420')
df <- sc_get_nni(year='2015', aoi='cat',
comid='179', countOnly=TRUE)
df <- sc_get_nni(comid='179', year='2011, 2012', aoi='ws')
df <- sc_get_nni(year='2015, 2016, 2017', county='41003', aoi='ws')
## End(Not run)
Get StreamCat Parameters
Description
Function to return available StreamCat parameters using the StreamCat API.
Usage
sc_get_params(param = NULL)
Arguments
param |
List of available parameters in the API for the following options: name, areaofInterest, region, state, county. State and county return a data frame that includes FIPS codes, names and state abbreviations Syntax: param=<value1>,<value2> Values: name|area |
Value
A list of all the current StreamCat values for a given parameter
Author(s)
Marc Weber
Examples
## Not run:
params <- sc_get_params(param='variable_info')
params <- sc_get_params(param='metric_names')
params <- sc_get_params(param='categories')
params <- sc_get_params(param='aoi')
params <- sc_get_params(param='state')
params <- sc_get_params(param='county')
params <- sc_get_params(param='datasets')
## End(Not run)
Plot National Nutrient Inventory data for streams
Description
Function to plot time series of nitrogen and phosphorus budgets for a given stream COMID. This function allows a user to return a time series of major inputs, outputs, and derived metrics of nitrogen and phosphorus. Plot is returned as an object
Usage
sc_plotnni(comid, include.nue = FALSE, include.inset = TRUE)
Arguments
comid |
Identifier of stream COMID user wants to plot NNI data for. Must be a character string with the COMID digit. Syntax: com=<COMID> |
include.nue |
Include time series of nitrogen use efficiency in the returned plot. The default value is false. Values: true|false |
include.inset |
Include inset map that shows the location of the COMID and its basin. The default value is true. Values: true|false |
Value
Return plot as an object.
Author(s)
Selia Markley
Examples
## Not run:
p <- sc_plotnni(comid='1337420')
p <- sc_plotnni(comid='1337420', include.nue=TRUE)
p <- sc_plotnni(comid='1337420', include.inset=FALSE)
## End(Not run)