R/functions.R

Defines functions base_function PyRate PyRateContinuous PyRateContinuousShift PyRateDES PyRateDES2 PyRateMBD PyRateMCDD

Documented in PyRate PyRateContinuous PyRateContinuousShift PyRateDES PyRateDES2 PyRateMBD PyRateMCDD

base_function <- function(cmd, ...) {
  arglist <- arglist_get(...)
  wd <- wd_get(arglist = arglist, key = '-wd', i = 1)
  # if input file determines wd, convert the filepath to its directory
  wd <- dirpath_get(flpth = wd)
  files_to_send <- filestosend_get(arglist = arglist, wd = wd)
  arglist <- c(paste0('/PyRate/', cmd), arglist)
  arglist <- arglist_parse(arglist = arglist,
                                      keyvals_to_drop = '-wd')
  otsdr <- outsider_init(pkgnm = 'om..pyrate', cmd = 'python2.7', wd = wd,
                         files_to_send = files_to_send, arglist = arglist)
  run(otsdr)
}

#' @name PyRate
#' @title PyRate
#' @description Run PyRate
#' @param ... Arguments
#' @example examples/PyRate.R
#' @export
PyRate <- function(...) {
  base_function(cmd = 'PyRate.py', ...)
}

#' @name PyRateContinuous
#' @title PyRateContinuous
#' @description Run PyRateContinuous
#' @param ... Arguments
#' @example examples/PyRateContinuous.R
#' @export
PyRateContinuous <- function(...) {
  base_function(cmd = 'PyRateContinuous.py', ...)
}

#' @name PyRateContinuousShift
#' @title PyRateContinuousShift
#' @description Run PyRateContinuousShift
#' @param ... Arguments
#' @example examples/PyRateContinuousShift.R
#' @export
PyRateContinuousShift <- function(...) {
  base_function(cmd = 'PyRateContinuousShift.py', ...)
}

#' @name PyRateDES
#' @title PyRateDES
#' @description Run PyRateDES
#' @param ... Arguments
#' @example examples/PyRateDES.R
#' @export
PyRateDES <- function(...) {
  base_function(cmd = 'PyRateDES.py', ...)
}

#' @name PyRateDES2
#' @title PyRateDES2
#' @description Run PyRateDES2
#' @param ... Arguments
#' @example examples/PyRateDES2.R
#' @export
PyRateDES2 <- function(...) {
  base_function(cmd = 'PyRateDES2.py', ...)
}

#' @name PyRateMBD
#' @title PyRateMBD
#' @description Run PyRateMBD
#' @param ... Arguments
#' @example examples/PyRateMBD.R
#' @export
PyRateMBD <- function(...) {
  base_function(cmd = 'PyRateMBD.py', ...)
}

#' @name PyRateMCDD
#' @title PyRateMCDD
#' @description Run PyRateMCDD
#' @param ... Arguments
#' @example examples/PyRateMCDD.R
#' @export
PyRateMCDD <- function(...) {
  base_function(cmd = 'PyRateMCDD.py', ...)
}
DomBennett/om..pyrate..2.0 documentation built on Oct. 27, 2019, 11:30 a.m.