writeObsFile: Writes a dataframe to a .obs file

View source: R/writeObsFile.R

writeObsFileR Documentation

Writes a dataframe to a .obs file

Description

Writes a CRHM dataframe to an obs file. It will not allow ea values - they must be converted to RH values first. The CRHM filter command to convert RH values to ea is added automatically to the header of the .obs file.

Usage

writeObsFile(
  obs,
  obsfile = "",
  obsfilter = NULL,
  datetimeFormat = NULL,
  comment = "",
  quiet = TRUE,
  logfile = ""
)

Arguments

obs

Required. A CRHMr obs data frame.

obsfile

Required. Name for file to hold observations.

obsfilter

Optional. Default is NULL (not used). If specified, as a string scalar or vector, each value will be added to the file as an an observation filter. Commonly used to adjust 10m wind speed to 2m. Note that the observation filter for converting RH to ea is added autmatically, so you don't have to specify it.

datetimeFormat

Optional. If not specified (the default), the datetime is written as " Excel, then the datetime is written as an Excel datetime.

comment

Optional. A comment to be added to the header of the .obs file. If omitted, the header will consist of the name of the obs data frame followed by created by CRHMr function writeObsFile.

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 successful, returns TRUE. If unsuccessful, returns FALSE.

Note

If there are missing values in the obs dataframe, the last line of the header will contain the line $$ Missing.

Author(s)

Kevin Shook

See Also

trimObs changeEatoRH

Examples

## Not run: 
# write sample obs dataframe to .obs file
result <- writeObsFile(BadLake7376, 'BadLake7376.obs')
## End(Not run)

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