#This script by B. Shuman produces the lake-level reconstruction for Deep Pond, Massachusetts following the approach described in Appendix I of Pribyl and Shuman (2014) A Computational Approach to Quaternary Lake-Level Reconstruction Applied in the Central Rocky Mountains, Wyoming, USA. Quaternary Research. It relies on data and produces the reconstruction like that shown in Marsicek, J., S. Brewer, D. Foster, W.W. Oswald, and B. Shuman. (2013) Moisture and temperature changes associated with the mid-Holocene Tsuga decline in the northeastern United States. Quaternary Science Reviews 80:129-142. http://dx.doi.org/10.1016/j.quascirev.2013.09.001 #This version of the script also produces a figure showing the data and reconstructions similar to Fig. 8 in Pribyl and Shuman (2014) or Fig. 7 in Marsicek et al. (2013). Note that modification of script used by Pribyl and Shuman (2014) to account for times when all cores contain littoral sediments yields some lower reconstructed water levels than in Marsicek et al. (2013), and that this version of the reconstruction does not assume that the base of a core is a maximum constraint on water levels prior to the basal age of the core, which had been assumed by Marsicek et al. (2013). #Read in core data Core = read.csv("Deep_cores.csv",header=T) Thresh = read.csv("FaciesThresholds_Deep.csv",header=T) #Provide inputs Num.cores=4 total.iterations=30 #version b (allow to rise only to modern sed limit) SedLim.modern=200 #version a (allow to rise to modern level) #SedLim.modern=0 Length=12000 Interp.interval=50 #Create interpolation intervals Int50=((1:(Length/Interp.interval))*Interp.interval)-Interp.interval #Interpolate core data Data.i=matrix(NA,length(Int50),Num.cores) Elev.i=matrix(NA,length(Int50),Num.cores) i=1 while(i= Sublit.Threshold) #Estimate littoral elevations All.lit.max=apply(Core.lit*Elev.i,1,max,na.rm=T) #Estimate sublittoral elevation All.sublit.max=apply(Core.sublit*Elev.i,1,max,na.rm=T) #Account for intervals with only littoral sediment Only.lit=(All.lit.max==Elev.i[,1])*(All.sublit.max==All.lit.max) All.sublit.max[Only.lit>0]=max(Elev.i,na.rm=T) #Account for intervals with littoral but no sub-littoral sediment by using next deepest core (shallowest profundal core & thus the minimum depth of non-littoral sediments) as lower bound on position of sublittoral zone NextDeepestCore=Core.profundal*Elev.i NextDeepestCore[rowMeans(NextDeepestCore)==0]=max(Elev.i[rowMeans(NextDeepestCore)==0]) NextDeepestCore[NextDeepestCore==0]=NA DeepestCoreElev=apply(Elev.i,1,max,na.rm=T) NextDeepestCore[is.na(NextDeepestCore)]=DeepestCoreElev[is.na(NextDeepestCore)] NextDeepestCore=apply(NextDeepestCore,1,min,na.rm=T) All.sublit.max[All.sublit.max==All.lit.max]=NextDeepestCore[All.sublit.max==All.lit.max] All.sublit.max[is.na(All.sublit.max)]=DeepestCoreElev[is.na(All.sublit.max)] #Account for intervals with no littoral or sub-littoral sediment by using depth of shallowest core as lower bound on position of sublittoral zone ShallowestCoreElev=apply(Elev.i,1,min,na.rm=T) All.sublit.max=All.sublit.max+((All.sublit.max==0)*ShallowestCoreElev) #Estimate sediment limit depths All.sublit.smooth=(All.sublit.max[1:(length(Int50)-2)]+All.sublit.max[2:(length(Int50)-1)]+All.sublit.max[3:length(Int50)])/3 All.lit.smooth=(All.lit.max[1:(length(Int50)-2)]+All.lit.max[2:(length(Int50)-1)]+All.lit.max[3:length(Int50)])/3 SedLim = (All.sublit.smooth+All.lit.smooth)/2 #Add results to matrix of iterations Recon.Iterations[,iteration]=SedLim UpperBounds[,iteration]=All.lit.smooth LowerBounds[,iteration]=All.sublit.smooth iteration=iteration+1 } SedLim = rowMeans(Recon.Iterations) All.sublit.smooth=rowMeans(LowerBounds) All.lit.smooth=rowMeans(UpperBounds) #All.sublit.smooth=apply(LowerBounds,1,quantile,prob=0.95,na.rm=T) #All.lit.smooth=apply(UpperBounds,1,quantile,prob=0.05,na.rm=T) SedLim.smooth=cbind(Int50[2:(length(Int50)-1)],SedLim,All.lit.smooth, All.sublit.smooth) colnames(SedLim.smooth)=c("Age","LakeElev.Anom","UpperBound","LowerBound") SedLim.smooth=data.frame(SedLim.smooth) #Write output file write.csv(Recon.Iterations, "Iterations.csv", row.names = TRUE) write.csv(SedLim.smooth, "LLrecon.csv", row.names = FALSE) ################ Plot ##################### #Make two panel plot quartz(width=(4*0.66667)+1,height=6) t=layout(matrix(c(1,2,2), 3, 1, byrow = TRUE)) Length=12000 par(mai=c(0,0.75,0.5,0.25)) plot(Core$Age[Core$Core.DepthRank==1],Core$LOI[Core$Core.DepthRank==1],type="l",xlim=c(Length,0),xaxp=c(Length,0,Length/3000),ylim=c(0,100),xaxt="n",xlab="",ylab="% LOI",frame.plot=F,lwd=1.5,col="dark gray") abline(h=Thresh[1,2],lwd=1,col="gray") abline(h=Thresh[1,1],lwd=1,col="gray") title("A. Deep Pond core data") i=1 while(i