stage_nwis_sitelist: generate nwis site_ids for given p_codes

View source: R/stage_nwis_sitelist.R

stage_nwis_sitelistR Documentation

generate nwis site_ids for given p_codes

Description

finds all NWIS sites that meet given data requirements

Usage

stage_nwis_sitelist(vars, min.obs = 100, site.types = "ST", HUCs = 1:21,
  folder = NULL, verbose = TRUE, p_codes)

Arguments

vars

a character vector of mda.streams var codes, as in unique(get_var_src_codes(out='var'))

min.obs

minimum number of observations of the vars that a site must have to be accepted

site.types

character vector of acceptable NWIS site types as in https://maps.waterdata.usgs.gov/mapper/help/sitetype.html

HUCs

character or numeric vector of HUC codes, e.g., 1:3 or '04'

folder

directory path, or NULL, indicating where to save the file or (NULL) to return it as a character vector

verbose

logical. Should status messages be given?

p_codes

optional - allows you to specify p_codes that aren't in get_var_src_codes(!is.na(p_code), out=c("var","src","p_code")) for exploratory purposes

Value

a character vector of NWIS sites, appended with 'nwis_'

Examples

## Not run: 
stage_nwis_sitelist(vars=c('doobs','wtr','disch','stage'), 
  state_codes=c("wi","Michigan"))
sites <- stage_nwis_sitelist(
  p_codes=get_var_src_codes(var=="doobs",!is.na(p_code),out="p_code"), 
  state_codes=c("all"), verbose=TRUE)
sites_file <- stage_nwis_sitelist(
  p_codes=get_var_src_codes(var=="doobs",!is.na(p_code),out="p_code"), 
  state_codes=c("wi"), folder=tempdir()); readLines(sites_file)

## End(Not run)

USGS-R/mda.streams documentation built on June 3, 2023, 8:43 a.m.