proc_treenet: Process TreeNet Data to L1 or L2

Description Usage Arguments Details Value See Also Examples

View source: R/proc_treenet.R

Description

proc_treenet processes L0 dendrometer data from the TreeNet server directly to L1 (i.e. time-aligned data) or L2 (i.e. cleaned L1 data).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
proc_treenet(
  site = NULL,
  sensor_name = NULL,
  from = NULL,
  to = NULL,
  last = NULL,
  reso = 10,
  frost_thr = 5,
  lowtemp = 5,
  tol_jump = 50,
  tol_out = 10,
  interpol = NULL,
  frag_len = NULL,
  proc_to = "L2",
  plot = TRUE,
  plot_period = "full",
  plot_export = TRUE,
  plot_name = "proc_L2_plot",
  plot_show = "all",
  plot_phase = FALSE,
  path_cred = NULL,
  year = "asis",
  iter_clean = 1,
  tz = "Etc/GMT-1",
  use_intl = FALSE
)

Arguments

site

character, specify the site. String is not case sensitive.

sensor_name

character, specify the name of a single or multiple sensors (e.g. "LWF-Demo-1.dendrometer.ch0").

from

character, optional argument to select data after a specific date ("YYYY-MM-DD").

to

character, optional argument to select data up to a specific date ("YYYY-MM-DD").

last

numeric, optional argument to specify the number of latest values. If last is specified from and to need to be empty.

reso

numeric, desired output time resolution (in minutes). See Details for more information on data aggregation.

frost_thr

numeric, increases the thresholds for outlier and jump detection in periods of probable frost (i.e. temperature < lowtemp). The thresholds are multiplied by the value provided.

lowtemp

numeric, specifies the temperature in °C below which frost shrinkage or expansion is expected. Default value is set to 5°C due to hysteresis shortly before or after frost events.

tol_jump

numeric, defines the rigidity of the threshold above or below which a value is flagged for jump correction. Lower values increase the rigidity (see Details for further information).

tol_out

numeric, defines the rigidity of the threshold above or below which a value is classified as an outlier. Lower values increase the rigidity (see Details for further information).

interpol

numeric, length of gaps (in minutes) for which values are linearly interpolated after data cleaning. Set interpol = 0 to disable gapfilling. If interpol = NULL the default value is set to interpol = 2.1 * reso (i.e. two timestamps).

frag_len

numeric, specifies the length of data fragments occurring in-between missing data that are automatically deleted during data cleaning. This can be helpful to remove short fragments of erroneous data within a period of missing data, i.e. after jumps. If frag_len = NULL the default value is set to frag_len = 2.1.

proc_to

character, specify to which level the data should be processed. Can be one of L0, L1 or L2.

plot

logical, specify whether the changes that occurred during data cleaning should be plotted.

plot_period

character, specify whether plots should be displayed for the whole period (plot_period = "full"), separately for each year (plot_period = "yearly") or for each month (plot_period = "monthly").

plot_export

logical, specifies whether the plots are exported as a PDF file to the working directory or are plotted in the console.

plot_name

character, specify name of the PDF to which the plots are saved.

plot_show

character, specify whether all periods should be plotted (plot_show = "all") or only those periods in which L1 dendrometer data changed during data cleaning (plot_show = "diff").

plot_phase

logical, specify whether identified phases should be plotted.

path_cred

optional argument to specify the full path to the file config.yml containing the database login data. File can also be copied to the main folder of the package for automatic recognition.

year

character, if year = "asis" the output data.frame covers the same period as the input data; if year = "full" then the output data.frame is expanded to complete years, i.e. YYYY-01-01 to YYYY-12-31.

iter_clean

numeric, specifies the number of times the cleaning process is repeated. Can be used to check whether running the cleaning process multiple times has an effect on the results. In most cases, a single iteration is sufficient.

tz

specify the desired time zone. Default is "UTC".

use_intl

logical, specify whether this function is used internally on the server. Changes stop() error messages to message() only.

Details

Time-aligned temperature data temp_L1 is used to define periods in which frost shrinkage is probable, e.g. when the temperature is below lowtemp. Without temperature data, frost shrinkages may be classified as outliers. For more details and an example see the following vignette: vignette("Introduction-to-treenetproc", package = "treenetproc").

Temperature data can also be provided along with dendrometer data. In this case, the name of the temperature series has to contain the string "temp". In case no temperature dataset is specified, a sample temperature dataset will be used with a warning. The sample temperature dataset assigns permanent frost to the three months December, January and February.

Outliers and jumps are identified when exceeding a lower or upper threshold. Thresholds are obtained on the basis of density distributions of differences between neighbouring data points. The rigidity of the thresholds can be controlled with the arguments tol_jump and tol_out. For more information on the calculation of the thresholds the user is referred to Knüsel et al. (2020, in prep).

Value

The function returns a data.frame with processed dendrometer data containing the following columns:

series

name of the dendrometer series.

ts

timestamp with format %Y-%m-%d %H:%M:%S.

value

dendrometer value (µm).

max

highest measured value up to this timestamp (µm).

twd

tree water deficit (µm), i.e. the amount of stem shrinkage expressed as the difference between max and value.

gro_yr

growth since the beginning of the year (µm). Also calculated for years with missing data.

frost

indicates frost periods (i.e. periods in which the temperature is below lowtemp).

flags

character vector specifying the changes that occurred during the processing. For more details see the following vignette: vignette("Introduction-to-treenetproc", package = "treenetproc")

version

package version number.

See Also

proc_L1 to process dendrometer or climate data to L1.
proc_dendro_L2 to process dendrometer data from L1 to L2.
corr_dendro_L1 to correct errors before processing.
corr_dendro_L2 to correct errors after processing.

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
proc_treenet(site = "sagno", year = "full", plot_period = "yearly")

proc_treenet(site = "lens", plot_period = "monthly")

proc_treenet(sensor_name = c("Alvaneu-2.dendrometer.ch0",
                             "Alvaneu-4.dendrometer.ch0"))

## End(Not run)

treenet/treenetproc documentation built on June 16, 2021, 4:39 p.m.