Skip to content
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: '43610700'
ValidationKey: '43822590'
AutocreateReadme: yes
AutocreateCITATION: yes
AcceptedWarnings:
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: 'mrmfa: Input data generation for the REMIND MFA'
version: 2.10.0
date-released: '2026-11-10'
version: 2.11.0
date-released: '2026-11-12'
abstract: The mrmfa packages contains data preprocessing for the REMIND MFA.
authors:
- family-names: Dürrwächter
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Type: Package
Package: mrmfa
Title: Input data generation for the REMIND MFA
Version: 2.10.0
Date: 2026-11-10
Version: 2.11.0
Date: 2026-11-12
Authors@R: c(
person("Jakob", "Dürrwächter", , "jakobdu@pik-potsdam.de", role = c("aut", "cre")),
person("Bennet", "Weiss", , "bennet.weiss@pik-potsdam.de", role = "aut"),
Expand Down
36 changes: 36 additions & 0 deletions R/calcCoScalars.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#' Collect scalar parameters
#'
#' @description
#' Stores named scalar values (e.g. the start and end years of the model time
#' periods) in a magpie object, so that they can be written to a file via
#' calcOutput. Written as .cs4r, each line has the form \code{name,value}.
#'
#' @author Jakob Dürrwächter
#' @param scalars Named numeric vector, e.g.
#' \code{c(start_historical = 1900, end_historical = 2022, end_future = 2150)}.
#' @param unit Unit of the scalars.
#' @return List with magpie object of the scalars and metadata in calcOutput format.
#' @examples
#' \dontrun{
#' calcOutput("CoScalars", scalars = c(start_historical = 1900, end_historical = 2022),
#' file = "st_scalars.cs4r", aggregate = FALSE)
#' }
calcCoScalars <- function(scalars, unit = "various") {
if (!is.numeric(scalars) || length(scalars) == 0) {
stop("scalars must be a non-empty numeric vector.")
}
if (is.null(names(scalars)) || any(names(scalars) == "") || anyDuplicated(names(scalars))) {
stop("All scalars must have unique, non-empty names.")
}

x <- new.magpie(names = names(scalars), fill = unname(scalars), sets = c("region", "year", "scalar"))

return(list(
x = x,
weight = NULL,
unit = unit,
isocountries = FALSE,
description = paste0("Scalar parameters: ", paste(names(scalars), collapse = ", ")),
note = "dimensions: (scalar,value)"
))
}
9 changes: 9 additions & 0 deletions R/fullMFA.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ fullMFA <- function(rev = 0,
start_historical <- 1900
end_historical <- 2022

calcOutput("CoScalars", file = "st_time_range.cs4r", aggregate = FALSE, unit = "year",
scalars = c(start_historical = start_historical, end_historical = end_historical, end_future = end_future))

# common parameters
calcOutput("CoPopulation", file = "st_population.cs4r", scenarios = driverScenarios, collapse = FALSE, smooth = TRUE, years = start_historical:end_future)
calcOutput("CoGDP", file = "st_gdppc.cs4r", perCapita = gdpPerCapita, scenarios = driverScenarios, collapse = FALSE, smooth = TRUE, years = start_historical:end_future)
Expand Down Expand Up @@ -97,6 +100,9 @@ fullMFA <- function(rev = 0,
start_historical <- 1880
end_historical <- 2025

calcOutput("CoScalars", file = "ce_time_range.cs4r", aggregate = FALSE, unit = "year",
scalars = c(start_historical = start_historical, end_historical = end_historical, end_future = end_future))

# common parameters
calcOutput("CoPopulation", file = "ce_population.cs4r", scenarios = driverScenarios, collapse = FALSE, smooth = TRUE, years = start_historical:end_future)
calcOutput("CoGDP", file = "ce_gdppc.cs4r", perCapita = gdpPerCapita, scenarios = driverScenarios, collapse = FALSE, smooth = TRUE, years = start_historical:end_future)
Expand Down Expand Up @@ -146,6 +152,9 @@ fullMFA <- function(rev = 0,
start_historical <- 1950
end_historical <- 2024

calcOutput("CoScalars", file = "pl_time_range.cs4r", aggregate = FALSE, unit = "year",
scalars = c(start_historical = start_historical, end_historical = end_historical, end_future = end_future))

# common parameters
calcOutput("CoPopulation", file = "pl_population.cs4r", scenarios = driverScenarios, collapse = FALSE, smooth = TRUE, years = start_historical:end_future)
calcOutput("CoGDP", file = "pl_gdppc.cs4r", perCapita = gdpPerCapita, scenarios = driverScenarios, collapse = FALSE, smooth = TRUE, years = start_historical:end_future)
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Input data generation for the REMIND MFA

R package **mrmfa**, version **2.10.0**
R package **mrmfa**, version **2.11.0**

[![R build status](https://github.com/pik-piam/mrmfa/workflows/check/badge.svg)](https://github.com/pik-piam/mrmfa/actions) [![codecov](https://codecov.io/gh/pik-piam/mrmfa/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/mrmfa)

Expand Down Expand Up @@ -38,17 +38,17 @@ In case of questions / problems please contact Jakob Dürrwächter <jakobdu@pik-

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

Dürrwächter J, Weiss B, Schweiger L, Benke F, Diez T, Hosak M, Zhang Q (2026). "mrmfa: Input data generation for the REMIND MFA." Version: 2.10.0, <https://github.com/pik-piam/mrmfa>.
Dürrwächter J, Weiss B, Schweiger L, Benke F, Diez T, Hosak M, Zhang Q (2026). "mrmfa: Input data generation for the REMIND MFA." Version: 2.11.0, <https://github.com/pik-piam/mrmfa>.

A BibTeX entry for LaTeX users is

```latex
@Misc{,
title = {mrmfa: Input data generation for the REMIND MFA},
author = {Jakob Dürrwächter and Bennet Weiss and Leonie Schweiger and Falk Benke and Tobias Diez and Merlin Jo Hosak and Qianzhi Zhang},
date = {2026-11-10},
date = {2026-11-12},
year = {2026},
url = {https://github.com/pik-piam/mrmfa},
note = {Version: 2.10.0},
note = {Version: 2.11.0},
}
```
31 changes: 31 additions & 0 deletions man/calcCoScalars.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading