This assingment was complete using knitr, R Markdown, and RStudio (Ver. 0.96.330) . This was published to RPubs, a free hosting site for R Markdown documents by RStudio.
require(fields)
require(plyr)
This is the plot of PAR with time
plot(sun_time, PAR, type = "o")
This is the color contour plot modelers use to wow the rest of us.
image.plot(sun_time, z, uI.field, ylab = "Depth", xlab = "Time")
Contour with depth truncated for emphasis on detail
contour(sun_time, z, uI.field, yaxt = "n", nlevels = 10, ylab = "Depth",
xlab = "Time", ylim = c(-20, 0))
axis(2, at = seq(0, -20, -5), labels = seq(0, 20, 5), las = 1)
How is the depth of the Ik light level changing over these 120 hours? How does it change daily? How does it change across days?
By how many meters (approximately) does the 1 W m-2 isolume change when there is a does a doubling of the attenuation coeffiecient? What about tripling?
########### Double k
uI.field.2 <- NULL
k = 0.15 * 2
for (x in 1:length(PAR)) {
uI <- PAR[x] * exp(k * z)
uI.field.2 <- rbind(uI.field.2, uI)
}
########### Triple k
uI.field.3 <- NULL
k = 0.15 * 3
for (x in 1:length(PAR)) {
uI <- PAR[x] * exp(k * z)
uI.field.3 <- rbind(uI.field.3, uI)
}
contour(sun_time, z, uI.field, levels = c(1), yaxt = "n", lwd = 1.8,
ylab = "Depth", xlab = "Time", ylim = c(-40, 0))
axis(2, at = seq(0, -40, -5), labels = seq(0, 40, 5), las = 1)
contour(sun_time, z, uI.field.2, levels = c(1), add = T, col = "red",
lwd = 1.8)
contour(sun_time, z, uI.field.3, levels = c(1), add = T, col = "blue",
lwd = 1.8)
legend("bottom", legend = c("k", "k*2", "k*3"), col = c("black",
"red", "blue"), pch = NA, lwd = 1.8, horiz = T)