The function replaceNameList replaces the whole namelist in an input file.
All parameters in the namelist must be provided, otherwise MAESTRA/MAESPA will likely crash. Or, you can use
replacePAR to replace a single parameter. If the new parameter value(s) is a vector (or a single value), the values #' will be placed on a single line in the parameter file. If instead a matrix is provided, each row of the matrix is placed on a separate line.
WARNING : The input file is modified. Make sure to backup your original
input files!
New value of the parameter. Can be a single value or a vector,
or a matrix (see Details).
noquotes
Logical. If FALSE, does print quotes around character
values.
Value
Nothing is returned. The input file is modified.
Author(s)
Remko Duursma
See Also
replacePAR
Examples
## Not run:
# Replace an entire namelist
replaceNameList(namelist="aerodyn",
datfile="trees.dat", vals=list(zht=30,zpd=3,z0ht=0.6))
#' # Replace a parameter with a single value:
replacePAR("trees.dat", "notrees", "plot", newval=100)
# Replace a number of values:
replacePAR("trees.dat", "xycoords", "xy", newval=c(1,1,2,2,3,3))
# Replace a number of values in a different way : this may be useful in
# more complicated programs,
# rr when reading a string from a file (that should be interpreted as a vector).
replacePAR("trees.dat", "xycoords", "xy", newval="1 1 2 2 3 3", noquotes=TRUE)
# Replace a parameter so that the new values are placed on multiple rows.
# Useful for tree namelists with multiple dates and multiple trees
# (where each row corresponds to a tree, and each column to a date.)
m <- matrix(c(1,2,3,4,5,6,7,8,9), nrow=3, byrow=TRUE)
replacePAR("trees.dat", "values", "indivlarea", newval=m)
## End(Not run)