Closed sklesse closed 3 weeks ago
Great. I'll work on this. Will need a Rd file as well.
Hi Andy,
I'm pasting the content of the .rd file here. First time for everything, let me know if something is missing or off.
data(bakker.data)
would refer to the rwl and d2pith files I attached above. A short description for the required example files could be: "Ring-width series and metadata from a beech site in Zofingen, Switzerland."
Cheers, Stefan
\name{bakker{dplR}} \alias{bakker{dplR}}
\title{ Basal Area Increment (Bakker) } \description{ Convert multiple ring-width series to basal area increment (i.e., ring area) following the proportional method of Bakker (2005). } \usage{ \method{print}{bakker}(rwl, bakker.d2pith) }
\arguments{ \item{rwl}{a data.frame with series as columns and years as rows such as that produced by read.rwl} \item{d2pith}{A mandatory data.frame containing four variables. Variable one (series in the example below) gives the series ID as either characters or factors. These must exactly match colnames(rwl). Variable two (PO) gives the number of rings estimated to be missing to the pith. Variable three (d2pith) gives the estimated distance to the pith (mm). Variable four (diam) gives the diameter at breast height in cm.} } \details{ This converts ring-width series (mm) to ring-area series (mm squared) (aka basal area increments) based on the diameter of the tree, the missing distance to the pith and the missing number of rings to the pith, following the proportional method for reconstructing historical tree diameters by Bakker (2005). It prevents bai.out transformations from producing negative increments when the sum of all ring widths in a series is larger than DBH/2. It prevents bai.in transformations from producing too small values when the sum of all ring widths in a series is smaller than DBH/2.
} \value{ A list containing the following objects: \item{DBHhist_raw}{data.frame with the reconstructed diameter for each series with column names, row names and dimensions of rwl.} \item{baiBakker_raw}{data.frame with the basal area increments for each series with column names, row names and dimensions of rwl.}
} \references{ Bakker, J.D., 2005. A new, proportional method for reconstructing historical tree diameters. Canadian Journal of Forest Research 35, 2515–2520. https://doi.org/10.1139/x05-136
} \author{ Code by Stefan Klesse }
\examples{
data(bakker.data) dummy<-bakker(bakker.rwl,bakker.d2pith)
pith<-bakker.d2pith[,c(1,3)] diam<-bakker.d2pith[,c(1,4)] diam$diam<-diam$diam*10 #convert dbh (cm) to dbh (mm)
plot.ts(bai.out(bakker.rwl,diam)[,54],main=colnames(bakker.rwl)[54],las=1,ylab="BAI mm2",ylim=c(0,6000)) lines(bai.out(bakker.rwl)[,54],col=1,lty=2) abline(h=0,lty=2,col="grey") lines(bai.in(bakker.rwl,pith)[,54],col=2) lines(bai.in(bakker.rwl)[,54],col=2,lty=3) lines(ts(dummy$baiBakker_raw[,54],start=1),col=4,lwd=2)
legend(legend=c("Bakker","outside-in with DBH","inside-out with POE","outside-in no DBH","inside-out no POE"), bty="n",x="topleft",lty=c(1,1,1,2,3),col=c(4,1,2,1,2),lwd=c(2,1,1,1,1))
text(0,3000,label=paste("DBH (cm) = ",bakker.d2pith[54,4]),adj=0) text(0,2500,label=paste("2x core length w/o pith offset = ",2/10(sum(bakker.rwl[,54],na.rm=T)),"cm"),adj=0,) text(0,2000,label=paste("2x pith offset = ",bakker.d2pith[54,3]2/10,"cm"),adj=0) text(0,1500,label=paste("2x core length w/ pith offset = ",2/10*(sum(bakker.rwl[,54],na.rm=T)+bakker.d2pith[54,3]),"cm"),adj=0)
plot.ts(bai.out(bakker.rwl,diam)[,53],main=colnames(bakker.rwl)[53],las=1,ylab="BAI mm2",ylim=c(0,6000)) lines(bai.out(bakker.rwl)[,53],col=1,lty=2) abline(h=0,lty=2,col="grey") lines(bai.in(bakker.rwl,pith)[,53],col=2) lines(bai.in(bakker.rwl)[,53],col=2,lty=3) lines(ts(dummy$baiBakker_raw[,53],start=1),col=4,lwd=2)
legend(legend=c("Bakker","outside-in with DBH","inside-out with POE","outside-in no DBH","inside-out no POE"), bty="n",x="topleft",lty=c(1,1,1,2,3),col=c(4,1,2,1,2),lwd=c(2,1,1,1,1))
text(0,3000,label=paste("DBH (cm) = ",bakker.d2pith[53,4]),adj=0) text(0,2500,label=paste("2x core length w/o pith offset = ",2/10(sum(bakker.rwl[,53],na.rm=T)),"cm"),adj=0,) text(0,2000,label=paste("2x pith offset = ",bakker.d2pith[53,3]2/10,"cm"),adj=0) text(0,1500,label=paste("2x core length w/ pith offset = ",2/10*(sum(bakker.rwl[,53],na.rm=T)+bakker.d2pith[53,3]),"cm"),adj=0)
}
Ok. Made an initial commit. Still need to fuss with the documentation and data structures a bit to be consistent with other dplR conventions. Note that I'm breaking the data into the rwl file as zof.rwl
and the ancillary data into zof.anc
. I'll bug you for info about those shortly. But can you give me a site name and species for zof (e.g., gp.rwl is titled "Ponderosa Pine Ring Widths from Gus Pearson Natural Area")? That'll be a start.
@sklesse , You should be able to install the dev version via install.packages("dplR", repos = "https://andybunn.r-universe.dev/")
I'll likely muck around with the help files some. I know you mentioned a forthcoming paper. I can add that to the refs section. So species, site name, and approximate location for the data will be a good start.
Hi Andy, the site name is Zofingen, Switzerland, 47.297 N, 6.963 E, 500 m elevation. It's European beech (Fagus sylvatica). So, "European Beech Ring Widths from Zofingen, Switzerland" should do it.
The data were part of my 2018 paper: Klesse, S., Babst, F., Lienert, S., Spahni, R., Joos, F., Bouriaud, O., Carrer, M., Filippo, A.D., Poulter, B., Trotsiuk, V., Wilson, R., Frank, D.C., 2018. A Combined Tree Ring and Vegetation Model Assessment of European Forest Growth Sensitivity to Interannual Climate Variability. Global Biogeochemical Cycles 32, 1226–1240. https://doi.org/10.1029/2017GB005856
Regarding the forthcoming paper, I will let you know as soon as it approaches acceptance.
Ok. It's all in there. Take a look and suggest any changes you might want to see. I can do a release of 1.7.7 on CRAN if that's helpful for the paper.
Somehow R shoots me an error message after downloading your dev version.
library(dplR) Error: package or namespace load failed for ‘dplR’ in dyn.load(file, DLLpath = DLLpath, ...): unable to load shared object '/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/dplR/libs/dplR.so': dlopen(/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/dplR/libs/dplR.so, 0x0006): Library not loaded: /opt/gfortran/lib/gcc/aarch64-apple-darwin20.0/12.2.0/libgfortran.5.dylib Referenced from: <08EE96C1-8CC6-3019-90F1-2E15B59418C9> /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/dplR/libs/dplR.so Reason: tried: '/opt/gfortran/lib/gcc/aarch64-apple-darwin20.0/12.2.0/libgfortran.5.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/gfortran/lib/gcc/aarch64-apple-darwin20.0/12.2.0/libgfortran.5.dylib' (no such file), '/opt/gfortran/lib/gcc/aarch64-apple-darwin20.0/12.2.0/libgfortran.5.dylib' (no such file), '/usr/local/lib/libgfortran.5.dylib' (no such file), '/usr/lib/libgfortran.5.dylib' (no such file, not in dy In addition: Warning message: package ‘dplR’ was built under R version 4.3.3
Via the r-univ?
install.packages("dplR", repos = https://andybunn.r-universe.dev/)
I can see all the binaries.
https://andybunn.r-universe.dev/bin/windows/contrib/4.3/dplR_1.7.7.zip
From: sklesse @.> Date: Friday, May 31, 2024 at 12:56 AM To: AndyBunn/dplR @.> Cc: Andy Bunn @.>, Comment @.> Subject: Re: [AndyBunn/dplR] Bakker method (Issue #21)
Somehow R shoots me an error message after downloading your dev version.
library(dplR) Error: package or namespace load failed for ‘dplR’ in dyn.load(file, DLLpath = DLLpath, ...): unable to load shared object '/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/dplR/libs/dplR.so': dlopen(/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/dplR/libs/dplR.so, 0x0006): Library not loaded: /opt/gfortran/lib/gcc/aarch64-apple-darwin20.0/12.2.0/libgfortran.5.dylib Referenced from: <08EE96C1-8CC6-3019-90F1-2E15B59418C9> /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/dplR/libs/dplR.so Reason: tried: '/opt/gfortran/lib/gcc/aarch64-apple-darwin20.0/12.2.0/libgfortran.5.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/gfortran/lib/gcc/aarch64-apple-darwin20.0/12.2.0/libgfortran.5.dylib' (no such file), '/opt/gfortran/lib/gcc/aarch64-apple-darwin20.0/12.2.0/libgfortran.5.dylib' (no such file), '/usr/local/lib/libgfortran.5.dylib' (no such file), '/usr/lib/libgfortran.5.dylib' (no such file, not in dy In addition: Warning message: package ‘dplR’ was built under R version 4.3.3
— Reply to this email directly, view it on GitHubhttps://github.com/AndyBunn/dplR/issues/21#issuecomment-2141424630, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AC7UCXKVHHRYGFS7J7JIVNDZFAULJAVCNFSM6AAAAABGUJLFMKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBRGQZDINRTGA. You are receiving this because you commented.Message ID: @.***>
Installs fine from a win machine in my lab via install.packages("dplR", repos = https://andybunn.r-universe.dev/)
So let me know.
From: Andy Bunn @.> Date: Friday, May 31, 2024 at 9:06 AM To: AndyBunn/dplR @.>, AndyBunn/dplR @.> Cc: Comment @.> Subject: Re: [AndyBunn/dplR] Bakker method (Issue #21) Via the r-univ?
install.packages("dplR", repos = https://andybunn.r-universe.dev/)
I can see all the binaries.
https://andybunn.r-universe.dev/bin/windows/contrib/4.3/dplR_1.7.7.zip
From: sklesse @.> Date: Friday, May 31, 2024 at 12:56 AM To: AndyBunn/dplR @.> Cc: Andy Bunn @.>, Comment @.> Subject: Re: [AndyBunn/dplR] Bakker method (Issue #21)
Somehow R shoots me an error message after downloading your dev version.
library(dplR) Error: package or namespace load failed for ‘dplR’ in dyn.load(file, DLLpath = DLLpath, ...): unable to load shared object '/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/dplR/libs/dplR.so': dlopen(/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/dplR/libs/dplR.so, 0x0006): Library not loaded: /opt/gfortran/lib/gcc/aarch64-apple-darwin20.0/12.2.0/libgfortran.5.dylib Referenced from: <08EE96C1-8CC6-3019-90F1-2E15B59418C9> /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/dplR/libs/dplR.so Reason: tried: '/opt/gfortran/lib/gcc/aarch64-apple-darwin20.0/12.2.0/libgfortran.5.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/gfortran/lib/gcc/aarch64-apple-darwin20.0/12.2.0/libgfortran.5.dylib' (no such file), '/opt/gfortran/lib/gcc/aarch64-apple-darwin20.0/12.2.0/libgfortran.5.dylib' (no such file), '/usr/local/lib/libgfortran.5.dylib' (no such file), '/usr/lib/libgfortran.5.dylib' (no such file, not in dy In addition: Warning message: package ‘dplR’ was built under R version 4.3.3
— Reply to this email directly, view it on GitHubhttps://github.com/AndyBunn/dplR/issues/21#issuecomment-2141424630, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AC7UCXKVHHRYGFS7J7JIVNDZFAULJAVCNFSM6AAAAABGUJLFMKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBRGQZDINRTGA. You are receiving this because you commented.Message ID: @.***>
Also @sklesse . I did submit v1.7.7 to CRAN. It was necessary after I transferred the dplR repo to the opendendro GH. So the Bakker func will be live there on CRAN in a few hours. Can sill modify on dev version which will be 1.7.8 here on GH.
Hi Andy, here is the code for the bakker function, two files to work with, and two plots.
zoffinal.txt ZOF_d2pith.csv