INFOdataframe: Import metadata to create INFO data frame

INFOdataframeR Documentation

Import metadata to create INFO data frame

Description

Populates INFO data frame from either NWIS (readNWISInfo), Water Quality Portal (readWQPInfo), or user-supplied files (readUserInfo).

Usage

readNWISInfo(siteNumber, parameterCd, interactive = TRUE)

readWQPInfo(siteNumber, parameterCd, interactive = TRUE)

readUserInfo(filePath, fileName, hasHeader = TRUE, separator = ",",
  interactive = TRUE)

Arguments

siteNumber

character site number. For readNWISInfo, this is usually an 8 digit number, for readWQPInfo, it is usually a longer code. For instance, a USGS site number in the Water Quality Portal would be in the form 'USGS-XXXXXXXX'. If the siteNumber is left blank (an empty string), the interactive option allows users to enter required information by hand, otherwise those fields are left blank.

parameterCd

character USGS parameter code (a 5 digit number) or characteristic name (if using readWQPInfo). If the parameterCd is left blank (an empty string), the interactive option allows users to enter required information by hand, otherwise those fields are left blank.

interactive

logical Option for interactive mode. If true, there is user interaction for error handling and data checks.

filePath

character specifying the path to the file (used in readUserInfo)

fileName

character name of file to open (used in readUserInfo)

hasHeader

logical true if the first row of data is the column headers (used in readUserInfo)

separator

character that separates data cells (used in readUserInfo)

Value

INFO data frame. Any metadata can be stored in INFO. However, there are 8 columns that EGRET uses by name in some functions:

Required column Used in function Description
param.units*** All concentration plotting functions The units as listed in this field are used to create the concentration axis labels
shortName All plotting functions Station short name, used to label plots
paramShortName All plotting functions Parameter short name, used to label plots
drainSqKm plotFlowSingle, printSeries Calculate runoff
constitAbbrev saveResults Parameter abbrieviation, used to auto-name workspace
staAbbrev saveResults Station abbrieviation, used to auto-name workspace
paStart Most EGRET functions Starting month of period of analysis. Defaults to 10
paLong Most EGRET functions Length in number of months of period of analysis. Defaults to 12

*** Additionally, EGRET assumes that all concentrations are saved in mg/l. If some variation of 'mg/l' is not found in INFO$param.units, functions that calculate flux will issue a warning. This is because the conversion from mg/l to the user-specified flux unit (e.g., kg/day) uses hard-coded conversion factors.

See Also

readNWISsite, readNWISpCode

whatWQPsites

Examples

# These examples require an internet connection to run
# Automatically gets information about site 05114000 and temperature

INFO <- readNWISInfo('05114000','00010',interactive = FALSE)

# These examples require an internet connection to run
# Automatically gets information about site 01594440 and temperature, no interaction with user
nameToUse <- 'Specific conductance'
pcodeToUse <- '00095'

# INFO <- readWQPInfo('USGS-04024315',pcodeToUse, interactive = FALSE)

# INFO2 <- readWQPInfo('WIDNR_WQX-10032762',nameToUse, interactive = FALSE)
# To adjust the label names:
# INFO$shortName <- "Little"
# INFO$paramShortName <- "SC"

filePath <- system.file("extdata", package="EGRET")
fileName <- 'infoTest.csv'
INFO <- readUserInfo(filePath,fileName, separator=",",interactive=FALSE)

USGS-R/EGRET documentation built on Nov. 20, 2024, 7:45 p.m.