Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search for the lastRun in the archive too, not just in output #128

Merged
merged 2 commits into from
Feb 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 .buildlibrary
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ValidationKey: '4632200'
ValidationKey: '4653957'
AcceptedWarnings:
- 'Warning: package ''.*'' was built under R version'
- 'Warning: namespace ''.*'' is not available and has been replaced'
Expand Down
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ cff-version: 1.2.0
message: If you use this software, please cite it using the metadata from this file.
type: software
title: 'modelstats: Run Analysis Tools'
version: 0.23.0
date-released: '2025-02-21'
version: 0.23.1
date-released: '2025-02-28'
abstract: A collection of tools to analyze model runs.
authors:
- family-names: Giannousakis
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: modelstats
Type: Package
Title: Run Analysis Tools
Version: 0.23.0
Date: 2025-02-21
Version: 0.23.1
Date: 2025-02-28
Authors@R: c(
person("Anastasis", "Giannousakis", email = "giannou@pik-potsdam.de", role = c("aut","cre")),
person("Oliver", "Richters", role = "aut")
Expand Down
14 changes: 8 additions & 6 deletions R/modeltests.R
Original file line number Diff line number Diff line change
Expand Up @@ -346,21 +346,23 @@ evaluateRuns <- function(model, # nolint: cyclocomp_linter.
sameRuns <- gRS %>% filter(.data$Conv %in% c("converged", "converged (had INFES)"), # runs have to be converged
.data$Mif %in% c("yes", "sumErr"), # need to have mifs
grepl(cfg$title, rownames(gRS)), # must be the same scenario
!rownames(gRS) %in% basename(cfg$results_folder)) %>% # but not the current run
rownames()
!rownames(gRS) %in% basename(cfg$results_folder)) %>% # but not the current run
rownames()
if (length(sameRuns) > 0) {
lastRun <- max(sameRuns[sameRuns < basename(cfg$results_folder)])
# If it was too long ago, the lastRun may have been moved to the archive in the meantime.
if (!file.exists(lastRun)) lastRun <- file.path("archive", lastRun)
fullPathToThisRun <- normalizePath(".")
fullPathToLastRun <- normalizePath(file.path("..", lastRun))
# compare runtime for converged run only (skip if not_converged)
if (grsi[, "Conv"] %in% c("converged", "converged (had INFES)")) {
currentRunTime <- as.numeric(.readRuntime("."), units = "hours")
lastRunTime <- as.numeric(.readRuntime(paste0("../", lastRun)), units = "hours")
currentRunTime <- as.numeric(.readRuntime(fullPathToThisRun), units = "hours")
lastRunTime <- as.numeric(.readRuntime(fullPathToLastRun), units = "hours")
if (length(currentRunTime) > 0 && length(lastRunTime) > 0 && currentRunTime > (1.25 * lastRunTime)) {
errorList <- c(errorList, "Check runtime! Have some scenarios become slower?")
}
}
# run compareScenarios also for runs that are not_converged
fullPathToThisRun <- normalizePath(".")
fullPathToLastRun <- normalizePath(file.path("..", lastRun))
if (compScen &&
all(file.exists(paste0(c(fullPathToThisRun, fullPathToLastRun),
"/REMIND_generic_", cfg$title, ".mif"))) &&
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Run Analysis Tools

R package **modelstats**, version **0.23.0**
R package **modelstats**, version **0.23.1**

[![CRAN status](https://www.r-pkg.org/badges/version/modelstats)](https://cran.r-project.org/package=modelstats) [![R build status](https://github.com/pik-piam/modelstats/workflows/check/badge.svg)](https://github.com/pik-piam/modelstats/actions) [![codecov](https://codecov.io/gh/pik-piam/modelstats/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/modelstats) [![r-universe](https://pik-piam.r-universe.dev/badges/modelstats)](https://pik-piam.r-universe.dev/builds)

Expand Down Expand Up @@ -47,17 +47,17 @@ In case of questions / problems please contact Anastasis Giannousakis <giannou@p

To cite package **modelstats** in publications use:

Giannousakis A, Richters O (2025). "modelstats: Run Analysis Tools." Version: 0.23.0, <https://github.com/pik-piam/modelstats>.
Giannousakis A, Richters O (2025). "modelstats: Run Analysis Tools." Version: 0.23.1, <https://github.com/pik-piam/modelstats>.

A BibTeX entry for LaTeX users is

```latex
@Misc{,
title = {modelstats: Run Analysis Tools},
author = {Anastasis Giannousakis and Oliver Richters},
date = {2025-02-21},
date = {2025-02-28},
year = {2025},
url = {https://github.com/pik-piam/modelstats},
note = {Version: 0.23.0},
note = {Version: 0.23.1},
}
```