Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
cf5df8d
docs(dietcheck): added missing Updated column in example file
andybeet May 15, 2026
230dd88
docs(SETAS dietcheck): update URL for pkgdown
andybeet May 16, 2026
a49e5e0
chore(SETAS dietcheck): updated pkgdown badge to readme
andybeet May 16, 2026
6641060
Merge pull request #54 from Atlantis-Ecosystem-Model/chore/i52-setas-…
andybeet May 16, 2026
7ac47f6
docs(pkgdown update): add bootstrap 5 + authors
andybeet May 16, 2026
0c781bc
docs(pkgdown update): remove cran install instructions and update wit…
andybeet May 16, 2026
19f3b60
docs(pkgdown updates) : badges start and end for better display on we…
andybeet May 16, 2026
114ecc8
Merge pull request #56 from Atlantis-Ecosystem-Model/docs/i47-pkgdwon…
andybeet May 16, 2026
0865db3
fix(load_dietcheck examples): can not run some examples from dev vers…
andybeet May 16, 2026
b687098
chore(load_dietcheck example): remove toml from build
andybeet May 16, 2026
25a8b78
docs(load_dietcheck examples): update docs without problematic examples
andybeet May 16, 2026
0f42958
Merge pull request #59 from Atlantis-Ecosystem-Model/fix/i57-load-die…
andybeet May 16, 2026
a30be61
fix(Description dependencies): native pipe requires R 4.1
andybeet May 16, 2026
391e50f
refactor(description dependencies): commented text referencing unused…
andybeet May 16, 2026
e931560
chore(description dependencies): fix typo to correctly exclude toml f…
andybeet May 16, 2026
f91ffe3
Merge pull request #61 from Atlantis-Ecosystem-Model/fix/i58-Descript…
andybeet May 16, 2026
c6af1a7
feature(fishbase removal): moved files from package to data-raw for p…
andybeet May 18, 2026
27a7c97
docs(fishbase removal): deletion of Rd files
andybeet May 18, 2026
9b2d9e9
docs(fishbase removal): remove fishbase data doc from the global data…
andybeet May 18, 2026
df980e9
docs(fishbase removal): make magrittr an internal function
andybeet May 18, 2026
c307f34
docs(fishbase removal): remove functions from pkgdown and namespace
andybeet May 18, 2026
806d0f5
docs(fishbase removal): add magrittr to vignettes since it is no long…
andybeet May 18, 2026
f995d50
tests(fishbase removal): unit test no longer needed
andybeet May 18, 2026
9c1fb8a
Merge pull request #63 from Atlantis-Ecosystem-Model/feature/i5-fishb…
andybeet May 18, 2026
d38ed4d
docs(remove bec_dev): remove all function examples and associated rds…
andybeet May 18, 2026
f966c76
feature(remove bec_dev): remove plot function and rd
andybeet May 18, 2026
850902a
chore(remove bec_dev): remove deleted function from pkgdown
andybeet May 18, 2026
0cbbcbd
chore(remove bec_dev): update namespace base on deleted function
andybeet May 18, 2026
eddb281
tests(remove bec_dev): removed unit tests based on bec_dev functions/…
andybeet May 18, 2026
9c2e98a
tests(remove bec_dev): removed unit test focussed on visual plots
andybeet May 18, 2026
a24efc0
docs(remove bec_dev): removes all references in rmds using sample set…
andybeet May 18, 2026
8154a62
feature(remove bec_dev): remove ALL example dev model setas output
andybeet May 18, 2026
aaf1d2d
Merge pull request #65 from Atlantis-Ecosystem-Model/feature/i60-remo…
andybeet May 18, 2026
21ccfe6
tests(unit-test fixes): included a tolerance of 1e-3 for equality tes…
andybeet May 18, 2026
2a054a6
docs(remove cran): remove cran badge and installation instructions si…
andybeet May 19, 2026
1bf535d
tests(remove CRAN): prevent Cran related content in testing
andybeet May 19, 2026
0147562
docs(remove cran): redundant content removed
andybeet May 19, 2026
0cffc79
Merge pull request #68 from Atlantis-Ecosystem-Model/docs/i67-remove-…
andybeet May 19, 2026
20449e7
docs(remove authors): removed authors of individual functions and vig…
andybeet May 19, 2026
5c31351
docs(remove authors): remove authors from specific functions
andybeet May 19, 2026
d0e47eb
Merge pull request #69 from Atlantis-Ecosystem-Model/docs/i62-author-…
andybeet May 19, 2026
7ae0141
Merge pull request #70 from Atlantis-Ecosystem-Model/dev
andybeet May 19, 2026
bc65486
Merge branch 'tests/i66-unit-test-fixes' of https://github.com/Atlant…
andybeet May 19, 2026
109eb0a
tests(unit test- random): moved code inside the test_that function to…
andybeet May 19, 2026
b2826c7
tests(unit test- sc-init): commented all code since there was no exis…
andybeet May 19, 2026
c5aaab3
tests(unit test- sc-overlap): moved code inside the test_that functio…
andybeet May 19, 2026
43ae4a5
refactor(unit tests): package:: reeference to functins that create sa…
andybeet May 20, 2026
4f029ac
tests(unit tests): move contnent inside of tet that function to preve…
andybeet May 20, 2026
9f3a8e7
tests(unit tests): tests not passing many years ago. not sure why. ne…
andybeet May 20, 2026
3ca94f0
tests(unit tests load-dietcheck): removed test with unused flag
andybeet May 20, 2026
e5c3e58
docs(load_nc_physics): failed test was missing variable declaration
andybeet May 20, 2026
646bc81
fix(load-txt): old evaluation of string column names updated to use t…
andybeet May 20, 2026
1046dc6
Merge pull request #71 from Atlantis-Ecosystem-Model/tests/i66-unit-t…
andybeet May 20, 2026
f5bf7ec
feature(version_flag removal): meaningless flag removed from package:…
andybeet May 20, 2026
33b945f
Merge pull request #72 from Atlantis-Ecosystem-Model/feature/i64-vers…
andybeet May 20, 2026
24d4e05
feature!(native pipe): moved old pipe to data-raw (magritrr)
andybeet May 21, 2026
c6f3713
refactor(native pipe): change from magrittr to native with some minor…
andybeet May 21, 2026
1528303
chore(native pipe): remove magrittr from namespace, and DESCRIPTION
andybeet May 21, 2026
295e3db
Merge pull request #74 from Atlantis-Ecosystem-Model/feature/i51-use-…
andybeet May 21, 2026
08271fb
chore(release): files ready for next release
andybeet May 21, 2026
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
2 changes: 1 addition & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
NEWS\.Rmd
^data-raw$
^appveyor\.yml$
^cran-comments\.md$
^revdep$
^_pkgdown\.yml$
^docs$
^pkgdown$
^\.github$
air.toml
19 changes: 7 additions & 12 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,47 +1,42 @@
Package: atlantistools
Type: Package
Title: Process and Visualise Output from Atlantis Models
Version: 0.5.1
Version: 1.0.0
Authors@R:
c(person("Alexander", "Keth", email = "alexander.keth@uni-hamburg.de", role = c("aut")),
person("Andy", "Beet", email = "andrew.beet@noaa.gov", role = c("cre")))
person("Andy", "Beet", email = "andrew.beet@noaa.gov", role = c("cre","aut"),
comment = c(ORCID = "0000-0001-8270-7090")))
Description: Atlantis is an end-to-end marine ecosystem modelling framework. It was originally developed in Australia by E.A. Fulton, A.D.M. Smith and D.C. Smith (2007) and has since been adopted in many marine ecosystems around the world (<http://atlantis.cmar.csiro.au>). The output of an Atlantis simulation is stored in various file formats like .netcdf and .txt and different output structures are used for the output variables like e.g. productivity or biomass. This package is used to convert the different output types to a unified format according to the "tidy-data" approach by H. Wickham (2014) <DOI:10.18637/jss.v059.i10>. Additionally, ecological metrics like for example spatial overlap of predator and prey or consumption can be calculated and visualised with this package. Due to the unified data structure it is very easy to share model output with each other and perform model comparisons.
URL: https://github.com/Atlantis-Ecosystem-Model/atlantistools
URL: https://github.com/Atlantis-Ecosystem-Model/atlantistools, https://andybeet.github.io/atlantistools/
BugReports: https://github.com/Atlantis-Ecosystem-Model/atlantistools/issues
Depends:
R (>= 4.0)
R (>= 4.1)
License: GPL-3
LazyData: true
Encoding: UTF-8
RoxygenNote: 7.3.3
Suggests:
knitr,
rfishbase,
rmarkdown,
testthat,
vdiffr
testthat
Imports:
circlize,
curl,
devtools,
dplyr,
ggplot2,
graphics,
grDevices,
grid,
gridExtra,
lazyeval,
magrittr,
proj4,
purrr,
RColorBrewer,
RNetCDF,
rlang,
rvest,
scales,
stringi,
stringr,
tibble,
tidyr,
xml2
tidyr
VignetteBuilder: knitr
10 changes: 0 additions & 10 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Generated by roxygen2: do not edit by hand

export("%>%")
export(agg_data)
export(agg_perc)
export(calculate_biomass_spatial)
Expand Down Expand Up @@ -29,16 +28,10 @@ export(get_boundary)
export(get_cohorts_acronyms)
export(get_colpal)
export(get_conv_mgnbiot)
export(get_diet_fishbase)
export(get_fish_acronyms)
export(get_fished_acronyms)
export(get_groups)
export(get_growth_fishbase)
export(get_ids_fishbase)
export(get_maturity_fishbase)
export(get_nonage_acronyms)
export(get_ref_biotic)
export(get_ref_fishbase)
export(get_turnedon_acronyms)
export(group_data)
export(load_box)
Expand Down Expand Up @@ -66,7 +59,6 @@ export(plot_bar)
export(plot_boxes)
export(plot_consumed_biomass)
export(plot_diet)
export(plot_diet_bec_dev)
export(plot_line)
export(plot_rec)
export(plot_sc_init)
Expand All @@ -80,9 +72,7 @@ export(prm_to_df_ages)
export(ref_to_bibkey)
export(sc_init)
export(scan_prm)
export(scan_reference_fishbase)
export(str_split_twice)
export(theme_atlantis)
export(write_diet)
importFrom(magrittr,"%>%")
importFrom(rlang,.data)
14 changes: 14 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# atlantistools 1.0.0

## Major changes

* Replaced `magrittr` with native pipe and dependence on `R version 4.1` (PR #74)
* Removed `version_flag` argument from several functions (PR #64)
* Removed all content (code and documentation) relating to a development model (`bec-dev`) (PR #65)
* Removed all functions relating to `rfishbase` and `biotic` (PR #63)

## Patch fixes

* Removed unused dependencies, `stringi`, `vdiffr` (PR #61, PR #74)


# atlantistools 0.5.1

## Patch fixes
Expand Down
4 changes: 2 additions & 2 deletions R/calculate-consumed-biomass.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
#' select_groups = groups_rest, select_variable = "Grazing",
#' prm_run = prm_run, bboxes = bboxes)
#' df_dm <- load_dietcheck(dietcheck = file.path(d, "outputSETASDietCheck.txt"),
#' fgs = fgs, prm_run = prm_run, version_flag = 2, convert_names = TRUE)
#' fgs = fgs, prm_run = prm_run, convert_names = TRUE)
#' vol <- load_nc_physics(nc = nc_gen, select_physics = "volume",
#' prm_run = prm_run, bboxes = bboxes, aggregate_layers = FALSE)
#'
Expand Down Expand Up @@ -96,7 +96,7 @@ calculate_consumed_biomass <- function(eat, grazing, dm, vol, bio_conv) {
atoutput = atoutput * bio_conv
) |>
# Step2: Combine with diet contribution. We need a full join to make sure no data is lost!
dplyr::full_join(dm, by = c("species" = "pred", "time", "agecl")) %>%
dplyr::full_join(dm, by = c("species" = "pred", "time", "agecl")) |>
# Restrict timesteps to netcdf data! Last timestep is weird in Dietcheck.txt.
dplyr::filter(time %in% ts_eat) |>
dplyr::rename(pred = species)
Expand Down
2 changes: 1 addition & 1 deletion R/calculate-spatial-overlap.R
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ schoener <- function(predgrp, ageclass, biomass, avail) {
df_avail,
df_pred,
by = c("pred" = "species", "pred_stanza" = "species_stanza")
) %>%
) |>
dplyr::inner_join(
biomass_clean,
by = c(
Expand Down
16 changes: 5 additions & 11 deletions R/change-prm.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ change_prm <- function(
roc,
parameter,
relative = TRUE,
save_to_disc = TRUE,
version_flag = 2
save_to_disc = TRUE
) {
if (length(parameter) != 1) {
stop("Please suply only one parameter per function call.")
Expand Down Expand Up @@ -64,15 +63,10 @@ change_prm <- function(
new_value <- roc
}

# Update value. Some pesky expectations have to be added here.
if (
is.element(parameter, c("mum", "C", "mQ", "mL", "jmL", "jmQ")) &
version_flag == 1
) {
prm_biol[pos] <- paste(paste0(flag, "_T15"), new_value, sep = "\t")
} else {
prm_biol[pos] <- paste(flag, new_value, sep = "\t")
}
# Update value.

prm_biol[pos] <- paste(flag, new_value, sep = "\t")

return(prm_biol)
}

Expand Down
9 changes: 0 additions & 9 deletions R/check-growth.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,6 @@ check_growth <- function(data, yearly = FALSE) {
df
}

# Divide output with initial value!
# ref <- data[data$time == min(data$time), ]
# ref$time <- NULL
# names(ref)[names(ref) == "atoutput"] <- "atoutput_ref"
# result <- data %>%
# dplyr::left_join(ref) %>%
# dplyr::mutate(atoutput = atoutput / atoutput_ref)
# result$atoutput[result$atoutput_ref == 0] <- 0
# outcomment in case lm procedure is used! This is a bit messy.
result <- data

# Split dataframe into species and age specific subdataframes!
Expand Down
4 changes: 2 additions & 2 deletions R/combine-ages.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ combine_ages <- function(data, grp_col, agemat, value_col = "atoutput") {
data_stanza$stanza <- ifelse(data_stanza$agecl < data_stanza$age_mat, 1, 2)
data_stanza$stanza[is.na(data_stanza$stanza)] <- 1 # Not sure if this is correct!

result <- data_stanza %>%
result <- data_stanza |>
agg_data(
col = value_col,
groups = names(.)[!names(.) %in% c(value_col, "agecl")],
groups = setdiff(colnames(data_stanza), c(value_col, "agecl")),
out = value_col,
fun = sum
)
Expand Down
6 changes: 3 additions & 3 deletions R/combine-groups.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ combine_groups <- function(
# Arrange by group_col and group by groups to select the 1:combinthethresh
# group in group_col for each grouping combination.
if (length(groups) > 0) {
comb_grps <- comb_grps %>%
as.data.frame() %>%
comb_grps <- comb_grps |>
as.data.frame() |>
group_data(groups = groups)
}
imp_species <- comb_grps |>
Expand All @@ -47,7 +47,7 @@ combine_groups <- function(
# Only combine groups if necessary!
low_contrib[, group_col] <- "Rest"

new_data <- dplyr::inner_join(data, imp_species) %>%
new_data <- dplyr::inner_join(data, imp_species) |>
rbind(low_contrib)

# This should never happen...
Expand Down
23 changes: 0 additions & 23 deletions R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -227,29 +227,6 @@
"ref_bio_sp"


#' fishbase_data
#'
#' A table of all the the species found in Fihsbase, including taxonomic classification.
#'
#' @format A data frame with 33104 rows and 12 variables:
#' \describe{
#' \item{\code{SpecCode}}{integer. Species code.}
#' \item{\code{Genus}}{character.}
#' \item{\code{Species}}{character.}
#' \item{\code{SpeciesRefNo}}{integer. Reference number.}
#' \item{\code{FBname}}{character. Fishbase name.}
#' \item{\code{SubFamily}}{character.}
#' \item{\code{FamCode}}{integer. Family Code.}
#' \item{\code{GenCode}}{integer. Genetic Code.}
#' \item{\code{SubGenCode}}{integer. Sub Genetic Code.}
#' \item{\code{Family}}{character.}
#' \item{\code{Order}}{character.}
#' \item{\code{Class}}{character.}
#' }
#' @source \url{http://www.fishbase.org/} rfishbase::fishbase
"fishbase_data"


#' Reference dataframe
#'
#' Year, author and title from 3 random publications
Expand Down
1 change: 0 additions & 1 deletion R/get-boundary.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#'
#' @family get functions
#' @seealso \code{\link{load_box}}
#' @author Kelli Faye Johnson
#'
#' @param boxinfo A \code{list} as returned from \code{\link{load_box}}.
#'
Expand Down
1 change: 0 additions & 1 deletion R/load-box.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#' for an Atlantis scenario.
#'
#' @family load functions
#' @author Kelli Faye Johnson
#'
#' @param bgm Character string giving the connection to the atlantis bgm file.
#' The filename ends in \code{.bgm}.
Expand Down
42 changes: 14 additions & 28 deletions R/load-dietcheck.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,6 @@
#' time, pred, habitat, prey and atoutput (i.e., variable).
#'
#' @examples
#' # Apply to bec-dev models.
#' d <- system.file("extdata", "setas-model-new-becdev", package = "atlantistools")
#' dietcheck <- file.path(d, "outputSETASDietCheck.txt")
#' fgs <- file.path(d, "SETasGroups.csv")
#' prm_run <- file.path(d, "VMPA_setas_run_fishing_F_New.prm")
#'
#' diet <- load_dietcheck(dietcheck, fgs, prm_run, version_flag = 1)
#' head(diet, n = 10)
#'
#' # Apply to trunk models.
#' d <- system.file("extdata", "setas-model-new-trunk", package = "atlantistools")
#' dietcheck <- file.path(d, "outputSETASDietCheck.txt")
Expand All @@ -32,14 +23,12 @@
#' diet <- load_dietcheck(dietcheck, fgs, prm_run)
#' head(diet, n = 10)

#BJS 7/6/16 change to be compatible with trunk version; added version_flag
load_dietcheck <- function(
dietcheck,
fgs,
prm_run,
convert_names = FALSE,
report = FALSE,
version_flag = 2
report = FALSE
) {
# read in diet information
diet <- utils::read.table(
Expand All @@ -50,20 +39,19 @@ load_dietcheck <- function(
)

#Check if multiple stocks are available per functional group for trunk branch!
if (version_flag == 2) {
if (all(diet$Stock) == 0) {
diet$Stock <- NULL
} else {
stop(
"Multiple stocks present. Dietcheck only works with 1 stock per funtional group."
)
}

diet$Cohort <- diet$Cohort + 1 # Cohorts start with 0 in DietCheck.txt!
if (all(diet$Stock) == 0) {
diet$Stock <- NULL
} else {
stop(
"Multiple stocks present. Dietcheck only works with 1 stock per funtional group."
)
}

diet$Cohort <- diet$Cohort + 1 # Cohorts start with 0 in DietCheck.txt!

# Column Updated was added to trunk code.
if (version_flag == 2 & "Updated" %in% names(diet)) {
if ("Updated" %in% names(diet)) {
prey_col_start <- 5 #bjs remove magic number below
} else {
prey_col_start <- 4 #bjs remove magic number below
Expand Down Expand Up @@ -121,12 +109,10 @@ load_dietcheck <- function(

names(diet_long)[names(diet_long) == "Predator"] <- "pred" #bjs predator -> colnames(diet)[2]

if (version_flag == 2) {
names(diet_long)[names(diet_long) == "Cohort"] <- "agecl" #bjs cohort -> colnames(diet)[3]
# Column Updated was added to trunk code.
if ("Updated" %in% names(diet_long)) {
diet_long <- diet_long[, names(diet_long) != "Updated"]
}
names(diet_long)[names(diet_long) == "Cohort"] <- "agecl" #bjs cohort -> colnames(diet)[3]
# Column Updated was added to trunk code.
if ("Updated" %in% names(diet_long)) {
diet_long <- diet_long[, names(diet_long) != "Updated"]
}

names(diet_long) <- tolower(names(diet_long))
Expand Down
Loading
Loading