sapfluxnetr

2022-02-10

sapfluxnetr
Víctor
Víctor Granda-García
Ecosystem Modelling Facility - CREAF
Rafael
Rafael Poyatos
CREAF
Víctor
Víctor Flo
CREAF

sapfluxnetr

CRAN
status CRAN RStudio mirror
downloads R build
status

sapfluxnetr provides tools for a tidy data analysis for the first global database of sap flow measurements (Sapfluxnet Project)

Examples

You can work with individual sites:

 1# load packages
 2library(sapfluxnetr)
 3library(ggplot2)
 4
 5# ARG_MAZ example site data
 6data('ARG_MAZ', package = 'sapfluxnetr')
 7data('sfn_metadata_ex', package = 'sapfluxnetr')
 8
 9# plot site sapflow measurements versus vpd
10sfn_plot(ARG_MAZ, formula_env = ~ vpd)
 1
 2# daily sapflow and environmental metrics
 3arg_maz_metrics <- daily_metrics(
 4  ARG_MAZ, tidy = TRUE, metadata = sfn_metadata_ex
 5)
 6#> [1] "Crunching data for ARG_MAZ. In large datasets this could take a while"
 7#> [1] "General data for ARG_MAZ"
 8
 9# plot daily aggregations
10ggplot(arg_maz_metrics, aes(x = vpd_q_95, y = sapflow_q_95, colour = pl_code)) +
11  geom_point()

You can work with multiple sites also:

1# ARG_TRE and AUS_CAN_ST2_MIX example sites
2data('ARG_TRE', package = 'sapfluxnetr')
3data('AUS_CAN_ST2_MIX', package = 'sapfluxnetr')
4multi_sfn <- sfn_data_multi(ARG_TRE, ARG_MAZ, AUS_CAN_ST2_MIX)
5
6# plotting the individual sites. It creates a list of plots
7plots_list <- sfn_plot(multi_sfn, formula_env = ~ vpd)
8plots_list[['AUS_CAN_ST2_MIX']]
9#> Warning: Removed 526066 rows containing missing values (`geom_point()`).
 1
 2# daily sapflow standard metrics
 3multi_metrics <- daily_metrics(
 4  multi_sfn, tidy = TRUE, metadata = sfn_metadata_ex
 5)
 6#> [1] "Crunching data for ARG_TRE. In large datasets this could take a while"
 7#> [1] "General data for ARG_TRE"
 8#> [1] "Crunching data for ARG_MAZ. In large datasets this could take a while"
 9#> [1] "General data for ARG_MAZ"
10#> [1] "Crunching data for AUS_CAN_ST2_MIX. In large datasets this could take a while"
11#> [1] "General data for AUS_CAN_ST2_MIX"
12
13# plot daily aggregations
14ggplot(multi_metrics, aes(x = vpd_q_95, y = sapflow_q_95, colour = si_code)) +
15  geom_point(alpha = 0.2)
16#> Warning: Removed 10966 rows containing missing values (`geom_point()`).

Installation

You can install sapfluxnetr from CRAN:

1install.packages('sapfluxnetr')

Be advised, sapfluxnetr is in active development and can contain undiscovered bugs. If you find something not working as expected fill a bug at https://github.com/sapfluxnet/sapfluxnetr/issues

Overview

Please see vignette('sapfluxnetr-quick-guide', package = 'sapfluxnetr') for a detailed overview of the package capabilities.