weighingGauge2: Removes spikes from weighing gauge cumulative precipitation

View source: R/weighingGauge2.R

weighingGauge2R Documentation

Removes spikes from weighing gauge cumulative precipitation

Description

Removes positive and negative spikes from deaccumulated weighing gauge precipitation. The gaps left from spike removal are infilled by linear interpolation. This function is a wrapper for other functions and was suggested by Craig Smith. This function need not be called if your data does not contain any spikes. It is a good idea to use weighingGaugePlot to look at your data before calling this function. Note that this function will also remove gauge resets, if they are wihin the range of the spikeThreshold.

Usage

weighingGauge2(
  obs,
  precipCol = 1,
  spikeThreshold = 1000,
  maxSpikeGap = 3,
  quiet = TRUE,
  logfile = ""
)

Arguments

obs

Required. A standard CRHMr obs file.

precipCol

Optional. The number of the column containing the weighting gauge cumulative precipitation data, not including the datetime. Default is column 1. This function can only work on 1 column of precipitation.

spikeThreshold

Optional. Threshold for single-interval precipitation (mm). Any spikes (changes in cumulative precipitation) whose absoloute value is greater than the threshold will be deleted. The default value is 1000 mm.

maxSpikeGap

Optional. Maximum length of spikes (in time steps) to be filled. Default is 3.

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 used.

Value

If unsuccessful, returns FALSE. If sucessful, returns a modified version of the obs dataframe containing only the datetime and the adjusted precipitation values.

Note

If you don't specify a large enough value for maxSpikeGap, then all of the values after the spike will be set to NA.

Author(s)

Kevin Shook

See Also

weighingGauge1 weighingGauge3 weighingGauge4 weighingGaugePlot weighingGaugeInterval

Examples

## Not run: 
test2 <- weightingGauge2(wg, spikeThreshold = 300)
## End(Not run)


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