Assigns default units to the columns and keeps variable name attributes as in original file.
fLoadFluxnet15(
file_path,
additional_columns = character(0),
colname_NEE = "NEE",
...
)
scalar string: the path to the csv file
character vector of columns to
read in addition of standard columns of read_from_fluxnet15
.
Can be a character vector or a object return by cols
name (scalar string) of column that reports NEE observations
further arguments to read_csv
ds_fn15 <- Example_DETha98 %>%
fConvertTimeToPosix('YDH',Year = 'Year',Day = 'DoY', Hour = 'Hour') %>%
dplyr::mutate(
TIMESTAMP_END = POSIXctToBerkeleyJulianDate(DateTime),
season = factor(199801)
) %>%
dplyr::rename(SW_IN = "Rg", TA = "Tair", USTAR = "Ustar") %>%
dplyr::select(dplyr::one_of(c(
"TIMESTAMP_END","NEE","SW_IN","TA","VPD","USTAR","season")))
#> Converted time format 'YDH' to POSIX with column name 'DateTime'.
head(ds_fn15)
#> TIMESTAMP_END NEE SW_IN TA VPD USTAR season
#> 1 1.99801e+11 -1.21 0 7.4 4.6 0.72 199801
#> 2 1.99801e+11 1.72 0 7.5 4.6 0.52 199801
#> 3 1.99801e+11 NA 0 7.1 4.3 0.22 199801
#> 4 1.99801e+11 NA 0 6.6 3.9 0.20 199801
#> 5 1.99801e+11 2.55 0 6.6 3.9 0.33 199801
#> 6 1.99801e+11 NA 0 6.5 4.0 0.15 199801
fname <- tempfile()
readr::write_csv(ds_fn15, fname)
# standard columns are renamed to REddyProc defaults
ds_eproc <- fLoadFluxnet15(fname)
head(ds_eproc)
#> TIMESTAMP_END NEE SW_IN TA VPD USTAR DateTime Ustar Tair Rg
#> 1 199801010030 -1.21 0 7.4 4.6 0.72 1998-01-01 00:30:00 0.72 7.4 0
#> 2 199801010100 1.72 0 7.5 4.6 0.52 1998-01-01 01:00:00 0.52 7.5 0
#> 3 199801010130 NA 0 7.1 4.3 0.22 1998-01-01 01:30:00 0.22 7.1 0
#> 4 199801010200 NA 0 6.6 3.9 0.20 1998-01-01 02:00:00 0.20 6.6 0
#> 5 199801010230 2.55 0 6.6 3.9 0.33 1998-01-01 02:30:00 0.33 6.6 0
#> 6 199801010300 NA 0 6.5 4.0 0.15 1998-01-01 03:00:00 0.15 6.5 0
EProc <- sEddyProc$new("DE-Tha", ds_eproc)
#> New sEddyProc class for site 'DE-Tha'
head(EProc$sExportData())
#> DateTime NEE Rg Tair VPD Ustar
#> 1 1998-01-01 00:30:00 -1.21 0 7.4 4.6 0.72
#> 2 1998-01-01 01:00:00 1.72 0 7.5 4.6 0.52
#> 3 1998-01-01 01:30:00 NA 0 7.1 4.3 0.22
#> 4 1998-01-01 02:00:00 NA 0 6.6 3.9 0.20
#> 5 1998-01-01 02:30:00 2.55 0 6.6 3.9 0.33
#> 6 1998-01-01 03:00:00 NA 0 6.5 4.0 0.15
# Additional columns can be specified, e.g. factor column season
ds_eproc <- fLoadFluxnet15(fname,
additional_columns = readr::cols(season = readr::col_factor()))
head(ds_eproc)
#> TIMESTAMP_END NEE SW_IN TA VPD USTAR season DateTime Ustar Tair
#> 1 199801010030 -1.21 0 7.4 4.6 0.72 199801 1998-01-01 00:30:00 0.72 7.4
#> 2 199801010100 1.72 0 7.5 4.6 0.52 199801 1998-01-01 01:00:00 0.52 7.5
#> 3 199801010130 NA 0 7.1 4.3 0.22 199801 1998-01-01 01:30:00 0.22 7.1
#> 4 199801010200 NA 0 6.6 3.9 0.20 199801 1998-01-01 02:00:00 0.20 6.6
#> 5 199801010230 2.55 0 6.6 3.9 0.33 199801 1998-01-01 02:30:00 0.33 6.6
#> 6 199801010300 NA 0 6.5 4.0 0.15 199801 1998-01-01 03:00:00 0.15 6.5
#> Rg
#> 1 0
#> 2 0
#> 3 0
#> 4 0
#> 5 0
#> 6 0
EProc <- sEddyProc$new("DE-Tha", ds_eproc,
c("NEE", "Rg", "Tair", "VPD", "Ustar","season"),
ColNamesNonNumeric = "season"
)
#> New sEddyProc class for site 'DE-Tha'
head(EProc$sExportData())
#> DateTime NEE Rg Tair VPD Ustar season
#> 1 1998-01-01 00:30:00 -1.21 0 7.4 4.6 0.72 199801
#> 2 1998-01-01 01:00:00 1.72 0 7.5 4.6 0.52 199801
#> 3 1998-01-01 01:30:00 NA 0 7.1 4.3 0.22 199801
#> 4 1998-01-01 02:00:00 NA 0 6.6 3.9 0.20 199801
#> 5 1998-01-01 02:30:00 2.55 0 6.6 3.9 0.33 199801
#> 6 1998-01-01 03:00:00 NA 0 6.5 4.0 0.15 199801