exec/Wood2013_pseudocode_notes.R

# Pseudocode notes for Wood et al. (2013)
# Insects/Disease and Climate Change

DiscussClimateAndBioticDisturbances <- function(
	GHG = 'increase', temps = 'increase') {
	conclusions <- list()
	if (GHG == 'increase') {
		if (temperatures == 'increase') {
			ret <- list()
			for (i in 1:3) {
				ret <- append(ret, switch(i,
					'Physiology of insects --> changes to abundance and distribution'
					'Effects on tree defenses and tolerance',
					'Effects on insects ~ insects * competitors + insects * mutualists + insects * enemies'
					))
			}
			ReduceMortality(insects, when = 'winter')
			IncreaseDevelopment(insects, when = 'growing season')
			aa <- UpdateTree(phenology = 'leaf')
			bb <- UpdateInsects(phenology = 'feeding')
			cc <- UpdateInsects(what = 'bark_beetles', how = 'synchrony')
			if (cc == 'synchrony') {
				ma <- MassAttack(beetles, include_cc = TRUE)
				if (ma == TRUE) {
					KillTrees(which = 'stressed')
				}
			}
			if (aa == TRUE && bb == TRUE) {
				KillTrees()
			}
			UpdateWater()

		}
		if (drought == 'active' | nutrients == 'deficient') {
			if (inorganic_N == 'increase') {
				ReduceDefenses(trees, type = c('inducible', 'consitutive'))
			}
		} else if (drought > threshold) {
			KillTrees(which = c('stressed, healthy'))
		}
		CheckSymbiosis(bark_beetles, pathogenic_fungus)
	}

	UpdateConclusions(conclusions)

	return(conclusions)
}
bmcnellis/RSFIA documentation built on June 1, 2019, 7:40 a.m.