### Get CONUS metrics with sc_get_data (demonstration only) Source: https://usepa.github.io/StreamCatTools/articles/Articles/Introduction.html Shows how to retrieve a metric for the conterminous US using sc_get_data with conus='true'. This example is not run because it takes time. ```R df <- sc_get_data(metric='om', aoi='ws', conus='true') knitr::kable(head(df)) ``` -------------------------------- ### sc_get_nni examples Source: https://usepa.github.io/StreamCatTools/reference/sc_get_nni.html Example calls to sc_get_nni demonstrating different argument combinations. The examples are wrapped in \dontrun{} and are not executed. ```r if (FALSE) { # \dontrun{ 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') } # } ``` -------------------------------- ### Install and load development version from GitHub Source: https://usepa.github.io/StreamCatTools/index.html Install the most recent development version from GitHub using remotes, then load it. ```R library(remotes) install_github("USEPA/StreamCatTools", build_vignettes=TRUE) library(StreamCatTools) ``` -------------------------------- ### Install StreamCatTools from GitHub Source: https://usepa.github.io/StreamCatTools/articles/StartHere.html Installs the development version from GitHub using devtools::install_github(). Requires the devtools package. ```R library(devtools) install_github('USEPA/StreamCatTools') ``` -------------------------------- ### Example of lc_fullname usage Source: https://usepa.github.io/StreamCatTools/reference/lc_fullname.html An example showing how to retrieve the full name for the 'clay' metric. ```R fullname <- lc_fullname(metric='clay') #> Warning: URL 'https://api.epa.gov/StreamCat/lakes/datadictionary': Timeout of 60 seconds was reached #> An error occurred during req_perform(); the service may be down or function parameters may be mis-specified: cannot read from connection ``` -------------------------------- ### sc_get_params examples Source: https://usepa.github.io/StreamCatTools/reference/sc_get_params.html Example calls to sc_get_params for different parameter values. Wrapped in if (FALSE) to avoid running during package checks. ```R if (FALSE) { # \dontrun{ 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')} # } ``` -------------------------------- ### lc_get_data examples (dontrun) Source: https://usepa.github.io/StreamCatTools/reference/lc_get_data.html Example calls to lc_get_data demonstrating various argument combinations: single COMID, watershed metrics, region, county, showAreaSqKm/showPctFull flags, multiple metrics and AOIs, character vector input, and countOnly. These examples are wrapped in \dontrun and are not executed. ```r if (FALSE) { # \dontrun{ 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) } # } ``` -------------------------------- ### Install StreamCatTools from CRAN Source: https://usepa.github.io/StreamCatTools/articles/StartHere.html Installs the package from CRAN using install.packages(). ```R install.packages("StreamCatTools") ``` -------------------------------- ### sc_get_data() example calls Source: https://usepa.github.io/StreamCatTools/reference/sc_get_data.html These examples show various ways to call sc_get_data(). They are wrapped in if (FALSE) { # \dontrun{ ... } } to prevent execution during package checks. The examples demonstrate querying by comid, region, county, multiple metrics, multiple AOIs, and the countOnly parameter. ```r if (FALSE) { # \dontrun{ 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') } # } ``` -------------------------------- ### Get lake watershed with lc_get_watershed (basic) Source: https://usepa.github.io/StreamCatTools/articles/Articles/LakeCat.html Calls lc_get_watershed with a COMID to return the watershed as an sf object. The output shows progress messages and timing; the call took 112.5 seconds in the example. ```r tictoc::tic() ws <- lc_get_watershed(comid = 19334077) #> | | | 0%[14:00:44] duckdb version: 1.5.2 #> | |========== | 14% | |==================== | 29%[14:00:44] Loading and configuring httpfs ... #> | |============================== | 43%[14:00:52] Using glob: s3://dmap-data-commons-ow/data/streamcat/LakeCatWatersheds/**/*.parquet #> | |======================================== | 57%[14:00:52] Describing schema ... #> | |================================================== | 71% | |============================================================ | 86%[14:00:53] Querying COMID = 19334077 #> [14:02:36] Rows returned: 1 #> | |======================================================================| 100% tictoc::toc() #> 112.5 sec elapsed ``` -------------------------------- ### Get lake watershed with HUC2 filter and multi-threading Source: https://usepa.github.io/StreamCatTools/articles/Articles/LakeCat.html Optimized call to lc_get_watershed using huc2, huc2_filter, threads, and retries parameters. This significantly speeds up the query; the example completed in 11.85 seconds. ```r tictoc::tic() ws <- lc_get_watershed(comid = 19334077, huc2 = "01",huc2_filter = "01", threads = 2,retries = 5) #> | | | 0%[14:02:36] duckdb version: 1.5.2 #> | |========== | 14% | |==================== | 29%[14:02:36] Loading and configuring httpfs ... #> | |============================== | 43% | |======================================== | 57%[14:02:39] Describing schema ... #> | |================================================== | 71% | |============================================================ | 86%[14:02:40] Querying COMID = 19334077 within HUC2=01 #> [14:02:47] Rows returned: 1 #> | |======================================================================| 100% tictoc::toc() #> 11.85 sec elapsed ``` -------------------------------- ### Example: sc_fullname with metric='clay' Source: https://usepa.github.io/StreamCatTools/reference/sc_fullname.html Example call to sc_fullname that retrieves the full name for the short metric 'clay'. ```r fullname <- sc_fullname(metric='clay') ``` -------------------------------- ### sc_get_comid examples Source: https://usepa.github.io/StreamCatTools/reference/sc_get_comid.html Examples of using sc_get_comid with a data frame and coordinates, and with an sf object. The first example creates a data frame and calls the function with coordinate columns and CRS. The second example reads an sf object and calls the function. The third example shows a data frame call with explicit coordinate arguments. The fourth example reads an sf object and calls the function. ```r if (FALSE) { # \dontrun{ dd <- data.frame(x = c(-122.649,-100.348,-75.186,-106.675), y = c(45.085, 35.405,42.403,38.721)) comids <- sc_get_comid(dd, xcoord='x', ycoord='y', crsys=4269) dd <- sf::st_point_on_surface(sf::read_sf(system.file("shape/nc.shp", package="sf"))) comids <- sc_get_comid(dd) comids <- sc_get_comid(dd, xcoord='x', ycoord='y', crsys=4269) dd <- sf::read_sf(system.file("shape/nc.shp", package="sf")) comids <- sc_get_comid(dd) } # } ``` -------------------------------- ### sc_get_nlcd() examples Source: https://usepa.github.io/StreamCatTools/reference/sc_get_nlcd.html Example usage of sc_get_nlcd() with various arguments. The first call shows a deprecation warning. The examples are wrapped in \dontrun{} and are not executed. ```r if (FALSE) { # \dontrun{ 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') } # } ``` -------------------------------- ### lc_plotnni examples Source: https://usepa.github.io/StreamCatTools/reference/lc_plotnni.html Example calls to lc_plotnni. The first plots NNI data for COMID '23794487'. The second includes nitrogen use efficiency by setting include.nue=TRUE. The examples are wrapped in if (FALSE) and \dontrun to prevent execution. ```r if (FALSE) { # \dontrun{ p <- lc_plotnni(comid='23794487') p <- lc_plotnni(comid='23794487', include.nue=TRUE) } # } ``` -------------------------------- ### lc_get_metric_names example Source: https://usepa.github.io/StreamCatTools/reference/lc_get_metric_names.html Example usage wrapped in if (FALSE) to avoid execution during package checks. Demonstrates filtering by a single category and by multiple categories with multiple areas of interest. ```R if (FALSE) { # \dontrun{ metrics <- lc_get_metric_names(category='Natural') metrics <- lc_get_metric_names(category = c('Anthropogenic','Natural'), aoi=c('Cat','Ws'))} # } ``` -------------------------------- ### sc_get_metric_names examples Source: https://usepa.github.io/StreamCatTools/reference/sc_get_metric_names.html Example calls demonstrating filtering by category, by multiple categories and AOIs, and by AOI with multiple datasets. The code is wrapped in if (FALSE) and \dontrun to prevent execution during package checks. ```r if (FALSE) { # \dontrun{ 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')) } # } ``` -------------------------------- ### lc_get_nni examples with warnings Source: https://usepa.github.io/StreamCatTools/reference/lc_get_nni.html Three example calls to lc_get_nni with different arguments. Each triggers a warning about metric names not matching expected names, suggesting use of lc_get_params(param='metric_names'). ```r # \donttest{ df <- lc_get_nni(year='1987, 1990, 2005, 2017', aoi='cat,ws', comid='23783629,23794487,23812618') #> One or more of the provided metric names do not match the expected metric names in StreamCat. Use lc_get_params(param='metric_names') to list valid metric names for StreamCat df <- lc_get_nni(year='2015', aoi='cat', comid='23783629', countOnly=TRUE) #> One or more of the provided metric names do not match the expected metric names in StreamCat. Use lc_get_params(param='metric_names') to list valid metric names for StreamCat df <- lc_get_nni(comid='23783629', year='2011, 2012', aoi='ws') #> One or more of the provided metric names do not match the expected metric names in StreamCat. Use lc_get_params(param='metric_names') to list valid metric names for StreamCat # } ``` -------------------------------- ### Examples of lc_get_params calls Source: https://usepa.github.io/StreamCatTools/reference/lc_get_params.html Example calls to lc_get_params and sc_get_params for various parameter values. These are wrapped in if (FALSE) and \dontrun to prevent execution during package checks. ```R if (FALSE) { # \dontrun{ 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') } # } ``` -------------------------------- ### lc_get_nlcd() usage examples Source: https://usepa.github.io/StreamCatTools/reference/lc_get_nlcd.html Examples of calling lc_get_nlcd() with various arguments. The first call triggers a deprecation warning. The examples show querying by COMID, year, area of interest, and options like showAreaSqKm, showPctFull, and countOnly. ```r if (FALSE) { # \dontrun{ 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') } # } ``` -------------------------------- ### sc_plotnni example calls Source: https://usepa.github.io/StreamCatTools/reference/sc_plotnni.html Example calls to sc_plotnni with different arguments. The code is wrapped in if (FALSE) { # \dontrun{ ... } # } to prevent execution during package checks. The first call uses default options, the second includes nitrogen use efficiency, and the third excludes the inset map. ```R if (FALSE) { # \dontrun{ p <- sc_plotnni(comid='1337420') p <- sc_plotnni(comid='1337420', include.nue=TRUE) p <- sc_plotnni(comid='1337420', include.inset=FALSE) } # } ``` -------------------------------- ### Get data for multiple COMIDs using sc_get_data Source: https://usepa.github.io/StreamCatTools/articles/Articles/Introduction.html Accesses several variables for several areas of interest and COMIDs using the sc_get_data function. The example retrieves metrics 'pcturbmd2006,damdens,tridens' for AOIs 'rp100cat,cat,ws' and COMIDs '179,1337,1337420', loading the data into a tibble displayed with knitr::kable. ```r df <- sc_get_data(metric='pcturbmd2006,damdens,tridens', aoi='rp100cat,cat,ws', comid='179,1337,1337420') knitr::kable(df) ``` -------------------------------- ### Get citation for StreamCatTools Source: https://usepa.github.io/StreamCatTools/articles/StartHere.html Displays the recommended citation for the package. The output shows the citation text and a BibTeX entry. ```R citation("StreamCatTools") ``` ```text #> To cite package 'StreamCatTools' in publications use: #> #> Weber M, Hill R, Markley S, Hudson T, Brookes A (2026). #> _StreamCatTools: StreamCatTools: Tools for Working with StreamCat and #> LakeCat Data_. R package version 0.11.0, #> . #> #> A BibTeX entry for LaTeX users is #> #> @Manual{, #> title = {StreamCatTools: StreamCatTools: Tools for Working with StreamCat and LakeCat Data}, #> author = {Marc Weber and Ryan Hill and Selia Markley and Travis Hudson and Allen Brookes}, #> year = {2026}, #> note = {R package version 0.11.0}, #> url = {https://usepa.github.io/StreamCatTools/}, #> } ``` -------------------------------- ### List StreamCat parameters with sc_get_params Source: https://usepa.github.io/StreamCatTools/articles/Articles/Introduction.html Use sc_get_params to get available values for parameters like 'aoi' and 'metric_names'. The output shows region parameters and a selection of metric names. ```R library(StreamCatTools) region_params <- sc_get_params(param='aoi') name_params <- sc_get_params(param='metric_names') print(paste0('region parameters are: ', paste(region_params,collapse = ', '))) #> [1] "region parameters are: cat, catrp100, other, ws, wsrp100" print(paste0('A selection of available StreamCat metrics include: ',paste(name_params[1:10],collapse = ', '))) #> [1] "A selection of available StreamCat metrics include: agkffact, al2o3, bankfulldepth, bankfullwidth, bfi, canaldens, cao, cbnf, chem, clay" ``` -------------------------------- ### Look up metric full name with sc_fullname Source: https://usepa.github.io/StreamCatTools/articles/Articles/Introduction.html Use sc_fullname to get the display name for a metric. The first example returns a valid name; the second example with multiple metrics returns character(0). ```R metric='pcthbwet2011' fullname <- sc_fullname(metric) fullname #> [1] "Herbaceous Wetland Percentage 2011" ``` ```R metric='pctdecid2019,fert' fullname <- sc_fullname(metric) fullname #> character(0) ``` -------------------------------- ### Get Waterbody COMIDs with lc_get_comid Source: https://usepa.github.io/StreamCatTools/articles/Articles/LakeCat.html Finds COMIDs for a set of example lake locations. The function is a simple wrapper for get_waterbodies in the nhdplusTools R package. The example creates a data frame of coordinates, converts to an sf object, and passes it to lc_get_comid. ```R 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) ``` -------------------------------- ### Access single NNI metric for Calapooia River basin Source: https://usepa.github.io/StreamCatTools/articles/Articles/NNI.html Uses sc_get_data to retrieve a single NNI metric for the Calapooia River basin. It navigates upstream flowlines using nhdplusTools, gets the watershed boundary, and plots the selected metric. The code includes a commented-out example of the output tibble. ```R start_comid = 23763517 nldi_feature <- list(featureSource = "comid", featureID = start_comid) flowline_nldi <- nhdplusTools::navigate_nldi(nldi_feature, mode = "UT", data_source = "flowlines", distance=5000) # get StreamCat metrics comids <- paste(as.integer(flowline_nldi$UT_flowlines$nhdplus_comid), collapse=",",sep="") df <- sc_get_data(metric='n_ff_2016', aoi='cat', comid=comids, showAreaSqKm=TRUE) flowline_nldi <- flowline_nldi$UT_flowlines flowline_nldi$Farm_Nitrogon_2016 <- df$n_ff_2016cat[match(flowline_nldi$nhdplus_comid, df$comid)] basin <- nhdplusTools::get_nldi_basin(nldi_feature = nldi_feature) ``` -------------------------------- ### Look up LakeCat metric full names with lc_fullname Source: https://usepa.github.io/StreamCatTools/articles/Articles/LakeCat.html Use lc_fullname to get the display name(s) for a metric via the API. The first example with a single metric returns NULL, and the second with multiple metrics also returns NULL, indicating the function may not return expected results for these inputs. ```R metric='pcthbwet2016' fullname <- lc_fullname(metric) fullname #> NULL ``` ```R metric=c('pctdecid2019','fert') fullname <- lc_fullname(metric) fullname #> NULL ``` -------------------------------- ### Load StreamCatTools Source: https://usepa.github.io/StreamCatTools/articles/StartHere.html Loads the StreamCatTools package into the R session. ```R library(StreamCatTools) ``` -------------------------------- ### View the StreamCatTools vignette in RStudio Source: https://usepa.github.io/StreamCatTools/index.html Open the StartHere vignette for StreamCatTools in RStudio. ```R vignette("StartHere", "StreamCatTools") ``` -------------------------------- ### Map lake watershed and lake with mapview Source: https://usepa.github.io/StreamCatTools/articles/Articles/LakeCat.html Visualizes the watershed and lake using mapview. The watershed is shown with low opacity and the lake with higher opacity, both in blue. ```r mapview::mapview(ws, col.regions = "blue", alpha.regions = 0.1, color = "blue", alpha = 0.8, lwd = 2, layer.name = "Watershed") + mapview::mapview(lake, col.regions = "blue", alpha.regions = 0.5, color = "blue", alpha = 0.8, layer.name = "Lake") ``` -------------------------------- ### lc_get_comid example with dataframe and sf object Source: https://usepa.github.io/StreamCatTools/reference/lc_get_comid.html Example usage of lc_get_comid. First, a dataframe with coordinates is passed along with xcoord, ycoord, and crsys. Then, the same coordinates are converted to an sf object and passed directly. The function returns a new sf data frame with a populated 'COMID' column. ```r if (FALSE) { # \dontrun{ 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) } # } ``` -------------------------------- ### lc_get_nni function usage Source: https://usepa.github.io/StreamCatTools/reference/lc_get_nni.html Shows the function signature with all arguments and their defaults. Use this to understand the required and optional parameters for querying NNI data. ```r lc_get_nni( year, aoi = NULL, comid = NULL, showAreaSqKm = TRUE, showPctFull = NULL, countOnly = NULL ) ``` -------------------------------- ### sc_get_metric_names function usage Source: https://usepa.github.io/StreamCatTools/reference/sc_get_metric_names.html Shows the function signature with all optional arguments: category, aoi, year, and dataset. Use this to understand the parameter order and defaults. ```r sc_get_metric_names(category = NULL, aoi = NULL, year = NULL, dataset = NULL) ``` -------------------------------- ### lc_get_nni Source: https://usepa.github.io/StreamCatTools/reference/lc_get_nni.html Function to get all NNI data available for a given year. ```APIDOC ## lc_get_nni ### Description Function to get all NNI data available for a given year. ### Usage ```r lc_get_nni( year, aoi = NULL, comid = NULL, showAreaSqKm = TRUE, showPctFull = NULL, countOnly = NULL ) ``` ### Arguments - **year** (character) - Required - Years(s) of NNI metrics to query. Only valid NNI years are accepted (1987:2017). Syntax: year=, - **aoi** (character) - Optional - Specify the area of interest described by a metric. By default, all available areas of interest for a given metric are returned. Syntax: areaOfInterest=,. Values: catchment|watershed - **comid** (character) - Optional - Return metric information for specific COMIDs. Syntax: comid=, - **showAreaSqKm** (logical) - Optional - Return the area in square kilometers of a given area of interest. The default value is true. Values: true|false - **showPctFull** (logical) - Optional - Return the pctfull for each dataset. The default value is false. Values: true|false - **countOnly** (logical) - Optional - 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 Selia Markley ### Examples ```r # \donttest{ df <- lc_get_nni(year='1987, 1990, 2005, 2017', aoi='cat,ws', comid='23783629,23794487,23812618') #> One or more of the provided metric names do not match the expected metric names in StreamCat. Use lc_get_params(param='metric_names') to list valid metric names for StreamCat df <- lc_get_nni(year='2015', aoi='cat', comid='23783629', countOnly=TRUE) #> One or more of the provided metric names do not match the expected metric names in StreamCat. Use lc_get_params(param='metric_names') to list valid metric names for StreamCat df <- lc_get_nni(comid='23783629', year='2011, 2012', aoi='ws') #> One or more of the provided metric names do not match the expected metric names in StreamCat. Use lc_get_params(param='metric_names') to list valid metric names for StreamCat # } ``` ``` -------------------------------- ### sc_get_params usage Source: https://usepa.github.io/StreamCatTools/reference/sc_get_params.html Shows the function signature for sc_get_params, which accepts an optional param argument. ```R sc_get_params(param = NULL) ``` -------------------------------- ### Get watershed metrics for a hydroregion with sc_get_data Source: https://usepa.github.io/StreamCatTools/articles/Articles/Introduction.html Uses sc_get_data to retrieve watershed-only metrics for a specific NHDPlus hydroregion (Region17). The result is displayed with kable. ```R df <- sc_get_data(metric='pctwdwet2006', aoi='ws', region='Region17') knitr::kable(head(df)) ``` -------------------------------- ### sc_get_nni function usage Source: https://usepa.github.io/StreamCatTools/reference/sc_get_nni.html Shows the function signature with all arguments and their defaults. Use this to understand the parameters for querying NNI data. ```r sc_get_nni( year, aoi = NULL, comid = NULL, showAreaSqKm = TRUE, state = NULL, county = NULL, region = NULL, conus = NULL, showPctFull = NULL, countOnly = NULL ) ``` -------------------------------- ### Get variable info with sc_get_params Source: https://usepa.github.io/StreamCatTools/articles/Articles/Introduction.html Retrieve a tibble of information about StreamCat metrics using sc_get_params with param='variable_info'. The output shows the first six rows of the tibble. ```R var_info <- sc_get_params(param='variable_info') head(var_info) #> # A tibble: 6 × 13 #> category metric aoi year short_description long_description units dsid #> #> 1 Anthropogen… NABD_… Cat,… NA NABD Dam Density Density of geor… Coun… 33 #> 2 Anthropogen… NABD_… Cat,… NA NABD NID Reservo… Volume all… Cubi… 33 #> 3 Anthropogen… NABD_… Cat,… NA NABD Normal Rese… Volume all… Cubi… 33 #> 4 Natural Preci… Cat,… NA Surplus Precipit… This dataset re… mm 75 #> 5 Soils agkff… Cat,… NA Ag Soil Erodibil… Mean of STATSGO… Unit… 28 #> 6 Natural al2o3… Cat,… NA Mean Lithologica… Mean % of litho… Perc… 13 #> # ℹ 5 more variables: dataset , source_name , source_URL , #> # ACTIVE , DSNAME ``` -------------------------------- ### Usage of lc_fullname Source: https://usepa.github.io/StreamCatTools/reference/lc_fullname.html The basic syntax for calling the lc_fullname function. ```R lc_fullname(metric = NULL) ``` -------------------------------- ### lc_get_metric_names usage Source: https://usepa.github.io/StreamCatTools/reference/lc_get_metric_names.html Shows the function signature with all arguments defaulting to NULL. Use lc_get_params(categories) or lc_get_params(datasets) to see valid options. ```R lc_get_metric_names(category = NULL, aoi = NULL, year = NULL, dataset = NULL) ``` -------------------------------- ### Get data for known COMIDs using lc_get_data Source: https://usepa.github.io/StreamCatTools/articles/Articles/LakeCat.html Retrieves the same metrics for a set of known COMIDs passed as a comma-separated string. The result is displayed with knitr::kable. ```R df <- lc_get_data(metric='pcturbmd2006,damdens', aoi='cat,ws', comid='23783629,23794487,23812618') knitr::kable(df) ``` -------------------------------- ### lc_get_nlcd() function signature Source: https://usepa.github.io/StreamCatTools/reference/lc_get_nlcd.html Shows the full argument list for lc_get_nlcd(). All arguments are optional; defaults include year='2019' and conus=false. ```r lc_get_nlcd( year = "2019", comid = NULL, aoi = NULL, showAreaSqKm = NULL, showPctFull = NULL, state = NULL, county = NULL, region = NULL, conus = NULL, countOnly = NULL ) ``` -------------------------------- ### List LakeCat API parameters with lc_get_params Source: https://usepa.github.io/StreamCatTools/articles/Articles/LakeCat.html Use lc_get_params to get available areas of interest and metric names from the LakeCat API. The function currently supports only 'aoi' and 'metric_names' parameters. The output shows the region parameters and a selection of metric names. ```R library(StreamCatTools) region_params <- lc_get_params(param='aoi') name_params <- lc_get_params(param='metric_names') print(paste0('region parameters are: ', paste(region_params,collapse = ', '))) #> [1] "region parameters are: cat, ws" print(paste0('A selection of available LakrCat metrics include: ',paste(name_params[1:10],collapse = ', '))) #> [1] "A selection of available LakrCat metrics include: agkffact, al2o3, bfi, canaldens, cao, cbnf, clay, coalminedens, compstrgth, damdens" ```