Learn R Programming

YplantQMC (version 0.6-6)

constructplant: Construct a 3D plant

Description

Read legacy-style Yplant input files into a special object, to be used in any analysis in YplantQMC.

The function constructs an object of class plant3d, based on Yplant input files (.p and .l/.lf). Various methods exist for plant3d objects, in particular plot.plant3d and summary.plant3d.

For batch analyses, the function readplantlist reads a number of files at a time, and stores the results in a special list (of class plant3dlist).

Three plants are provided with YplantQMC (and automatically loaded) :toona, pilularis and sugarmaple. See plantexamples.

To learn about the format of P and L files, read the detailed account on the Prometheus wiki (Pearcy, Falster & Duursma 2011): http://goo.gl/Hmyv6.

For legacy Yplant users (Pearcy and Yang 1996, see http://goo.gl/Hmyv6), you will find that constructplant is much more robust with respect to malformed input files. It will also attempt to write error messages when things go wrong.

The Q file format is an alternative to .P files, and is much easier to use if the virtual plant does not have stem sections. There are seven columns:

X,Y,Z
Coordinates of the leaf base
ang,az
Angle and azimuth of the normal to the leaf surface
or
Orientation (azimuth angle) of the midrib
L
Leaf length

The file is space-delimited (such as the output of write.table), and includes column headers (exactly named as above).

The leafplantkey file is a convenient way to organize a large number of plant files. This is a simple comma-separated text file without headers. The order is pfile,lfile (without quotes). For example, a "leafplantkey.txt" file may look like this:

 acaflo1.p,acaflo.l acaflo2.p,acaflo.l
acaflo3.p,acaflo.l acamyr1.p,acamyr.l acamyr2.p,acamyr.l acamyr3.p,acamyr.l
acasua1.p,acasua.l acasua2.p,acasua.l acasua4.p,acasua.l acasuaR02.p,acasua.l
acasuaR05.p,acasua.l acasuaR09.p,acasua.l 

Usage

constructplant(input = NULL, lfile = NULL, multiplier = 1, X0 = 0, Y0 = 0, Z0 = 0, warn = FALSE, quiet = FALSE)
readplantlist(pfiles = NA, lfiles = NA, lpk = "leafplantkey.txt", multiplier = 1)

Arguments

input
One of several possible inputs that contain the plant structure.
lfile
A leaf file. If not provided, a built-in triangle leaf is used.
multiplier
Multiplies length dimensions, e.g. to change units.
X0, Y0, Z0
New x,y,z coordinate of the stem base.
warn
If TRUE, writes warnings of minor issues with P file format.
quiet
If TRUE, no messages are ever shown.
pfiles, lfiles
Vectors of .p files and .l files.
lpk
Optionally, a 'leafplantkey' file. See Details.

Value

In the case of constructplant, an object of class plant3d. For readplantlist, an object of class plant3dlist (which is simply a list of objects as generated by constructplant to ease batch analyses).An object of class plant3dlist

See Also

plot.plant3d,readp

Examples

Run this code


## Not run: 
# # Read one plant:
# myplant <- constructplant("sompfile.p","somelfile.l")
# 
# # Pfile was in cm - should be in mm. Multiply all length dimensions by 10.
# myplant <- constructplant("sompfile.p","somelfile.l", multiplier=10)
# 
# # Read a couple of plants. 
# myplants <- constructplant(pfiles=c("plant1.p","plant2.p"), lfiles=rep("leaf.l",2))
# 
# ## End(Not run)


Run the code above in your browser using DataLab