Learn R Programming

DGVM3D (version 1.0.0)

read.LPJ: Prepare the output table from LPJ-GUESS for visualization

Description

Stand ID and Patch ID start counting at 0 in the standard output. Here the value of 1 is added, to be consistent with R.

Usage

read.LPJ(file = "vegstruct.out", stand.id = 1, patch.id = NULL,
  year = NULL, lon = NULL, lat = NULL, grass = TRUE)

Arguments

file

the filename to be read

stand.id

the stand ID default to 0.

patch.id

if a single patch should be used (default all)

year

if a single year should be used (default all)

lon

if a single longitude should be used (default all). Should be defined, if more than one gridpoint is in the output.

lat

as above

grass

should grasses be included (so far they are not yet further processed).

Value

individual vegetation data.frame with equal indivuduals from each cohort.

Examples

Run this code
# NOT RUN {
dgvm3d.locations = read.table("gridlist.txt",
                              col.names=c("Lon", "Lat", "Name"), sep="\t",
                              stringsAsFactors=FALSE)
dgvm3d.succession=list()
for (i in 1:nrow(dgvm3d.locations)) {
  dgvm3d.succession[[dgvm3d.locations$Name[i]]] =
   read.LPJ("vegstruct.out",
            lon=dgvm3d.locations$Lon[i],
            lat=dgvm3d.locations$Lat[i])
   dgvm3d.succession[[i]] = dgvm3d.succession[[i]][!(dgvm3d.succession[[i]]$Year %% 5) &
                                                   dgvm3d.succession[[i]]$Year > 1859, ]
}
# }

Run the code above in your browser using DataLab