Skip to content

Commit 66c0ce8

Browse files
authored
Merge branch 'refactor/i43-tidy-eval' into dev
2 parents 7c2b0e8 + f796b4e commit 66c0ce8

5 files changed

Lines changed: 21 additions & 39 deletions

File tree

DESCRIPTION

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ Authors@R:
2020
role = c("aut"),
2121
email = "Robert.Gamble@noaa.gov"),
2222
person(given = "Ryan",family = "Morse", role = c("aut"),
23-
email = "ryan.morse@noaa.gov",
24-
comment = c(ORCID = "YOUR-ORCID-ID")))
23+
email = "ryan.morse@noaa.gov"))
2524
Description: Atlantis diagnostics functions in this package are used to determine whether the model
2625
is meeting defined performance and review criteria. Processing functions are used to format the model output for
2726
plotting and diagnostic tests

R/helperfiles.r

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,8 @@ plot_sp <- function(data, col, wrap_col) {
4747
data[[col]],
4848
levels = agg_data[[1]][order(agg_data$sum_diet, decreasing = TRUE)]
4949
)
50-
plot <- ggplot2::ggplot(
51-
data,
52-
ggplot2::aes_(
53-
x = ~time,
54-
y = ~atoutput,
55-
fill = lazyeval::interp(~var, var = as.name(col))
56-
)
57-
) +
50+
plot <- ggplot2::ggplot(data) +
51+
ggplot2::aes(x = time, y = atoutput, fill = .data[[col]]) +
5852
ggplot2::geom_bar(stat = "identity") +
5953
ggplot2::scale_fill_manual(
6054
values = c(

R/load_nc_temp.R

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#'
33
#'@noRd
44

5-
load_nc_temp = function(
5+
load_nc_temp <- function(
66
nc,
77
fgs,
88
bps,
@@ -129,7 +129,8 @@ load_nc_temp = function(
129129
}
130130
at_data <- list()
131131
if (report) {
132-
pb <- dplyr::progress_estimated(length(search_clean))
132+
message("working on loading stuff in nc file")
133+
# pb <- dplyr::progress_estimated(length(search_clean))
133134
}
134135
for (i in seq_along(search_clean)) {
135136
at_data[[i]] <- RNetCDF::var.get.nc(
@@ -367,13 +368,8 @@ load_nc_temp = function(
367368
result <- result[!min_pools, ]
368369
}
369370
if (select_variable == "N" & any(final_agecl == 2)) {
370-
# old
371-
# result <- result %>%
372-
# dplyr::group_by_("species", "polygon","layer", "time") %>%
373-
# dplyr::summarise_(atoutput = ~sum(atoutput)) %>%
374-
# dplyr::ungroup()
375371
result <- result %>%
376-
dplyr::group_by_("species", "polygon", "layer", "time") %>%
372+
dplyr::group_by(species, polygon, layer, time) %>%
377373
dplyr::summarise(atoutput = sum(atoutput), .groups = "drop")
378374
}
379375
if (nrow(result) == 0) {

R/make_atlantis_diagnostic_figures.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,8 +1306,8 @@ make_atlantis_diagnostic_figures = function(
13061306
grobs[[i]] <- vector("list", length = 2)
13071307
}
13081308
for (i in seq_along(species)) {
1309-
df_pred <- dplyr::filter_(pred_comb, ~ pred == species[i])
1310-
df_prey <- dplyr::filter_(prey_comb, ~ prey == species[i])
1309+
df_pred <- dplyr::filter(pred_comb, pred == species[i])
1310+
df_prey <- dplyr::filter(prey_comb, prey == species[i])
13111311
grobs[[i]][[1]] <- plot_sp(df_pred, col = "prey", wrap_col = wrap_col)
13121312
grobs[[i]][[2]] <- plot_sp(df_prey, col = "pred", wrap_col = wrap_col)
13131313
}

R/process_atl_output.R

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ process_atl_output = function(
427427
sp.overlap = list()
428428
biomass.box.invert = list()
429429
length.age = list()
430-
430+
message("Reading in 'Nums', 'StructN', 'ResN', 'N'")
431431
if (large.file == F) {
432432
vars = list('Nums', 'StructN', 'ResN', 'N')
433433
group.types = list(groups.age, groups.age, groups.age, groups.bp)
@@ -979,6 +979,7 @@ process_atl_output = function(
979979
growth.rel.init = list()
980980
bio.consumed = list()
981981

982+
message("Reading in 'Eat', 'Grazing', 'Growth'")
982983
if (large.file == F) {
983984
vars = list('Eat', 'Grazing', 'Growth')
984985
group.types = list(groups.age, groups.bp, groups.age)
@@ -1014,28 +1015,20 @@ process_atl_output = function(
10141015
consumed_bio = data_eat %>%
10151016
dplyr::filter(species == pred.names[i]) %>%
10161017
dplyr::left_join(boxvol, by = c('polygon', 'time')) %>%
1017-
dplyr::mutate_(
1018-
.dots = stats::setNames(list(~ atoutput * vol), "atoutput")
1019-
) %>%
1020-
dplyr::mutate_(
1021-
.dots = stats::setNames(list(~ atoutput * bio.conv), "atoutput")
1022-
) %>%
1018+
dplyr::mutate(atoutput = atoutput * vol) %>%
1019+
dplyr::mutate(atoutput = atoutput * bio.conv) %>%
10231020
dplyr::full_join(
10241021
dplyr::filter(data.dietcheck, pred == pred.names[i]),
10251022
by = c(species = "pred", "time", "agecl")
10261023
) %>%
1027-
dplyr::filter_(~ time %in% ts_eat) %>%
1028-
dplyr::rename_(.dots = c(pred = "species"))
1024+
dplyr::filter(time %in% ts_eat) %>%
1025+
dplyr::rename(pred = species)
10291026
bio.consumed[[i]] = consumed_bio %>%
1030-
dplyr::filter_(~ !is.na(atoutput.x)) %>%
1031-
dplyr::filter_(~ !is.na(atoutput.y)) %>%
1032-
dplyr::mutate_(
1033-
.dots = stats::setNames(list(~ atoutput.x * atoutput.y), "atoutput")
1034-
) %>%
1035-
dplyr::select_(
1036-
.dots = names(.)[
1037-
!names(.) %in% c("atoutput.x", "vol", "atoutput.y")
1038-
]
1027+
dplyr::filter(!is.na(atoutput.x)) %>%
1028+
dplyr::filter(!is.na(atoutput.y)) %>%
1029+
dplyr::mutate(atoutput = atoutput.x * atoutput.y) %>%
1030+
dplyr::select(
1031+
!dplyr::any_of(c("atoutput.x", "vol", "atoutput.y"))
10391032
) %>%
10401033
dplyr::ungroup()
10411034

@@ -1203,7 +1196,7 @@ process_atl_output = function(
12031196
}
12041197

12051198
# Do catch -------------------------------------------------------------------
1206-
1199+
message("Reading Catch")
12071200
if (plot.catch | plot.spatial.catch | process.all | plot.all) {
12081201
catch = atlantistools::load_nc(
12091202
param.ls$catch,

0 commit comments

Comments
 (0)