read_sfn_data: Read sfn_data from disk

Description Usage Arguments Value Examples

View source: R/getters.R

Description

Given a site code and a route, read_sfn_data will return the selected sfn_data object

Usage

1
read_sfn_data(site_codes, folder = ".")

Arguments

site_codes

A character vector with the site code/s

folder

Route to the folder containing the .RData file. Default to working directory.

Value

If site_codes is a vector of length 1, an sfn_data object with the selected site data. If site_codes is a vector of length > 1, then a sfn_data_multi object containing all selected sites.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# Let's access the data in "folder". This typically is the folder where the
# sapflow data at the desired unit level is (i.e. "RData/plant"), but in this
# example we will create a temporal folder with some data to test the function
folder <- tempdir()
save(ARG_TRE, file = file.path(folder, 'ARG_TRE.RData'))
save(ARG_MAZ, file = file.path(folder, 'ARG_MAZ.RData'))

# now we read a single site
ARG_TRE_test <- read_sfn_data('ARG_TRE', folder)
ARG_TRE_test

# or we can read multiple sites at once
multi_sfn <- read_sfn_data(
  c('ARG_TRE', 'ARG_MAZ'), folder
)
multi_sfn

sapfluxnetr documentation built on Aug. 28, 2020, 1:13 a.m.