Title: | Standardize Tracheidograms |
---|---|
Description: | Contains functions to standardize tracheid profiles using the traditional method (Vaganov) and a new method to standardize tracheidograms based on the relative position of tracheids within tree rings. |
Authors: | Filipe Campelo |
Maintainer: | Filipe Campelo <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.1.1 |
Built: | 2025-02-17 03:13:41 UTC |
Source: | https://github.com/cran/tracheideR |
This function computes a tracheidogram from microscope light measurements in gray (0-255).
getTrac(x, val50 = 120, mw = 5, scale = 1)
getTrac(x, val50 = 120, mw = 5, scale = 1)
x |
a vector with the light measurements (pixel gray-level values) |
val50 |
the value giving the "intensity" of the light measurements at which the measurments should be made (for more details please see the help of |
mw |
width of the rolling window to smooth the original data (for more details please see the help of |
scale |
distance per pixel, default = 1 |
This function uses the tgram
function (tgram package) to convert gray pixel values (0-255) into a raw tracheidogram (keeping the original number of cells).
getTrac
returns a list with following elements:
n
number of cells
pos
pos$RingWidth
gives the tree-ring width and pos$x
gives the "position" of each tracheid.
LD
a vector
with the lumen diameter (LD).
CWT
a vector
with the radial cell wall thikness (CWT).
LWratio
a vector
with the LD/CWT ratio.
DeSoto, L., De la Cruz, M., Fonti, P. (2011). Intra-annual patterns of tracheid size in the Mediterranean tree Juniperus thurifera as an indicator of seasonal water stress. Canadian Journal of Forest Research 41: 1280-1294. Vaganov, E., 1989. The tracheidogram method in tree-ring analysis and its application, in: Cook, E., Kairiukstis, L. (Eds.), Methods of Dendrochronology: Applications in the Environmental Sciences. Kluwer Academic Publishers, Dordrecht, The Netherlands.
tgram
## Not run: y2010ray1 <- getTrac(tch$y2010$ray1, scale = 0.169) y2010 <- getTrac(tch$y2010, scale = 0.169) TCH <- lapply(tch,getTrac, scale = 0.169) TCH$y2010$ray1$n #number of tracheids in ray1 in the year 2010 TCH$y2010$ray1$pos$RingWidth #number of tracheids in ray1 in the year 2010 #getTrac(tch$y2010$ray2, scale = 0.169) #getTrac(data.frame(tch$y2010$ray2), scale=0.169) ## End(Not run)
## Not run: y2010ray1 <- getTrac(tch$y2010$ray1, scale = 0.169) y2010 <- getTrac(tch$y2010, scale = 0.169) TCH <- lapply(tch,getTrac, scale = 0.169) TCH$y2010$ray1$n #number of tracheids in ray1 in the year 2010 TCH$y2010$ray1$pos$RingWidth #number of tracheids in ray1 in the year 2010 #getTrac(tch$y2010$ray2, scale = 0.169) #getTrac(data.frame(tch$y2010$ray2), scale=0.169) ## End(Not run)
This function plots the intra-ring variation of a tracheid feature (e.g. LD, CWT or LD/CWT) along the growing season and, optionally, the intra-annual variation of a climatic variable can be added to the same plot.
ringPlot(traq, varMean = NULL, varYear = NULL, m0 = 3, mt = 6.75, m1 = 11, type = c("LD", "CWT", "LWratio"), ylab = match.arg(type), main = "", addGS = TRUE, addMonths = addGS, ..., varMeanCol = "grey80", varYearCol = "red", varName = "")
ringPlot(traq, varMean = NULL, varYear = NULL, m0 = 3, mt = 6.75, m1 = 11, type = c("LD", "CWT", "LWratio"), ylab = match.arg(type), main = "", addGS = TRUE, addMonths = addGS, ..., varMeanCol = "grey80", varYearCol = "red", varName = "")
traq |
ordered sequence of a tracheid feature (e.g. LD) |
varMean |
vector with monthly values of a given environmental variable |
varYear |
vector with monlthy values of an environmental variable for a specific year |
m0 |
the start of the growing season (in months); the default value is 3 that corresponds to day of the year (doy) 60. |
mt |
the moment of transition from earlywood to latewood; the default value is 6.75. |
m1 |
the end of the growing season; default value is 11. |
type |
a string that defines the tracheid features to be plotted, defaults "LD" |
ylab |
the y axis title (for the tracheid feature variable), default value is |
main |
an overall title for the plot, if no |
addGS |
logical; if |
addMonths |
logical; if |
... |
graphical parameters for |
varMeanCol |
the default value, |
varYearCol |
the color to plot monthly environmental values; the default value is |
varName |
the y axis title (for the environmental variable),default value is |
This function returns an invisible data.frame
(used to produced the graph)
## Not run: # year 2010 y2010raw <- getTrac(tch$y2010, scale = .169) y2010std <- tracheider(y2010raw) par(oma = c(2,1,1,0.5)) par(mar = c(2,4,1,4)) y2010LD <- ringPlot(traq = y2010std, varMean = colMeans(sw), varYear = sw["2010",], main=2010,type = "LD", ylim = c(0,45), ylab = expression(paste("LD (", mu,"m)")),varName = "Soil moisture") # year 2013 y2013raw <- getTrac(tch$y2013, scale = .169) y2013std <- tracheider(y2013raw) y2013LD <- ringPlot(traq = y2013std, varMean = colMeans(sw), varYear = sw["2013",], main=2013,type = "LD", ylim = c(0,45), ylab = expression(paste("LD (", mu,"m)")),varName = "Soil moisture") # 2010 & 2013 in the same plot par(mfcol = c(2,1)) par(oma = c(2,1,1,0.5)) par(mar = c(2,4,1,4)) ringPlot(y2010std, varMean = colMeans(sw), varYear = sw["2010",], type = "LD", ylab = "", main=2010, addGS = FALSE, addMonths = FALSE) ringPlot(y2013std, varMean = colMeans(sw), varYear = sw["2013",], type = "LD", ylab=expression(paste("LD (", mu,"m)")), main = 2013, addGS = TRUE, varName= "Soil moisture") ## End(not run)
## Not run: # year 2010 y2010raw <- getTrac(tch$y2010, scale = .169) y2010std <- tracheider(y2010raw) par(oma = c(2,1,1,0.5)) par(mar = c(2,4,1,4)) y2010LD <- ringPlot(traq = y2010std, varMean = colMeans(sw), varYear = sw["2010",], main=2010,type = "LD", ylim = c(0,45), ylab = expression(paste("LD (", mu,"m)")),varName = "Soil moisture") # year 2013 y2013raw <- getTrac(tch$y2013, scale = .169) y2013std <- tracheider(y2013raw) y2013LD <- ringPlot(traq = y2013std, varMean = colMeans(sw), varYear = sw["2013",], main=2013,type = "LD", ylim = c(0,45), ylab = expression(paste("LD (", mu,"m)")),varName = "Soil moisture") # 2010 & 2013 in the same plot par(mfcol = c(2,1)) par(oma = c(2,1,1,0.5)) par(mar = c(2,4,1,4)) ringPlot(y2010std, varMean = colMeans(sw), varYear = sw["2010",], type = "LD", ylab = "", main=2010, addGS = FALSE, addMonths = FALSE) ringPlot(y2013std, varMean = colMeans(sw), varYear = sw["2013",], type = "LD", ylab=expression(paste("LD (", mu,"m)")), main = 2013, addGS = TRUE, varName= "Soil moisture") ## End(not run)
A data frame with monthly soil moisture values for the period 1901-2013.
data("sw")
data("sw")
A data.frame
with months in columns and the years as rows (1901-2013). The months are the column names and the years are the row names.
...
...
...
colMeans(sw) plot(colMeans(sw), type="l", xlab="months", ylab="soil water")
colMeans(sw) plot(colMeans(sw), type="l", xlab="months", ylab="soil water")
This dataset has 2 years (2010 and 2013) each one with 3 raw profiles (in grayscale).
data("tch")
data("tch")
A list
with 2 elements:
y2010
a list with 3 radii
y2013
a list with 3 radii
...
...
...
names(tch) names(tch$y2010)
names(tch) names(tch$y2010)
This function computes standardized tracheidograms from raw tracheidograms.
tracheider(traq, method = c("nCells", "kCells", "relPos"), k = 20)
tracheider(traq, method = c("nCells", "kCells", "relPos"), k = 20)
traq |
a raw tracheidogram (or a list of raw tracheidograms) |
method |
a |
k |
a integer to determine the number of cells of the standardized tracheidogram when |
This function takes as input raw tracheidograms (obtained using the getTrac
function) and standardizes them using 3 different methods. The first method ("nCells") standardizes rays of a given ring using the mean number of cells, allowing that different rings have different number of cells. The method "kCells" normalizes tracheidograms to a constant number of tracheids (k
). The "relPos" method standardizes the tracheidogram based on the relative position of each tracheid inside the tree ring.
the function tracheider
returns a list with the following elements:
LD
ordered sequence of lumen diameters.
CWT
ordered sequence of radial cell wall thikness.
LWratio
ordered sequence of LD/CWT ratio.
## Not run: y2010 <- getTrac(tch$'y2010', scale=0.169) y2013 <- getTrac(tch$'y2013', scale=0.169) ## nCells y2010n <- tracheider(y2010, method = "nCells") y2013n <- tracheider(y2013, method = "nCells") plot(rowMeans(as.data.frame(y2010n$LD)), type="l", xlim=c(0,86), ylim=c(0,60), yaxs="i", xaxs="i", xlab="Number of tracheid", ylab=expression(paste("LD (", mu,"m)")), col=2, lwd=2) lines(rowMeans(as.data.frame(y2013n$LD)), col="blue", lwd=2) legend("topright",lty=1,lwd=2,col = c(2,4), legend=c("2010 ","2013 "), text.col = c(2,4), box.col = "#00000000", bg="#00000000") ## k = 53 TCH <- lapply(tch, getTrac, scale=0.169) TCHn53 <- lapply(TCH, tracheider,method = "kCells", k=53) plot(rowMeans(as.data.frame(TCHn53$'y2010'$LD)), type="l", xlab="Number of tracheid", ylab=expression(paste("LD (", mu,"m)")), xlim=c(0,54), ylim=c(0,60), col=2, lwd=2, yaxs="i", xaxs="i") lines(rowMeans(as.data.frame(TCHn53$'y2013'$LD)), col="blue", lwd=2) legend("topright",lty=1,lwd=2,col = c(2,4),legend=c("2010 ","2013 "), text.col = c(2,4), box.col = "#00000000", bg="#00000000") ## Relative position TCH <- lapply(tch, getTrac, scale=0.169) TCHrelPos <- lapply(TCH, tracheider, method ="relPos") plot(rowMeans(as.data.frame(TCHrelPos$'y2010'$LD)), type="l", xlim=c(0,101), ylim=c(0,60), col=2, lwd=2, xlab="Number of tracheid", ylab=expression(paste("LD (", mu,"m)")), yaxs="i", xaxs="i") lines(rowMeans(as.data.frame(TCHrelPos$'y2013'$LD)), col="blue", lwd=2) legend("topright",lty=1,lwd=2,col = c(2,4), legend=c("2010 ","2013 "), text.col = c(2,4), box.col = "#00000000", bg="#00000000") ## End(not run)
## Not run: y2010 <- getTrac(tch$'y2010', scale=0.169) y2013 <- getTrac(tch$'y2013', scale=0.169) ## nCells y2010n <- tracheider(y2010, method = "nCells") y2013n <- tracheider(y2013, method = "nCells") plot(rowMeans(as.data.frame(y2010n$LD)), type="l", xlim=c(0,86), ylim=c(0,60), yaxs="i", xaxs="i", xlab="Number of tracheid", ylab=expression(paste("LD (", mu,"m)")), col=2, lwd=2) lines(rowMeans(as.data.frame(y2013n$LD)), col="blue", lwd=2) legend("topright",lty=1,lwd=2,col = c(2,4), legend=c("2010 ","2013 "), text.col = c(2,4), box.col = "#00000000", bg="#00000000") ## k = 53 TCH <- lapply(tch, getTrac, scale=0.169) TCHn53 <- lapply(TCH, tracheider,method = "kCells", k=53) plot(rowMeans(as.data.frame(TCHn53$'y2010'$LD)), type="l", xlab="Number of tracheid", ylab=expression(paste("LD (", mu,"m)")), xlim=c(0,54), ylim=c(0,60), col=2, lwd=2, yaxs="i", xaxs="i") lines(rowMeans(as.data.frame(TCHn53$'y2013'$LD)), col="blue", lwd=2) legend("topright",lty=1,lwd=2,col = c(2,4),legend=c("2010 ","2013 "), text.col = c(2,4), box.col = "#00000000", bg="#00000000") ## Relative position TCH <- lapply(tch, getTrac, scale=0.169) TCHrelPos <- lapply(TCH, tracheider, method ="relPos") plot(rowMeans(as.data.frame(TCHrelPos$'y2010'$LD)), type="l", xlim=c(0,101), ylim=c(0,60), col=2, lwd=2, xlab="Number of tracheid", ylab=expression(paste("LD (", mu,"m)")), yaxs="i", xaxs="i") lines(rowMeans(as.data.frame(TCHrelPos$'y2013'$LD)), col="blue", lwd=2) legend("topright",lty=1,lwd=2,col = c(2,4), legend=c("2010 ","2013 "), text.col = c(2,4), box.col = "#00000000", bg="#00000000") ## End(not run)