replacePrjParameters: Replaces the parameter values in a CRHM model '.prj' file

View source: R/replacePrjParameters.R

replacePrjParametersR Documentation

Replaces the parameter values in a CRHM model .prj file

Description

Replaces the existing values of a single parameter, for all HRUs, in a .prj file. This differs from setPrjParameters in that this function can change the number of values (i.e. the number of HRUs) for a parameter. It is intended for use in deletePrjHRUs. Note that this function is very destructive, so it's a good idea to have a backup copy of your .prj file before running it!

Usage

replacePrjParameters(
  inputPrjFile = "",
  paramName = "",
  paramVals = "",
  outputPrjFile = "",
  oldParamCount = 0,
  quiet = TRUE,
  logfile = ""
)

Arguments

inputPrjFile

Required. Name of the .prj file.

paramName

Required. Name of parameter to set.

paramVals

Required. Vector containing new parameter values.

outputPrjFile

Optional. If omitted, the input .prj file will be overwritten.

oldParamCount

Optional. If > 0, then this parameter sets the number of HRUs in the original .prj file. Otherwise the number of HRUs is read from the file. The parameter is needed when the number of HRUs in the .prj file Dimensions section does not match the actual number of HRU values for the parameter.

quiet

Optional. Suppresses display of messages, except for errors. I f 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

Currently, this function has only been tested on simple .prj files, i.e. without REW Grp parameters. It might work for complex files if the REW Grp specification is included in the parameter name.

Author(s)

Kevin Shook

See Also

deletePrjHRUs setPrjParameters

Examples

## Not run: 
result <- replacePrjParameters("CRHM/Bad74_Frozen.prj",
"fetch", c(1500, 100))
## End(Not run)

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