Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TransUsgsProdStat function in R/usgs_ingest.R #78

Open
ChuliangXiao opened this issue Aug 28, 2017 · 0 comments
Open

TransUsgsProdStat function in R/usgs_ingest.R #78

ChuliangXiao opened this issue Aug 28, 2017 · 0 comments

Comments

@ChuliangXiao
Copy link

##============================================================================================

#' Translate USGS product/stat codes to something readable (and vice versa).
#'
#' \code{TransUsgsProdStat} Translate USGS product/stat codes to something
#' readable (and vice versa) using a lookup table.
#' @param names Character product_stat codes (e.g. 'X_00060_00011') or their
#' translation (e.g. 'Discharge (cfs)') separated with an underscore.
#' @param whichIn Logical
#' @return if whichIn==FALSE : Character of the translation. if whichIn==TRUE :
#' Integer index which passed names are in the table.
#' @Keywords database internal
#' @concept dataMgmt usgsStreamObs
TransUsgsProdStat <- function(names, whichIn=FALSE) {

Elsewhere these rely on a single set of parentheses around the units.

prodStatLookup <- c( X_00060_00011 ='Discharge (cfs)', ##instantaneous is 00011 but not worth saying IMO
X_00060_00011_cd ='Discharge code',
X_00065_00011 ='Stage (ft)',
X_00065_00011_cd ='Stage code' )
code2Name <- any(names %in% names(prodStatLookup))

I find that the variable 'Discharge (cfs)' in new USGS RData is denoted by X_00060_00000 instead of X_00060_00011.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant