distributeInst: Distribute instantaneous values

View source: R/distributeInst.R

distributeInstR Documentation

Distribute instantaneous values

Description

Distributes instantaneous values to a shorter time interval. The missing datetimes are i nserted and then the values are interpolated. This function is typically used to downscale obs values such as t, ea, and u.

Usage

distributeInst(
  obs,
  obsCols = "all",
  timeStep = 0,
  interpolationMethod = "linear",
  maxLength = 5,
  quiet = TRUE,
  logfile = ""
)

Arguments

obs

Required. The CRHMr data frame of obs values.

obsCols

Optional. A vector containing the columns to be imputed in the obs data frame, not including the datetime. The default all specifies all columns.

timeStep

Required. The time step (in hours) for the interpolated values. This value must be smaller than the time step in the original time series.

interpolationMethod

Optional. A vector containing the methods to be used for interpolation for each of the variables. Currently supported methods are linear and spline. The default is to use linear interpolation. If fewer methods than columns are specified, the methods are recycled.

maxLength

Optional. The maximum gap length to be interpolated. Defaults to 5 time steps.

quiet

Optional. Suppresses display of messages, except for errors. If you are calling this function in an R script, you will usually leave quiet=TRUE (i.e. the default). If you are working interactively, you will probably want to set quiet=FALSE.

logfile

Optional. Name of the file to be used for logging the action. Normally not use

Value

If successful, returns a dataframe of the selected columns interpolated to the specified time step. If unsuccessful, returns an error.

Author(s)

Kevin Shook

See Also

distributeMean

Examples

## Not run: 
hourly_vals <- distributeInst(vegreville, c(1,2,3), timeStep = 1)
## End(Not run)

CentreForHydrology/CRHMr documentation built on April 6, 2024, 5:27 p.m.