Commit 08eff535 authored by LDalby's avatar LDalby
Browse files

test rotation file info mechanics

parent 502ea5d4
......@@ -47,4 +47,5 @@ Temporary Items
**/Grendel/.Rhistory
**/model_testing_report/GooseModelTesting.html
**/Grendel/scenarios/numbers_report.html
\ No newline at end of file
**/Grendel/scenarios/numbers_report.html
**/Grendel/param_fit_report/param-fit-goose.html
\ No newline at end of file
......@@ -35,6 +35,12 @@ path(path_to_dirs, glue::glue("WD{suffix}"), "Results", grain_file_name) %>%
data.table::rbindlist() %>%
data.table::setnames(c("season", "grain_dist", "param", "value")) -> all_grain
rotation_file_name <- "scenario-rotations.txt"
path(path_to_dirs, glue::glue("WD{suffix}"), "Results", rotation_file_name) %>%
future_map(data.table::fread) %>%
data.table::rbindlist() %>%
data.table::setnames(c("wd", "rotation")) -> all_rotation
numbers_file_name <- "scenario-goose-numbers.txt"
path(path_to_dirs, glue::glue("WD{suffix}"), "Results", numbers_file_name) %>%
future_map(data.table::fread) %>%
......@@ -51,6 +57,9 @@ fst::write_fst(all_res, path = path(dest_dir, res_file_name))
grain_file_name <- glue::glue("{args}_maize-availability-grain-distributions_{Sys.Date()}.fst")
fst::write_fst(all_grain, path = path(dest_dir, grain_file_name))
rotation_file_name <- glue::glue("{args}_maize-availability-rotations_{Sys.Date()}.fst")
fst::write_fst(all_rotation, path = path(dest_dir, rotation_file_name))
numbers_file_name <- glue::glue("{args}_maize-availability-goose-numbers_{Sys.Date()}.fst")
fst::write_fst(all_numbers, path = path(dest_dir, numbers_file_name))
......
......@@ -14,7 +14,7 @@ output:
editor_options:
chunk_output_type: console
params:
date_stamp: "2018-08-22"
date_stamp: "2019-01-23"
---
```{r setup, include=FALSE}
......
......@@ -22,7 +22,7 @@ basedir <- "/home/ldalby/workspace/Goose/RunDirectory"
pathtodirs <- path("/scratch", args)
# Setup the directories
npar <- 8 # Specifies the number of run directories
years <- 10 # the number of seasons to run (goose sims run over the year boundary)
years <- 3 # the number of seasons to run (goose sims run over the year boundary)
basename <- "WD" # The prefix to the directories
# Make the directories and copy the files:
for (i in 1:npar) {
......@@ -44,7 +44,7 @@ for (i in seq_along(dirs)) {
cfg <- readLines("/home/ldalby/workspace/Goose/RunDirectory/TIALMaSSConfig.cfg")
# Distribute the different parameters ----
nsteps <- 10 # the number of intervals to split the parameter in
nsteps <- 3 # the number of intervals to split the parameter in
replace_rotation <- function(new_rot, old_rot, wd_path) {
rot_paths <- "/home/ldalby/ALMaSS/almass/Grendel/rotations/"
......@@ -53,73 +53,107 @@ replace_rotation <- function(new_rot, old_rot, wd_path) {
new_path = path(wd_path, old_rot),
overwrite = TRUE)
}
write_rot_info <- function(dir, rot, wdpath) {
tribble(
~WD, ~maize_rot,
dir, rot) %>%
write_tsv(path = path(wdpath, "rot-file-info.tsv"))
}
old_rot <- "UserDefinedFarm19.rot"
# Startno scaler - standard maize ----
wdpath <- path(pathtodirs, dirs[1])
current_dir <- dirs[1]
wdpath <- path(pathtodirs, current_dir)
new_rot <- "UserDefinedFarm19.rot"
seq(1, 10, length.out = nsteps) %>%
round() %>%
GenerateParams("GOOSE_STARTNO_SCALER" = ., write = TRUE, path = wdpath)
write_rot_info(current_dir, new_rot, wdpath)
# Startno scaler - maize rotation 191 ----
wdpath <- path(pathtodirs, dirs[2])
current_dir <- dirs[2]
wdpath <- path(pathtodirs, current_dir)
new_rot <- "UserDefinedFarm191.rot"
seq(1, 10, length.out = nsteps) %>%
round() %>%
GenerateParams("GOOSE_STARTNO_SCALER" = ., write = TRUE, path = wdpath)
replace_rotation(new_rot = "UserDefinedFarm191.rot",
replace_rotation(new_rot = new_rot,
old_rot = old_rot,
wd_path = wdpath)
write_rot_info(current_dir, new_rot, wdpath)
# Startno scaler - maize rotation 192 ----
wdpath <- path(pathtodirs, dirs[3])
current_dir <- dirs[3]
wdpath <- path(pathtodirs, current_dir)
new_rot <- "UserDefinedFarm192.rot"
seq(1, 10, length.out = nsteps) %>%
round() %>%
GenerateParams("GOOSE_STARTNO_SCALER" = ., write = TRUE, path = wdpath)
replace_rotation(new_rot = "UserDefinedFarm192.rot",
replace_rotation(new_rot = new_rot,
old_rot = old_rot,
wd_path = wdpath)
write_rot_info(current_dir, new_rot, wdpath)
# Startno scaler - maize rotation 193 ----
wdpath <- path(pathtodirs, dirs[4])
current_dir <- dirs[4]
wdpath <- path(pathtodirs, current_dir)
new_rot <- "UserDefinedFarm193.rot"
seq(1, 10, length.out = nsteps) %>%
round() %>%
GenerateParams("GOOSE_STARTNO_SCALER" = ., write = TRUE, path = wdpath)
replace_rotation(new_rot = "UserDefinedFarm193.rot",
replace_rotation(new_rot = new_rot,
old_rot = old_rot,
wd_path = wdpath)
write_rot_info(current_dir, new_rot, wdpath)
# Startno scaler - standard maize ----
wdpath <- path(pathtodirs, dirs[5])
current_dir <- dirs[5]
wdpath <- path(pathtodirs, current_dir)
new_rot <- "UserDefinedFarm19.rot"
seq(1, 10, length.out = nsteps) %>%
round() %>%
GenerateParams("GOOSE_BN_STARTNO_SCALER" = ., write = TRUE, path = wdpath)
write_rot_info(current_dir, new_rot, wdpath)
# BN Startno scaler - maize rotation 191 ----
wdpath <- path(pathtodirs, dirs[6])
current_dir <- dirs[6]
wdpath <- path(pathtodirs, current_dir)
new_rot <- "UserDefinedFarm191.rot"
seq(1, 10, length.out = nsteps) %>%
round() %>%
GenerateParams("GOOSE_BN_STARTNO_SCALER" = ., write = TRUE, path = wdpath)
replace_rotation(new_rot = "UserDefinedFarm191.rot",
replace_rotation(new_rot = new_rot,
old_rot = old_rot,
wd_path = wdpath)
write_rot_info(current_dir, new_rot, wdpath)
# BN Startno scaler - maize rotation 192 ----
wdpath <- path(pathtodirs, dirs[7])
current_dir <- dirs[7]
wdpath <- path(pathtodirs, current_dir)
new_rot <- "UserDefinedFarm192.rot"
seq(1, 10, length.out = nsteps) %>%
round() %>%
GenerateParams("GOOSE_BN_STARTNO_SCALER" = ., write = TRUE, path = wdpath)
replace_rotation(new_rot = "UserDefinedFarm192.rot",
replace_rotation(new_rot = new_rot,
old_rot = old_rot,
wd_path = wdpath)
write_rot_info(current_dir, new_rot, wdpath)
# BN Startno scaler - maize rotation 193 ----
wdpath <- path(pathtodirs, dirs[8])
current_dir <- dirs[8]
wdpath <- path(pathtodirs, current_dir)
new_rot <- "UserDefinedFarm193.rot"
seq(1, 10, length.out = nsteps) %>%
round() %>%
GenerateParams("GOOSE_BN_STARTNO_SCALER" = ., write = TRUE, path = wdpath)
replace_rotation(new_rot = "UserDefinedFarm193.rot",
replace_rotation(new_rot = new_rot,
old_rot = old_rot,
wd_path = wdpath)
write_rot_info(current_dir, new_rot, wdpath)
# Edit the bat, ini and cfg files to match the parameters set above:
for (i in seq_along(dirs)) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment