diff --git a/R/create_input_tables.R b/R/create_input_tables.R index a1ce968..796f35d 100644 --- a/R/create_input_tables.R +++ b/R/create_input_tables.R @@ -129,9 +129,26 @@ create_input_tables <- function(folder = ".", config_file, folder_out = folder, }else{ groups <- i } - + + file.to.write <- input_table[input_table$module == i, -1] + for(j in groups){ - write.csv(input_table[input_table$module == i, -1], + + if (any(names(lst_config[[i]]) == 'initial')){ + label <- i + key <- names(lst_config[[i]][['initial']]) + + for (p in key){ + idx <- which(file.to.write$subprocess == p) + file.to.write$value[idx] = as.numeric(lst_config[[i]][['initial']][p]) + + file.to.write$value <- as.double(file.to.write$value) + } + + } + + file.to.write$value <- as.double(file.to.write$value) + write.csv(file.to.write, paste0(folder_out, "/", j, ".csv"), row.names = FALSE) } diff --git a/inst/extdata/example_input_files/LakeEnsemblR_WQ.yaml b/inst/extdata/example_input_files/LakeEnsemblR_WQ.yaml index 89610df..df69ba6 100644 --- a/inst/extdata/example_input_files/LakeEnsemblR_WQ.yaml +++ b/inst/extdata/example_input_files/LakeEnsemblR_WQ.yaml @@ -14,7 +14,7 @@ config_files: PCLake: PCLake/parameters.txt run_settings: bio-shading: true - ode_method: Euler # Options: Euler, RK2, RK4, Pat1, PatRK2, PatRK4, ModPat1, ModPatRK2, ModPatRK4, ExtModPat1, ExtModPatRK2; default = Euler + ode_method: Euler # Options: Euler, RK2, RK4, Pat1, PatRK2, PatRK4, ModPat1, ModPatRK2, ModPatRK4, ExtModPat1, ExtModPatRK2; default = Euler split_factor: 1 bottom_everywhere: true repair_state: true @@ -23,6 +23,9 @@ input: oxygen: use: true par_file: oxygen.csv + initial: + initial_oxygen: 300 + piston_velocity: 5 carbon: use: true par_file: carbon.csv @@ -43,7 +46,7 @@ silicon: par_file: silicon.csv phytoplankton: use: true - groups: + groups: diatoms: par_file: diatoms.csv cyanobacteria: @@ -55,7 +58,7 @@ zooplankton: groups: zooplankton: par_file: zooplankton.csv -fish: +fish: use: false groups: benthivores: