extractDSS: extractDSS

View source: R/extractDSS.R

extractDSSR Documentation

extractDSS

Description

Extract data from .dss files and export them as an .RData file. This script is unlikely to work on all operating systems or for all users. Users must install 32-bit and 64-bit versions of Java SE Development Kit 8u301, as described here: https://stackoverflow.com/a/7604469/3723870. Users must also install rJava in the 32-bit version of R, and get dssrip to install either via devtools::install_github("dss-rip","eheisman",args="–no-multiarch") or through the latest guidance on eheisman's github page. Finally, the HECDSSVue program address is hardcoded as 'C://Program Files (x86)/HEC/HEC-DSSVue-v3.0.00.212/' in inst/extdata/scripts/script_extractDSS.R. If the provided script does not work, it can be modified and a new script specified in the 'script' argument.

Usage

extractDSS(
  parentFolder,
  RSM_type = "RSMBN",
  dataType = "STAGE",
  stations = "LOK,WCA1",
  category = "SIMULATED",
  endYear = 2016,
  script = system.file("extdata/scripts", "script_extractDSS.R", package = "RSM"),
  rVersion = Sys.getenv("R_HOME"),
  libraryLoc = "C:/Users/tdh/Documents/R/win-library/4.0"
)

Arguments

parentFolder

directory (no spaces are permitted) with folders labeled by alternative name, containing 'RSMBN_output.dss' files. subfolder names will be used to label alternative data. Additionally, the output .RData file will appear in the parentFolder labeled with the dataType and date.

RSM_type

type of RSM file. Can be 'RSMGL' or 'RSMBN'

dataType

type of data sought. Can be 'STAGE' or 'FLOW'

stations

a comma separated, single-element vector of station names. User must ensure these appear in dss files and have the specified dataType. Invalid data may result in an error similar to 'Error in tsc$times * 60 : non-numeric argument to binary operator'

category

type of input sought; 'SIMULATED' (gage data) or 'INPUT' (regulation schedules). These cannot be intermixed in a single call.

endYear

final year in .dss data series. Typically 2005 (COP) or 2016 (default; LOSOM etc.). The period of record used may change in the future

script

script run in 32-bit R to extract data from DSS files.

rVersion

parent directory for the version of R dssrip should use (same form as Sys.getenv("R_HOME")). There must be a 32-bit R version installed. This argument is used in a system call.

libraryLoc

library location to use (need to set this if using an old version of R). This argument is used in a system call to load packages instead of default .libPaths()

Value

output an .RData file saved in 'parentDirectory' and labeled with the 'dataType' and date.

Examples

extractDSS(parentFolder = 'G:\\data\\models\\LOSOM\\Iteration_3\\sensitivity',
           dataType     = 'STAGE',
           stations     = 'LOK,WCA1',
           category     = 'SIMULATED',
           endYear      = 2016,
           script       = system.file("extdata\\scripts","script_extractDSS.R",package="RSM"),
           rVersion     = "C:/PROGRA~1/R/R-40~1.5"),
           libraryLoc = "C:/Users/tdh/Documents/R/win-library/4.0"


troyhill/RSM documentation built on Aug. 23, 2022, 2:40 p.m.