Commit d173c69d authored by Lars Dalby's avatar Lars Dalby
Browse files

Merge branch '56-keep-the-numbers-probe-for-standardization' into 'master'

Resolve "keep the numbers probe for standardization"

Closes #56

See merge request LDalby/almass!35
parents 250c603f 642c2366
......@@ -45,3 +45,5 @@ Temporary Items
.Rhistory
**/Grendel/.Rproj.user
**/Grendel/.Rhistory
**/model_testing_report/GooseModelTesting.html
\ No newline at end of file
......@@ -5,7 +5,7 @@
#SBATCH --mem=240G
#SBATCH --ntasks-per-node=1
#SBATCH --cpus-per-task=4
#SBATCH --time=168:00:00
#SBATCH --time=06:00:00
#SBATCH --exclusive
#SBATCH --mem-per-cpu=60G
#SBATCH --mail-type=ALL
......
#!/bin/csh
#SBATCH --job-name=ALMaSS_goose_scenario_02
#SBATCH --partition=q28
#SBATCH --ntasks=1
#SBATCH --mem=240G
#SBATCH --ntasks-per-node=1
#SBATCH --cpus-per-task=8
#SBATCH --time=24:00:00
#SBATCH --exclusive
#SBATCH --mem-per-cpu=40G
#SBATCH --mail-type=ALL
#SBATCH --mail-user=lars@bios.au.dk
echo "========= Job started at `date` =========="
sh /home/ldalby/ALMaSS/almass/Grendel/start-scenario_02.sh
echo "========= Job finished at `date` =========="
#
\ No newline at end of file
......@@ -35,6 +35,14 @@ 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
numbers_file_name <- "scenario-goose-numbers.txt"
path(path_to_dirs, glue::glue("WD{suffix}"), "Results", numbers_file_name) %>%
future_map(data.table::fread) %>%
data.table::rbindlist() %>%
data.table::setnames(c("season", "day", "pf_families", "pf_non_breeders", "bn_families",
"bn_non_breeders", "gl_families", "gl_non_breeders", "snow_depth",
"param", "value")) -> all_numbers
dest_dir <- "/home/ldalby/workspace/Goose/Scenarios/Results/"
res_file_name <- glue::glue("{args}_scenario-results_{Sys.Date()}.fst")
......@@ -43,5 +51,8 @@ fst::write_fst(all_res, path = path(dest_dir, res_file_name))
grain_file_name <- glue::glue("{args}_scenario-grain-distributions_{Sys.Date()}.fst")
fst::write_fst(all_grain, path = path(dest_dir, grain_file_name))
numbers_file_name <- glue::glue("{args}_scenario-goose-numbers_{Sys.Date()}.fst")
fst::write_fst(all_numbers, path = path(dest_dir, numbers_file_name))
vers_path <- path("/scratch", args, "WD01", "almass-version.txt")
file_copy(vers_path, path(dest_dir, glue::glue("{args}_almass-version.txt")))
# Collect results from maize availability scenario
# Author: Lars Dalby
# Date: 4 Jan 2019
# Short script to combine the results form mulitple runs into one file and
# write that to a safe place on Grendel.
# Set the local R package library (if not done already)
if (!"/home/ldalby/R/packages" %in% .libPaths()) {
.libPaths("/home/ldalby/R/packages")
}
suppressMessages(library(furrr))
library(fs)
library(magrittr)
# Get the slurm job-id (is being passed in from the shell script calling this R script)
args <- commandArgs(trailingOnly = TRUE)
# The parent directory of all the work directories
path_to_dirs <- path("/scratch", args)
file_name <- "scenario-results.txt"
npar = 8 # Specifies the number of run directories that was being used
plan(multiprocess) # to run in parallel future_map in parallel.
suffix <- stringr::str_pad(as.character(1:npar), width = 2, pad = "0")
path(path_to_dirs, glue::glue("WD{suffix}"), "Results", file_name) %>%
future_map(data.table::fread) %>%
data.table::rbindlist() %>%
data.table::setnames(c("season", "day", "pinkfoot", "pinkfoot_dist",
"barnacle", "barnacle_dist", "greylag", "greylag_dist",
"grain", "maize", "polyref", "param", "value")) -> all_res
grain_file_name <- "scenario-grain-distributions.txt"
path(path_to_dirs, glue::glue("WD{suffix}"), "Results", grain_file_name) %>%
future_map(data.table::fread) %>%
data.table::rbindlist() %>%
data.table::setnames(c("season", "grain_dist", "param", "value")) -> all_grain
numbers_file_name <- "scenario-goose-numbers.txt"
path(path_to_dirs, glue::glue("WD{suffix}"), "Results", numbers_file_name) %>%
future_map(data.table::fread) %>%
data.table::rbindlist() %>%
data.table::setnames(c("season", "day", "pf_families", "pf_non_breeders", "bn_families",
"bn_non_breeders", "gl_families", "gl_non_breeders", "snow_depth",
"param", "value")) -> all_numbers
dest_dir <- "/home/ldalby/workspace/Goose/Scenarios/Results/"
res_file_name <- glue::glue("{args}_maize-availability-results_{Sys.Date()}.fst")
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))
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))
vers_path <- path("/scratch", args, "WD01", "almass-version.txt")
file_copy(vers_path, path(dest_dir, glue::glue("{args}_almass-version.txt")))
......@@ -41,7 +41,7 @@ walk2(.x = summarized_remote, .y = path(current, jobs), scp_download, session =
ti <- "/home/ldalby/workspace/Goose/RunDirectory/TIALMaSSConfig.cfg"
cmd_line <- "/home/ldalby/workspace/Goose/RunDirectory/almass_cmdline"
almass_version <- path(res_path_remote, "almass-version.txt")
almass_version <- path(res_path_remote, glue("{jobs}_almass-version.txt"))
# TIALMaSS.cfg and almass_cmd
scp_download(session, ti, to = current)
scp_download(session, cmd_line, to = current)
......
1
0
0
100
SpringBarleyCloverGrass
CloverGrassGrazed1
CloverGrassGrazed2
SpringBarleyCloverGrass
SeedGrass1
SpringBarley
WinterWheat
MaizeSilage
SpringBarleyCloverGrass
CloverGrassGrazed1
CloverGrassGrazed2
SpringBarleyCloverGrass
CloverGrassGrazed1
CloverGrassGrazed2
MaizeSilage
SpringBarleyCloverGrass
CloverGrassGrazed1
CloverGrassGrazed2
WinterWheat
WinterRye
SpringBarleyCloverGrass
CloverGrassGrazed1
CloverGrassGrazed2
SpringBarleyCloverGrass
CloverGrassGrazed1
CloverGrassGrazed2
MaizeSilage
SpringBarley
WinterWheat
MaizeSilage
SpringBarley
WinterWheat
MaizeSilage
SpringBarley
WinterWheat
WinterBarley
WinterRape
MaizeSilage
SpringBarley
Oats
WinterWheat
MaizeSilage
SpringBarleyCloverGrass
CloverGrassGrazed1
CloverGrassGrazed2
SpringBarleyCloverGrass
CloverGrassGrazed1
CloverGrassGrazed2
MaizeSilage
SpringBarleyCloverGrass
CloverGrassGrazed1
CloverGrassGrazed2
SpringBarleySilage
SpringBarleyCloverGrass
CloverGrassGrazed1
CloverGrassGrazed2
WinterWheat
SpringBarleyCloverGrass
CloverGrassGrazed1
CloverGrassGrazed2
MaizeSilage
SpringBarleyCloverGrass
CloverGrassGrazed1
CloverGrassGrazed2
MaizeSilage
SpringBarleyCloverGrass
CloverGrassGrazed1
CloverGrassGrazed2
SpringBarleySilage
SpringBarleyCloverGrass
CloverGrassGrazed1
CloverGrassGrazed2
WinterWheat
MaizeSilage
SpringBarleyCloverGrass
CloverGrassGrazed1
CloverGrassGrazed2
MaizeSilage
SpringBarleyCloverGrass
CloverGrassGrazed1
CloverGrassGrazed2
SpringBarleySilage
MaizeSilage
SpringBarleyCloverGrass
CloverGrassGrazed1
CloverGrassGrazed2
MaizeSilage
SpringBarleySilage
WinterBarley
WinterRape
MaizeSilage
SpringBarleySilage
WinterWheat
WinterRye
SpringBarleySilage
MaizeSilage
SpringBarleyCloverGrass
CloverGrassGrazed1
CloverGrassGrazed2
CloverGrassGrazed2
1
0
0
100
MaizeSilage
CloverGrassGrazed1
CloverGrassGrazed2
SpringBarleyCloverGrass
SeedGrass1
SpringBarley
WinterWheat
MaizeSilage
SpringBarleyCloverGrass
MaizeSilage
CloverGrassGrazed2
MaizeSilage
CloverGrassGrazed1
MaizeSilage
MaizeSilage
SpringBarleyCloverGrass
CloverGrassGrazed1
CloverGrassGrazed2
WinterWheat
WinterRye
SpringBarleyCloverGrass
MaizeSilage
CloverGrassGrazed2
SpringBarleyCloverGrass
CloverGrassGrazed1
MaizeSilage
MaizeSilage
SpringBarley
WinterWheat
MaizeSilage
SpringBarley
WinterWheat
MaizeSilage
SpringBarley
WinterWheat
WinterBarley
WinterRape
MaizeSilage
SpringBarley
Oats
WinterWheat
MaizeSilage
SpringBarleyCloverGrass
CloverGrassGrazed1
CloverGrassGrazed2
SpringBarleyCloverGrass
CloverGrassGrazed1
CloverGrassGrazed2
MaizeSilage
MaizeSilage
CloverGrassGrazed1
MaizeSilage
SpringBarleySilage
SpringBarleyCloverGrass
CloverGrassGrazed1
CloverGrassGrazed2
WinterWheat
SpringBarleyCloverGrass
MaizeSilage
CloverGrassGrazed2
MaizeSilage
MaizeSilage
CloverGrassGrazed1
MaizeSilage
MaizeSilage
SpringBarleyCloverGrass
CloverGrassGrazed1
CloverGrassGrazed2
SpringBarleySilage
SpringBarleyCloverGrass
MaizeSilage
CloverGrassGrazed2
WinterWheat
MaizeSilage
MaizeSilage
CloverGrassGrazed1
MaizeSilage
MaizeSilage
SpringBarleyCloverGrass
CloverGrassGrazed1
CloverGrassGrazed2
SpringBarleySilage
MaizeSilage
SpringBarleyCloverGrass
MaizeSilage
CloverGrassGrazed2
MaizeSilage
SpringBarleySilage
WinterBarley
WinterRape
MaizeSilage
SpringBarleySilage
WinterWheat
WinterRye
SpringBarleySilage
MaizeSilage
SpringBarleyCloverGrass
CloverGrassGrazed1
MaizeSilage
CloverGrassGrazed2
1
0
0
100
MaizeSilage
CloverGrassGrazed1
CloverGrassGrazed2
MaizeSilage
SeedGrass1
SpringBarley
WinterWheat
MaizeSilage
SpringBarleyCloverGrass
MaizeSilage
CloverGrassGrazed2
MaizeSilage
MaizeSilage
MaizeSilage
MaizeSilage
MaizeSilage
CloverGrassGrazed1
MaizeSilage
WinterWheat
WinterRye
SpringBarleyCloverGrass
MaizeSilage
CloverGrassGrazed2
SpringBarleyCloverGrass
MaizeSilage
MaizeSilage
MaizeSilage
SpringBarley
WinterWheat
MaizeSilage
SpringBarley
WinterWheat
MaizeSilage
SpringBarley
WinterWheat
WinterBarley
WinterRape
MaizeSilage
SpringBarley
Oats
WinterWheat
MaizeSilage
MaizeSilage
CloverGrassGrazed1
MaizeSilage
SpringBarleyCloverGrass
MaizeSilage
CloverGrassGrazed2
MaizeSilage
MaizeSilage
MaizeSilage
MaizeSilage
SpringBarleySilage
MaizeSilage
CloverGrassGrazed1
MaizeSilage
WinterWheat
SpringBarleyCloverGrass
MaizeSilage
CloverGrassGrazed2
MaizeSilage
MaizeSilage
MaizeSilage
MaizeSilage
MaizeSilage
MaizeSilage
CloverGrassGrazed1
MaizeSilage
SpringBarleySilage
SpringBarleyCloverGrass
MaizeSilage
CloverGrassGrazed2
WinterWheat
MaizeSilage
MaizeSilage
MaizeSilage
CloverGrassGrazed2
MaizeSilage
MaizeSilage
CloverGrassGrazed1
MaizeSilage
SpringBarleySilage
MaizeSilage
SpringBarleyCloverGrass
CloverGrassGrazed1
CloverGrassGrazed2
MaizeSilage
SpringBarleySilage
WinterBarley
WinterRape
MaizeSilage
SpringBarleySilage
WinterWheat
WinterRye
SpringBarleySilage
MaizeSilage
SpringBarleyCloverGrass
MaizeSilage
MaizeSilage
CloverGrassGrazed2
1
0
0
100
SpringBarleyCloverGrass
MaizeSilage
MaizeSilage
MaizeSilage
SeedGrass1
SpringBarley
WinterWheat
MaizeSilage
MaizeSilage
CloverGrassGrazed1
MaizeSilage
MaizeSilage
MaizeSilage
MaizeSilage
MaizeSilage
MaizeSilage
MaizeSilage
CloverGrassGrazed2
WinterWheat
WinterRye
MaizeSilage
MaizeSilage
MaizeSilage
MaizeSilage
MaizeSilage
MaizeSilage
MaizeSilage
SpringBarley
WinterWheat
MaizeSilage
SpringBarley
WinterWheat
MaizeSilage
SpringBarley
WinterWheat
WinterBarley
WinterRape
MaizeSilage
SpringBarley
Oats
WinterWheat
MaizeSilage
MaizeSilage
MaizeSilage
CloverGrassGrazed2
MaizeSilage
MaizeSilage
MaizeSilage
MaizeSilage
MaizeSilage
MaizeSilage
MaizeSilage
SpringBarleySilage
MaizeSilage
MaizeSilage
MaizeSilage
WinterWheat
MaizeSilage
CloverGrassGrazed1
MaizeSilage
MaizeSilage
MaizeSilage
MaizeSilage
MaizeSilage
MaizeSilage
MaizeSilage
MaizeSilage
MaizeSilage
SpringBarleySilage
MaizeSilage
MaizeSilage
MaizeSilage
WinterWheat
MaizeSilage
MaizeSilage
MaizeSilage
MaizeSilage
MaizeSilage
SpringBarleyCloverGrass
MaizeSilage
MaizeSilage
SpringBarleySilage
MaizeSilage
MaizeSilage
CloverGrassGrazed1
MaizeSilage
MaizeSilage
SpringBarleySilage
WinterBarley
WinterRape
MaizeSilage
SpringBarleySilage
WinterWheat
WinterRye
SpringBarleySilage
MaizeSilage
MaizeSilage
MaizeSilage
CloverGrassGrazed2
MaizeSilage
......@@ -65,6 +65,11 @@ if(file_exists("GooseFieldForageData.txt"))
if(file_exists("GooseGrainDist.txt")) {
read_tsv("GooseGrainDist.txt", col_types = "ic") -> grain_dist
}
if(file_exists("GoosePopulationData.txt")) {
read_tsv("GoosePopulationData.txt",
col_types = "iiiiiiiid") -> goose_numbers
}
# Write ----
index <- lineno[counter]
......@@ -81,6 +86,10 @@ if(file_exists("GooseFieldForageData.txt"))
mutate(param = param[i],
value = value[i]) %>%
write_tsv(path = path(resultpath, "scenario-grain-distributions.txt"), append = TRUE)
goose_numbers %>%
mutate(param = param[i],
value = value[i]) %>%
write_tsv(path = path(resultpath, "scenario-goose-numbers.txt"), append = TRUE)
}
# As the last thing we delete the goose output files
......
......@@ -22,7 +22,7 @@ basedir <- "/home/ldalby/workspace/Goose/RunDirectory"
pathtodirs <- path('/scratch', args)
# Setup the directories
npar <- 4 # Specifies the number of run directories
years <- 100 # 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) {
......
#!/usr/local/bin/r
# Copy run directories and setup parameters
# Author: Lars Dalby
# Set the local R package library (if not done already)
if(!"/home/ldalby/R/packages" %in% .libPaths()) {
.libPaths("/home/ldalby/R/packages")
}
suppressWarnings(library(ralmass))
suppressMessages(library(tidyverse))
library(fs)
# Get the slurm job-id (is being passed in from the shell script calling this R script)
args <- commandArgs(trailingOnly = TRUE)
# Make sure we don"t write any e"s in extreme numbers.
options(scipen = 99)
# The base directory with all input files except ParameterValues.txt (ParameterValues.txt file is written further down):
basedir <- "/home/ldalby/workspace/Goose/RunDirectory"
# The parent directory of all the work directories
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)
basename <- "WD" # The prefix to the directories
# Make the directories and copy the files:
for (i in 1:npar) {
index <- stringr::str_pad(as.character(1:npar), width = 2, pad = "0")
dir_create(path(pathtodirs, paste0(basename,index[i])))
file_copy(path = path(basedir, dir(basedir)),
new_path = path(pathtodirs, paste0(basename,index[i])),
overwrite = TRUE)
}
dirs <- dir(pathtodirs)