zeroMissingPrecip: Sets missing precipitation values to zero

View source: R/zeroMissingPrecip.R

zeroMissingPrecipR Documentation

Sets missing precipitation values to zero

Description

Removes missing precipitation (NA_real_values (p and/or ppt) in an obs dataframe, by setting them to zero. This function is potentially dangerous, as setting the missing values to zero prevents any further imputation/interpolation of values.

Usage

zeroMissingPrecip(obs, precipCols = 0, quiet = TRUE, logfile = "")

Arguments

obs

Required. A CRHMr obs dataframe.

precipCols

Optional. A vector containing the numbers of the columns (excluding the datetime) to be processed. If omitted, all of the columns whose names contain p or ppt will be processed

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 the action is successful, returns a dataframe with all missing precipitation values set to zero. If the action is unsuccessful, then the value FALSE is returned. If quiet=FALSE, then a summary of the returned obs data will be returned.

Note

As described, this function is potentially dangerous, and its action CANNOT be undone. It should only be used when there is no further hope for imputing/interpolating precipitation data. Note that its use is really only justified in arid or semi-arid climates, where precipitation is rare. Because it is so destructive, the function should only be used immediately before exporting to an obs file.

Author(s)

Kevin Shook

See Also

writeObsFile

Examples

BadLake7376.clean <- zeroMissingPrecip(BadLake7376, quiet=FALSE) 

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