## Example of leaf appearance calculation library(lattice) ## Phyllochron for maize 25-55 degree days (ave. 40) phyll <- 40 T.b <- 8 ## Base temperature cmi <- read.table("cmiWet-1990.txt", header=TRUE) class(cmi) dim(cmi) ## Temperature is in Fahrenheit TempC <- (cmi$Temp - 32) * 5/9 ## Coding exercise to calculate GDD res.col <- numeric(length(TempC)) for(i in 1:length(TempC)){ tmp <- TempC[i] - T.b if(tmp < 0){ res.col[i] <- 0 }else{ res.col[i] <- tmp } } plot(res.col) TTcum <- cumsum(res.col) doy <- seq(from = 1, to = 365, by = 1) xyplot(TTcum ~ doy, type = "l", ylab = "Cummulative Thermal Time", xlab = "Day of the Year") ## How do we calculate the number of leaves? ## First select a range of values plausible for leaf production ## Day of crop emergence and tasseling day1 <- 110 ## Apr 20 dayn <- 195 ## July 14 TTcum.sub <- TTcum[day1:dayn] - 258 LeafProd <- TTcum.sub %/% 40 xyplot(LeafProd ~ day1:dayn, type = "l") # Maize produces 16-23 leaves (Hay & Porter, 2006) # Could up to 30 leaves under the right conditions