ReportMeanVegChanges: Report Mean Vegetation Changes

Description Usage Arguments Value Author(s) Examples

View source: R/ReportMeanVegChanges.R

Description

Writes to the console, the mean values over all the years in the data, of the probabilities of transitions between vegetation types.

Usage

1
ReportMeanVegChanges(baseCalib, VTs, vtFracs, changeFracs, vtXpvt = data.frame(NULL))

Arguments

baseCalib

The name of the base calibration, e.g. "GLOBAL", "CONUS".

VTs

A vector of integer VTYPE values

vtFracs

A matrix with one row for each element of VTs, and one column for each year of the simulation. The value of the matrix element is the fraction of all active gridcells occupied by the given vegetation type in the given year.

changeFracs

A three-dimensional array. The third dimension varies over the years of the simulation. The first two dimensions vary over the length of VTs. The element value is the fraction of cells of the first veg type which transition to the second veg type in the given year.

vtXpvt

vtXpvt is a dataframe, which defaults to NULL. When it is not null, it is used to crosswalk integer VTYPE values to 3-letter PVT abbreviations.

Value

Nothing meaningful is returned.

Author(s)

Dave Conklin

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
## The function is currently defined as
function (baseCalib, VTs, vtFracs, changeFracs, vtXpvt = data.frame(NULL)) 
{
    vtNames = VTnames(baseCalib)
    nVT = length(VTs)
    nYrs = dim(changeFracs)[3]
    for (kSrc in 1:nVT) {
        meanFracOfAllCells = mean(vtFracs[kSrc, ])
        if (meanFracOfAllCells > 0) {
            if (length(vtXpvt) > 0) {
                cat(c("\n", "mean transition probabilities for transitions out of", 
                  levels(vtXpvt$PVT)[vtXpvt$PVT[kSrc]], "...\n"))
                for (kDest in 1:nVT) if (kSrc != kDest) {
                  meanTransitionProbability = mean(changeFracs[kSrc, 
                    kDest, ])
                  if (meanTransitionProbability > 0) {
                    cat(c(levels(vtXpvt$PVT)[vtXpvt$PVT[kSrc]], 
                      "2", levels(vtXpvt$PVT)[vtXpvt$PVT[kDest]], 
                      meanTransitionProbability, "\n"))
                  }
                }
            }
        }
    }
    cat("\n")
    cat(c("Mean values over ", dim(vtFracs)[2], " years:\n"))
    cat("frac of all cells, VTYPE\n")
    for (kSrc in 1:nVT) {
        meanFracOfAllCells = mean(vtFracs[kSrc, ])
        if (meanFracOfAllCells > 0) {
            vtName = vtNames[[VTs[kSrc]]]
            cat(c(meanFracOfAllCells, VTs[kSrc], vtName, "\n"))
        }
    }
  }

MC2toPath documentation built on May 29, 2017, 7:54 p.m.