Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create initial values to fill WQ_input.csv's #36

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions R/create_input_tables.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
9 changes: 6 additions & 3 deletions inst/extdata/example_input_files/LakeEnsemblR_WQ.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -43,7 +46,7 @@ silicon:
par_file: silicon.csv
phytoplankton:
use: true
groups:
groups:
diatoms:
par_file: diatoms.csv
cyanobacteria:
Expand All @@ -55,7 +58,7 @@ zooplankton:
groups:
zooplankton:
par_file: zooplankton.csv
fish:
fish:
use: false
groups:
benthivores:
Expand Down