devtools::load_all(".") library(rsofun) library(dplyr) library(readr) library(lubridate) library(ggplot2)
usesite <- "CH-Lae" getvars <- c( "GPP_NT_VUT_REF", "GPP_DT_VUT_REF", "LE_F_MDS", "LE_F_MDS_QC", "NEE_VUT_REF", "NEE_VUT_REF_QC", "TA_F", "VPD_F", "P_F", "SW_IN_F", "NETRAD" ) df_fluxnet <- get_obs_bysite_fluxnet2015( sitename=usesite, path_fluxnet2015 ="~/data/FLUXNET-2015_Tier1/20191024/HH/", timescale="hh", getvars=getvars, threshold_GPP = 0, # take only measured data getswc = TRUE ) %>% mutate(sitename = usesite) %>% ## use daytime data only dplyr::filter(ppfd > 0.0) %>% ## use growing season of CH-Lae only dplyr::filter(yday(date)>121 & yday(date)<121+161) %>% ## additional cleaning (only positive VPD) dplyr::filter(vpd>0)
Prepare training data, removing NAs and outliers.
# ## use all observational soil moisture data # varnams_soilm <- df_fluxnet %>% # dplyr::select( starts_with("SWC_") ) %>% # dplyr::select( -ends_with("QC") ) %>% # names() ## define settings used by multiple functions as a list settings <- list( target = "NEE_VUT_REF", predictors = c("temp","vpd", "ppfd"), varnams_soilm = "wcont_splash", nneurons_good = 10, nneurons_all = 10, nrep = 3, package = "nnet" ) df_train <- prepare_trainingdata_fvar( df_fluxnet, settings )
fvar
Train models for one set of soil moisture input data. In this case it's observational data.
df_nn_soilm_obs <- train_predict_fvar( df_train, settings, soilm_threshold = 0.6, weights = NA, verbose = TRUE )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.