Commit 1b108746 authored by LDalby's avatar LDalby
Browse files

Handle the output for another replicate of the goose numbers scenario

parent 53b96a42
...@@ -59,6 +59,7 @@ grd %>% ...@@ -59,6 +59,7 @@ grd %>%
drop_na() -> grd_id_polyref drop_na() -> grd_id_polyref
# Read results from scenario ---- # Read results from scenario ----
date_stamp <- "2018-12-29"
date_stamp <- "2018-11-12" date_stamp <- "2018-11-12"
current <- path_home("Desktop", "goose", date_stamp) current <- path_home("Desktop", "goose", date_stamp)
dir_ls(current, glob = "*.out") %>% dir_ls(current, glob = "*.out") %>%
...@@ -70,20 +71,24 @@ res_file <- glue("scenario_results_{jobs}_{date_stamp}.fst") ...@@ -70,20 +71,24 @@ res_file <- glue("scenario_results_{jobs}_{date_stamp}.fst")
path_desktop("Goose", date_stamp, jobs, res_file) %>% path_desktop("Goose", date_stamp, jobs, res_file) %>%
fst::read_fst() %>% fst::read_fst() %>%
as_tibble() -> goose_numbers as_tibble() -> goose_numbers
path_desktop("Goose", date_stamp, jobs, "scenario-grain-distributions.txt_1521869_2018-11-12.fst") %>% path_desktop("Goose", date_stamp, jobs, "scenario-grain-distributions.txt_1521869_2018-11-12.fst") %>%
# path_desktop("Goose", date_stamp, jobs, "scenario-grain-distributions.txt_2057427_2018-12-29.fst") %>%
fst::read_fst() %>% fst::read_fst() %>%
as_tibble() -> grain_dists as_tibble() -> grain_dists
grain_dists %>% group_by(param, value) %>% count(grain_dist) grain_dists %>% group_by(param, value) %>% count(grain_dist)
left_join(goose_numbers, grain_dists, by = c("param", "value", "season")) -> goose_numbers left_join(goose_numbers, grain_dists, by = c("param", "value", "season")) -> goose_numbers
goose_numbers %>%
mutate(replicate = 1L) -> goose_numbers
goose_numbers <- bind_rows(goose_numbers, goose_numbers_2)
# Summarize field forage data ---- # Summarize field forage data ----
# Mean numbers per day # Mean numbers per day
goose_numbers %>% goose_numbers %>%
mutate(day = day - 365*season) %>% mutate(day = day - 365*season) %>%
select(grain_dist, param, value, season, day, pinkfoot, barnacle, greylag) %>% select(replicate, grain_dist, param, value, season, day, pinkfoot, barnacle, greylag) %>%
group_by(grain_dist, param, value, season, day) %>% group_by(replicate, grain_dist, param, value, season, day) %>%
summarise_at(.vars = vars(pinkfoot, barnacle, greylag), summarise_at(.vars = vars(pinkfoot, barnacle, greylag),
.funs = funs(daily = sum)) %>% .funs = funs(daily = sum)) %>%
group_by(grain_dist, param, value, day) %>% group_by(grain_dist, param, value, day) %>%
...@@ -101,10 +106,11 @@ left_join(numbers_per_day, default, ...@@ -101,10 +106,11 @@ left_join(numbers_per_day, default,
suffix = c("", "_default")) %>% suffix = c("", "_default")) %>%
mutate(standarized = numbers/numbers_default) -> numbers_per_day mutate(standarized = numbers/numbers_default) -> numbers_per_day
goose_sp <- "pinkfoot_daily_avg"
goose_sp <- "greylag_daily_avg"
numbers_per_day %>% numbers_per_day %>%
filter(param == "GOOSE_BN_STARTNO_SCALER", filter(param == "GOOSE_BN_STARTNO_SCALER",
species == "pinkfoot_daily_avg") %>% species == goose_sp) %>%
ggplot(aes(day, standarized)) + ggplot(aes(day, standarized)) +
geom_line(aes(color = factor(value))) + geom_line(aes(color = factor(value))) +
scale_color_viridis_d(name = "Barnacle scaler") + scale_color_viridis_d(name = "Barnacle scaler") +
...@@ -116,14 +122,16 @@ numbers_per_day %>% ...@@ -116,14 +122,16 @@ numbers_per_day %>%
facet_grid(~grain_dist) facet_grid(~grain_dist)
goose_numbers %>% goose_numbers %>%
select(grain_dist, param, value, season, pinkfoot, barnacle, greylag) %>% select(replicate, grain_dist, param, value, season, pinkfoot, barnacle, greylag) %>%
group_by(grain_dist, param, value, season) %>% group_by(replicate, grain_dist, param, value, season) %>%
summarise(pinkfoot = sum(pinkfoot, na.rm = TRUE), summarise(pinkfoot = sum(pinkfoot, na.rm = TRUE),
barnacle = sum(barnacle, na.rm = TRUE), barnacle = sum(barnacle, na.rm = TRUE),
greylag = sum(greylag, na.rm = TRUE)) %>% greylag = sum(greylag, na.rm = TRUE)) %>%
ungroup() %>% group_by(grain_dist, param, value, season) %>%
summarise(pinkfoot = mean(pinkfoot, na.rm = TRUE),
barnacle = mean(barnacle, na.rm = TRUE),
greylag = mean(greylag, na.rm = TRUE)) %>%
gather(key = species, value = numbers, -grain_dist, -param, -value, -season) -> numbers_per_season gather(key = species, value = numbers, -grain_dist, -param, -value, -season) -> numbers_per_season
......
Supports Markdown
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