readNameList: Read a namelist into a list

Description Usage Arguments Value Author(s) See Also Examples

Description

Read a namelist into a list

The readPAR function reads the value of any parameter in a namelist in one of the MAESTRA/MAESPA input files. Also works for other text files that have the FORTRAN namelist input structure. Optionally specifies in which namelist to look for the parameter.

To read an entire namelist into a list, use the readNameList function.

Usage

1
2
3
readNameList(datfile, namelist)

readPAR(datfile, parname, namelist = NA, fail = TRUE)

Arguments

datfile

Name of the Maestra/Maespa input file (e.g. "trees.dat")

namelist

Name of the namelist (e.g. "plot")

parname

Name of the parameter.

fail

Logical. If TRUE, stops with an error when parameter is not found (if FALSE, returns NA)

Value

For readPAR, either one value, or a vector, depending on how many values are specified for the parameter in the input file.

For readNameList, a named list.

Author(s)

Remko Duursma. Thanks to Andreas Ibrom for reporting a bug.

See Also

replacePAR, readNameList

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
# Read the number of trees in the plot:
readPAR("confile.dat", "notrees", "plot")

# Read the X and Y coordinates:
readPAR("confile.dat", "xycoords", "xy")

# Read entire namelist
readNameList("trees.dat", "plot")


## End(Not run)

Maeswrap documentation built on May 2, 2019, 7:58 a.m.