Sap Flow Analyzer : A tool to standardize sap flow estimation and scaling to whole-tree water use using the HFD method

1. Sap flow measurements are fundamental to understanding water use in trees and could aid in predicting climate change effects on forest function. Deriving knowledge from such measurements requires empirical calibrations and upscal - ing methods to translate thermometric recordings to tree water use. Here, we developed a user-friendly open-source application, the Sap Flow Analyzer (SFA), which estimates sap flow rates and tree water use from the heat field deforma - tion (HFD) instruments. 2. The SFA incorporates four key features to ensure maximum accuracy and repro - ducibility of sap flow estimates: diagnosis diagrams to assess data patterns visu - ally, regression models implemented to increase accuracy when estimating K (the main HFD parameter), three approaches to upscale sap flow rates to whole-tree water use and visualization of the input parameters' uncertainty. Thirteen par - ticipants were given three raw datasets and assigned data processing tasks using the SFA user guide, from estimating sapwood depth to scaling sap flow rates to whole-tree water use to assess the reproducibility and applicability of the SFA. 3. Participants' results were reasonably consistent and independent of their back - ground in using the SFA, R, or HFD method. The results showed lower variability for high flow rates (SD: mean 1% vs. 10%). K estimates and sapwood


| INTRODUC TI ON
In vivo sap flow monitoring has significantly increased our understanding of whole tree responses to environmental variations (Poyatos et al., 2021).To date, most methods used to measure sap flow involve heat to trace sap movement through pulsed, continuous, or controlled variable heating methods (Foken et al., 2017).
Temperature changes caused by convective heat transport allow for the calculation of sap flow velocity (length per unit time) or rate (kg H 2 O per section per unit time).
Heat field deformation (HFD, Nadezhdina et al., 1998) offers many advantages over the existing methods.Measuring sap flow in several radial stem sections allows for a detailed investigation of sap flow patterns throughout the sapwood, providing a more accurate estimation of total plant water use by integrating radial profiles (Link et al., 2020).Moreover, using constant heating, HFD allows higher-time resolution monitoring (down to 10 s), contributing to identifying rapid responses to abrupt changes in the environment (Nadezhdina, 2018) or plant hydraulic architecture (David et al., 2012).HFD can accurately measure medium to high sap flow rates, low flow rates and reverse sap flow (Nadezhdina, 2018), which might be a significant mechanism for hydraulic redistribution and optimal water balance maintenance along the soil-plant-atmosphere continuum (Coopman et al., 2021;Liu et al., 2023).
Estimating sap flow from thermodynamic approaches is timeconsuming and requires advanced coding skills for effective data processing.There is a high methodological variability in data processing and generally low transparency in computational workflows (Poyatos et al., 2021).In this paper, we introduce a user-friendly application ("Sap Flow Analyzer," hereafter called the SFA) based on R Shiny (an R package for interface web applications, Chang et al., 2022), designed to increase reproducibility in the estimation of sap flow based on HFD measurements.The SFA is an open-source tool to process raw temperature data efficiently, effectively, and reproducibly.To estimate sap flow, the HFD method requires the determination of the so-called parameter K, which characterizes the heat conducting properties at the measuring points during no-flow conditions (see Supporting Information A chapter 3 for a definition and further details for the K value).In the SFA, we provide different approaches to estimate K (i.e.K is directly extracted from the raw data when no-flow conditions are measured in the field, while regressions are available to approximate K when no-flow measurements are absent from the dataset, see Section 3.3).Moreover, the SFA includes several data filtering options (e.g.remove unused measuring points, spurious measurements and date ranges), graphics and data-table outputs (e.g.filtered data subsets, estimated K and final sap flow estimates).These features warrant detailed backtracking records and reproducibility of calculations, increasing the quality of HFD-derived sap flow estimates, future inter-comparability of datasets and transparency of computational workflows.
In the following sections, we present the functionalities of the SFA and a reproducibility analysis based on a multi-participant masked trial.

| BACKG ROUND: HE AT FIELD DEFORMATION ME THOD
The HFD method uses symmetrical (dT sym ) and asymmetrical (dT as ) temperature differences to describe a heat field around a heater needle (Figure 1a, Nadezhdina et al., 2008).Each sensor needle contains several thermometers to measure heat conductance along the radial profile of a stem (Figure 1b).Translating temperature differences to sap flow rates requires the determination of K for each thermometer position.The primary metric is sap flow per section (SFS, g ⋅ cm −1 ⋅ h −1 ).From this, sap flow density (SFD, g ⋅ cm −2 ⋅ h −1 ), sap flow rate (SF, kg ⋅ h −1 ) and whole-tree water use (TWU, kg ⋅ d −1 ) can be calculated (Nadezhdina, 2018; see methodology in Supporting Information A).

| THE SAP FLOW ANALY ZER
The Sap Flow Analyzer (SFA, v0.3.3, Wimmler et al., 2024) is an R Shiny (Chang et al., 2022) application to process temperature measurements recorded with the HFD method.The app allows the user to (i) define wood and sensor properties, (ii) prepare the data, (iii) determine K, (iv) calculate the sap flow metrics and tree water use and (v) assess the uncertainty of input parameters.Processed data can be downloaded as data files (csv or xlsx format) or graphics (jpeg, pdf, rdata).Each feature is described below (see Supporting Information A for equations and detailed descriptions).

| Wood and sensor settings
To estimate SFD, SF and TWU, wood and sensor properties are crucial; sapwood and heartwood depths (swd and hwd, respectively) should be provided.The SFA allows the following inputs for wood and sensor properties: swd (cm), hwd (cm), stem diameter (d, cm), stem circumference (c, cm), bark thickness (bt, cm), distance to the first thermometer (l t , mm), spacer length (or sensor protrusion, l s , mm) and distance between thermometers (l d , mm) (Figure 1b).These parameters are needed to estimate the distance between the centre and the outer sapwood and each thermometer's position to the stem's center.Wood thermal diffusivity of sapwood (D, cm 2 s ) and the distances between needles (axial, Z ax , and tangential, Z tg , sensor distances, in mm)-both required to calculate SFS-are specified in the settings interface.

| Data preparation
The SFA provides five options to clean the data before processing: • select dates and times, for example remove the date when the sensor was installed or removed Raw temperature differences can be seen as violin plots, boxplots, histograms or frequency polygons to ease data cleaning.

| K estimation
K describes the heat field under no-flow conditions (i.e.where dT sym dT as = 0) for each thermometer position and is determined using the 'K-diagram' (Nadezhdina, 2018).The K-diagram shows all temperature differences, that is dT sym , dT as and dT s−a , plotted against the ratio dT sym dT as and K is the intersection of dT s−a or dT as with the y-axis (Figure 2a).surrounded by conducting sapwood (red) and a bark (grey).Each sensor needle (upper left corner) can have several thermometers, here 8, which lie on fictive annuli (r 1 to r 8 ).Each sensor configuration is defined by three measures: Distance to the first thermometer (l t ), spacer length (l s ), and distance between thermometers (l d ).
for each K estimate.Additionally, K can be set manually or loaded from previous SFA outputs.

| Sap flow metrics
In the SFA, sap flow index (SFI), SFS and SFD are summarized as sap flow metrics.The SFI is the symmetrical temperature difference around the linear heater, indicating plant water status and stem water storage (Nadezhdina et al., 2015).SFI provides a first insight into water flow patterns and direction without estimating K or information on wood properties.SFS is the flow rate in a section of sapwood, while SFD is the integrated flow across the swd.SFS and SFD are estimated using Equations ( 2) to (4) in Nadezhdina (2018).Besides plotting diurnal patterns of SFS, the SFA shows the radial profile of SFS as boxplots.
SFS of each thermometer position can be scaled to SF and TWU.
Scaling methods for SF or TWU additionally require each thermometer's position in relation to the center of the stem and the distance between the outer sapwood and the center.

| Scaling to sap flow
Three approaches to estimate SF are implemented in the SFA: • Method 1: Weighted integration using the area of annuli (Hatton et al., 1990;Nadezhdina et al., 2002).
Only methods 1 and 2 require swd values.Results might differ among methods, as methods 1 and 3 estimate and process SF for each position, while method 2 averages SF over the whole area covered by the sensors.All methods should yield similar results with correct wood and sensor properties (Nadezhdina, 2018).

| Tree water use
TWU is the integrated diurnal SF and is thus dependent on the selected scaling method.We used the trapezoidal rule integration of the area under the SF curve (Süli & Mayers, 2003).

| Uncertainty
To assess the effect of input parameters (thermal diffusivity of sapwood, axial and tangential sensor distances, swd and K) on sap flow metrics, the SFA provides uncertainty estimates for SFS, SFD , SF and TWU.Uncertainty estimates are provided as individual and cumulative effects, showing, respectively, the absolute and relative deviation from the estimated values for each input parameter individually (Figure S1a) and the relative deviation from the original value for SF and TWU when all deviations are included (Figure S1b).

| US ER TRIAL
The SFA is a standardizing tool to analyse HFD measurements, and different users should obtain similar results when analysing the same dataset.To verify this, 13 users independently analysed three datasets (Table 1).Participants were assigned the same tasks with the SFA user guide as the only guide (Supporting Information B).The first task was to use datasets I and II to estimate SFD, SF, and TWU using the SFA.The second task was to reproduce the analysis of dataset III following a short description.The participants were asked to self-evaluate their experience with the SFA, the HFD method and the use of R. Of all participants, 12 were experienced with the HFD method, nine had experience using R, and only two had used the SFA before.

| Statistical analysis
All analyses were done with R (R Core Team, 2020).The Quartile Coefficient of Variation (CVq) was used to assess the variation in results caused by participant-specific inputs.The CVq allows comparing the variation between and within groups, that is scaling methods and datasets (Arachchige et al., 2022).
with q1 and q3 being the first and third quartile, respectively.CVq is less sensitive to outliers than, for example, the coefficient of variation.

| Task 1
The aim of task 1 was to test the general usability of the SFA and result in consistency among users.Estimated TWU averaged 23.4 (±2.4 SD) and 3.0 (±1.5 SD) L day −1 , for spruce and hornbeam, respectively (Figure 3b).The variation in TWU estimates was lower for the spruce dataset, with CVq ranging between 0.03 and 0.04 (mean: 0.036), while the CVq for the hornbeam data ranged between 0.07 and 0.32 (mean: 0.147, Figure 3a).For the hornbeam, the variation in the estimated reverse flow was high (CVq up to 0.83), due to the sensitivity of SFS to variations in K close to no-flow conditions (Figure S2).However, the share of total flow was marginal (mean: 3.8%).
Variation between participants was mainly due to different estimates of K or swd.Variation in K was approximately twice as high for spruce than for hornbeam (mean CVq 0.02 vs. 0.01, respectively).
The absence of no-flow records for the spruce made it challenging to estimate K, which was approximated using 'no-flow regression,' and participants could choose from different settings to optimize the approximation.In contrast, because the hornbeam dataset contained no-flow recordings, variation in K estimates was lower.TWU estimates varied with the scaling method.The average difference between TWU obtained with all scaling methods were 4.9% and 12.9% for spruce and hornbeam, respectively.For scaling methods 1 and 2, the most significant deviation from the group mean was caused by the incorrect determination of swd and thermometer positions.This was particularly challenging for the hornbeam dataset, where participants had to identify that the sensor needles were not fully inserted in the stem, and swd had to be set to the active needle length (in the absence of a core sample).Only five participants entered swd correctly; one did not provide swd.
Recalculating the participants' results for hornbeam by manually standardizing inputs showed that scaling method 1 was most sensitive to user inputs, especially swd and distance between thermometers and trunk center, but less sensitive to K (Figure S3).
Correcting swd reduced the mean CVq by half, that is from 0.26 to 0.13.The same sensitivity pattern was observed for method 2 but with lower values of CVq.In contrast, method 3 was the least sensitive to user inputs other than K.While recalculating TWU with correct swd, reduced the CVq by 13%, recalculating TWU with equal values of K for all participants reduced the CVq from 0.11 to 0.001.

| Task 2
The aim of task 2 was to reconstruct an analysis described in a short paragraph.The text provided details on the installation settings of the HFD sensors and tree parameters, and participants were required to estimate TWU using scaling method 3. 85% of the participants extracted the information correctly, except for swd, and returned a mean TWU of 12.7 (±0.51 SD) L day −1 .Inaccurate swd estimates did not affect the daily TWU result, as the assigned scaling method is not dependent on swd.To estimate K, participants had to select the no-flow regression with certain filters applied.While 10 participants chose the no-flow regression, only 6 applied the required filters.However, this resulted in a slight variation in TWU (~ CVq of 0.023, Figure 4).Overall, 6 participants reproduced the TWU with a deviation < ±1%, and 9 did so with a deviation of ±5%.
For both tasks, previous user experience with R, the HFD method, or the SFA had no significant effect on the estimation of K and swd, and the scaling to TWU (Wilcoxon rank sum test, p > 0.05).
However, for the hornbeam dataset, the estimation of swd differed according to the participants' experience with the SFA and the HFD method, with experienced users estimating greater sapwood depths (see Supporting Information B for details).The masked trial presented here revealed some challenges users can face with the SFA.For instance, participants without R experience required a short introduction to R/RStudio.For all datasets analysed, outliers in the estimated TWU resulted from different sensor and wood properties specifications, namely, the distance between the first thermometer in the trunk, the centre and swd.Variations in such metrics can be solved with field training in the use of the HFD method, accurate documentation of the experimental set-up, and user attention in providing wood and sensor properties to the SFA.However, these inputs played a minor role in estimating TWU when using scaling method 3. We thus recommend using this latter scaling method when there is uncertainty or lack of exact swd measurements and thermometer needle positions.Moreover, we suggest SFS estimates rather than TWU to understand sap flow patterns.SFS variation among participants was negligible (median CVq : 0.005-0.08,Figure S4) and mainly apparent during low flow conditions as SFS is highly sensitive to variations in K during low flow conditions.Based on the feedback from the trial, we have added a recommendations section to the user guide, including guidance on how to correctly enter wood and sensor properties, and how to estimate K under different conditions.

| DISCUSS ION
In brief, this open-source, user-friendly SFA application supports the analysis of HFD measurements, regardless of the user's prior experience with the SFA, R or the HFD method.The SFA provides greater accessibility, consistency, and transparency in converting raw thermometric flow data into flow rate and total water use estimates at the tree level.
4. The SFA provides an easy way to visualize and process sap flow and tree water use data from HFD measurements.It is the first free and open software tool for HFD users.The ability to trace analysis steps ensures reproducibility, increasing transparency and consistency in data processing.Developing tools such as the SFA and masked trials are essential for more precise workflows and improved quality and comparability of HFD sap flow datasets.K E Y W O R D S heat field deformation, R Shiny, sap flow estimation app, transpiration, whole-tree water use 2041210x, 0, Downloaded from https://besjournals.onlinelibrary.wiley.com/doi/10.1111/2041-210X.14392by NHS Education for Scotland NES, Edinburgh Central Office, Wiley Online Library on [09/08/2024].See the Terms and Conditions (https://onlinelibrary.wiley.com/terms-and-conditions)on Wiley Online Library for rules of use; OA articles are governed by the applicable Creative Commons License

•
select minimum and maximum limits for each temperature • remove outliers • remove rows with missing values (e.g.due to logging or heating interruptions) in the data file • select individual sensor positions (e.g.only thermometers within the sapwood) Two methods are implemented to determine K: 'no-flow regression' for datasets without no-flow records and 'no-flow median' for datasets containing no-flow or reverse-flow recordings.Temperature differences produce a loop-like pattern in the K-diagram during the day(Nadezhdina, 2018); the 'no-flow regression' approach extracts the linear part of this curve in an iterative process, where K is the intercept of a linear regression model applied to the remaining data points.Several filter options (e.g.time filter) are available to help optimize the estimates.In the 'no-flow median' approach, K can be read from the K-diagram.If there are several values close to dT sym dT as = 0 , K is their median.The quality of the K estimate can be examined with two control diagrams (Figure 2b,c, see Nadezhdina, 2018 for details).The SFA interface will display a K-diagram and the control diagrams F I G U R E 1 (a) Schematic representation of the sensor and heater arrangement for the heat field deformation configuration (modified based on Nadezhdina et al., 2008).(b) Idealized representation of a stem cross-section, showing non-conducting heartwood (dark)

F
I G U R E 2 Example of K estimation for one thermometer.(a) K-diagram: K is estimated using no-flow regression with the time filter set to 22:00-08:00 h.Black dots represent data used for the regression.The y-intercept of the regression line of dTas gives the K estimate.(b) Control diagram I extends the K diagram by shifting dTsa by K.An intersection of this new set of points with dTsym at the origin indicates that K is correctly estimated.(c) Control diagram II extends the K-diagram by adding the term R. The data clouds (purple and yellow) should intersect at x = 0 if K is correctly estimated.
All instruments are the same type, with a distance to the first thermometer of 20 mm and Z ax and Z tg of 15 and 5 mm, respectively.The datasets are unpublished field data records of the co-authors and were recorded with commercial sensors from ICT International Pty Ltd. (Armidale, Australia) and Dendronet (Brno, Czech Republic).2041210x,0, Downloaded from https://besjournals.onlinelibrary.wiley.com/doi/10.1111/2041-210X.14392by NHS Education for Scotland NES, Edinburgh Central Office, Wiley Online Library on [09/08/2024].See the Terms and Conditions (https://onlinelibrary.wiley.com/terms-and-conditions)on Wiley Online Library for rules of use; OA articles are governed by the applicable Creative Commons License

A
common challenge in science (communication) is the reproducibility of results.Particularly for sap flow measurements, high methodological variability in data analyses and generalized low transparency in computational workflows have been identified(Poyatos et al., 2021).Uncertainties are introduced at different stages, from sensor installation and determination of input parameters defining the measurement environment to calculating sap F I G U R E 3 Variation of daily TWU.(a) The panels display the quartile coefficient of variation (CVq) for each scaling method and dataset, indicating a higher degree of variation between participants depending on the selected scaling method.(b) The panels shows the variation in the estimated daily TWU.Each data point represents the estimate of a participant, and the colour indicates the selected scaling method.2041210x, 0, Downloaded from https://besjournals.onlinelibrary.wiley.com/doi/10.1111/2041-210X.14392by NHS Education for Scotland NES, Edinburgh Central Office, Wiley Online Library on [09/08/2024].See the Terms and Conditions (https://onlinelibrary.wiley.com/terms-and-conditions)on Wiley Online Library for rules of use; OA articles are governed by the applicable Creative Commons Licenseflow metrics using different methods(Looker et al., 2016;Peters et al., 2018).In recent years, open-source software, which helps standardize data processing, has emerged for some sap flow methods(Peters et al., 2021, Oishi et al., 2016).The SFA contributes to the standardization of HFD-derived sap flow data analysis.For the HFD method, K, a parameter that describes the heat field at noflow conditions, has to be estimated for each thermometer.The obtained sap flow per section (SFS) can then be scaled to wholetree water use (TWU).The SFA offers a systematic methodology to estimate K, supported by diagnosis diagrams and backtracking records to warrant reproducibility.