Title: | Granier's Sap Flow Sensors (TDP) Analysis |
---|---|
Description: | Set of functions designed to help in the analysis of TDP sensors. Features includes dates and time conversion, weather data interpolation, daily maximum of tension analysis and calculations required to convert sap flow density data to sap flow rates at the tree and plot scale (For more information see : Granier (1985) <DOI:10.1051/forest:19850204> & Granier (1987) <DOI:10.1093/treephys/3.4.309>). |
Authors: | Maxime Durand |
Maintainer: | Maxime Durand <[email protected]> |
License: | GPL-2 |
Version: | 1.0 |
Built: | 2025-02-20 04:29:12 UTC |
Source: | https://github.com/mxdurand/tdpanalysis |
Convert dates from the DD/MM/YYYY format to day of the year (DOY)
date.to.DOY(dates, format = "dd/mm/yyyy")
date.to.DOY(dates, format = "dd/mm/yyyy")
dates |
Vector with dates to convert. |
format |
Format of the date (support DD/MM/YYYY MM/DD/YYYY and YYYY/MM/DD). |
Return a vector containing the corresponding DOY.
dates = c("01/01/2000", "03/03/2000", "03/03/1999") date.to.DOY(dates=dates)
dates = c("01/01/2000", "03/03/2000", "03/03/1999") date.to.DOY(dates=dates)
Convert DOY and time into a single numerical variable
datetime(dates, Time)
datetime(dates, Time)
dates |
Vector with dates in the DOY format. |
Time |
Vector with time |
time vector should be numerical (e.g. as outputed by the time.to.cont function)
Return a vector containing DOY and time as a single numerical variable
dates = c(102,102,102,102,103,103,103,103) Time = c(22, 22.5, 23, 23.5, 0, 0.5, 1, 1.5) datetime(dates=dates, Time=Time)
dates = c(102,102,102,102,103,103,103,103) Time = c(22, 22.5, 23, 23.5, 0, 0.5, 1, 1.5) datetime(dates=dates, Time=Time)
Remove all data for the corresponding date argument
remove.fun(df, dates)
remove.fun(df, dates)
df |
Data frame containing a DOY column named "DOY". |
dates |
Character vector containing the DOY to remove from the data frame. |
This function is primarely used to remove days for which Tmax is too extreme.
Return the inputed data frame without the date corresponding the the "dates" argument.
DOY = c(rep(102, times=10), rep(103, times=10)) ID = c(rep("A", times=5), rep("B", times=5), rep("A", times=5), rep("B", times=5)) Tmax = c(rep(2.5, times=5), rep(2.7, times=5), rep(3.2, times=5), rep(3.4, times=5)) df <- data.frame(DOY, ID, Tmax) dates = c("103") remove.fun(df=df, dates=dates)
DOY = c(rep(102, times=10), rep(103, times=10)) ID = c(rep("A", times=5), rep("B", times=5), rep("A", times=5), rep("B", times=5)) Tmax = c(rep(2.5, times=5), rep(2.7, times=5), rep(3.2, times=5), rep(3.4, times=5)) df <- data.frame(DOY, ID, Tmax) dates = c("103") remove.fun(df=df, dates=dates)
Exemple dataset exemple for the TDPanalysis package
SpFl
SpFl
An object of class data.frame
with 432 rows and 4 columns.
"DATE" is dates in dd/mm/yyyy format. "TIME" is time in hh:mm:ss format, "ID" is sub-groups and "tension" is the measured tension from the TDP probe.
Calculate sapwood area based on diameter, heartwood diameter and sapwood fraction
SpWd_Area_calc(diam, SpWd_frac = 1, HtWd_diam = 0)
SpWd_Area_calc(diam, SpWd_frac = 1, HtWd_diam = 0)
diam |
Vector with diameter. |
SpWd_frac |
Numerical (from 0 to 1). Indicate the fraction of the diameter which is sapwood |
HtWd_diam |
Vector with diameter of the heartwood. |
If SpWD_frac and HtWd_diam are both entered, the function will return an error. Units of "diam" and "HtWd_diam" should be the same.
Return a numerical vector containing the sapwood area
diam = c(12,14,16,13,15) SpWd_Area_calc(diam=diam, SpWd_frac=0.2)
diam = c(12,14,16,13,15) SpWd_Area_calc(diam=diam, SpWd_frac=0.2)
Use the Granier formula to convert tension into sap flow density using daily or mean Tmax
tens.to.sapflow(tension, Tmax)
tens.to.sapflow(tension, Tmax)
tension |
Vector with tension. |
Tmax |
Vector with corresponding maximums of tension. |
Return a numerical vector containing the sap flow density
Granier A. 1985. A new method of sap flow measurement in tree stems. Annales Des Sciences Forestieres 42(2): 193-200.
Granier A. 1987. Evaluation of transpiration in a douglas-fir stand by means of sap flow measurements. Tree Physiology 3(4): 309-319.
Tmax = c(rep(2.5, times=5), rep(2.7, times=5), rep(3.2, times=5), rep(3.4, times=5)) tension = c(5:25) tens.to.sapflow(tension=tension, Tmax=Tmax)
Tmax = c(rep(2.5, times=5), rep(2.7, times=5), rep(3.2, times=5), rep(3.4, times=5)) tension = c(5:25) tens.to.sapflow(tension=tension, Tmax=Tmax)
Convert time from the HH:MM:SS format to a numerical
timecont(Time, sep = ":")
timecont(Time, sep = ":")
Time |
Vector with time to convert. |
sep |
Character element containing regular expression(s) to use to splitting. |
time vector should be in the HH:MM:SS format.
Return a vector containing the corresponding time.
Time = c("14:30:00", "20:45:00", "05:00:00") timecont(Time=Time)
Time = c("14:30:00", "20:45:00", "05:00:00") timecont(Time=Time)
Find the daily maximum of tension
Tmax.find(tension, dates, ID)
Tmax.find(tension, dates, ID)
tension |
Vector with tension. |
dates |
Vector with dates in the DOY format. |
ID |
Character vector for specifying which group the tension is assigned to (e.g. trees) |
Return a vector containing daily Tmax for each group specified in the ID argument
tension = c(1:20) dates = c(rep(102, times=10), rep(103, times=10)) ID = c(rep("A", times=5), rep("B", times=5), rep("A", times=5), rep("B", times=5)) Tmax.find(tension=tension, dates=dates, ID=ID)
tension = c(1:20) dates = c(rep(102, times=10), rep(103, times=10)) ID = c(rep("A", times=5), rep("B", times=5), rep("A", times=5), rep("B", times=5)) Tmax.find(tension=tension, dates=dates, ID=ID)
Calculate a mean Tmax for each sub-group
Tmax.mean(df)
Tmax.mean(df)
df |
Data frame containing all Tmax for each sub-group. |
The data frame should contain a column named "Tmax" whith all Tmax and a column named "ID" to identify which Tmax belong to which sug-group.
Return the inputed data frame with a new column names "Tmax_mean".
ID = c(rep("A", times=5), rep("B", times=5), rep("A", times=5), rep("B", times=5)) Tmax = c(rep(2.5, times=5), rep(2.7, times=5), rep(3.2, times=5), rep(3.4, times=5)) DOY = c(rep(102, times=10), rep(103, times=10)) df <- data.frame(DOY, ID, Tmax) Tmax.mean(df)
ID = c(rep("A", times=5), rep("B", times=5), rep("A", times=5), rep("B", times=5)) Tmax = c(rep(2.5, times=5), rep(2.7, times=5), rep(3.2, times=5), rep(3.4, times=5)) DOY = c(rep(102, times=10), rep(103, times=10)) df <- data.frame(DOY, ID, Tmax) Tmax.mean(df)
Plot the Tmax with indications of extreme values
Tmaxplot(df)
Tmaxplot(df)
df |
Data frame containing Tmax, identification of sub-groups and DOY. |
The dataframe should contain at least 3 columns named "Tmax" (daily maximums of tension), "DOY" (day of the year) and "ID" (sub-groups). The red horizontal lines reprensents 3 times the inter-quartile range (3*IQR) of all the Tmax of the data. The blue horizontal line reprensent the 1.5*IQR without the Tmax outside the red lines.
Return a plot of Tmax by days for each sub-group
DOY = c(rep(102, times=10), rep(103, times=10)) ID = c(rep("A", times=5), rep("B", times=5), rep("A", times=5), rep("B", times=5)) Tmax = c(rep(0.7512, times=5), rep(0.7359, times=5),rep(0.7644, times=5),rep(0.7666, times=5)) df <- data.frame(DOY, ID, Tmax, stringsAsFactors = FALSE) Tmaxplot(df)
DOY = c(rep(102, times=10), rep(103, times=10)) ID = c(rep("A", times=5), rep("B", times=5), rep("A", times=5), rep("B", times=5)) Tmax = c(rep(0.7512, times=5), rep(0.7359, times=5),rep(0.7644, times=5),rep(0.7666, times=5)) df <- data.frame(DOY, ID, Tmax, stringsAsFactors = FALSE) Tmaxplot(df)
Calculate daily transpiration for each sub-group inputed
Wat.transp(Sapflow, days, ID)
Wat.transp(Sapflow, days, ID)
Sapflow |
Vector with sap flow. |
days |
Vector containg the days for which to calculate transpiration |
ID |
Character vector containing identification for each sub-group |
!!Beware of the units!! The Granier formula usually convert tension into sap flow density (in kg.dm-2.h-1). So, you should first convert sap flow density into sap flow (in kg.h-1). Moreover, if you take measurment every 30 minutes sap flow should be corrected by dividing the value by 2.
Return a data frame with transpiration for each day and sub-group inputed
ID = c(rep("A", times=5), rep("B", times=5), rep("A", times=5), rep("B", times=5)) Sapflow = c(rep(2.5, times=5), rep(2.7, times=5), rep(3.2, times=5), rep(3.4, times=5)) days = c(rep(102, times=10), rep(103, times=10)) Wat.transp(Sapflow=Sapflow, days=days, ID=ID)
ID = c(rep("A", times=5), rep("B", times=5), rep("A", times=5), rep("B", times=5)) Sapflow = c(rep(2.5, times=5), rep(2.7, times=5), rep(3.2, times=5), rep(3.4, times=5)) days = c(rep(102, times=10), rep(103, times=10)) Wat.transp(Sapflow=Sapflow, days=days, ID=ID)