Skip to content

Commit

Permalink
fixed lintr, buildLibrary
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidhoPIK committed May 23, 2024
1 parent 2e3736f commit 43f8a28
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .buildlibrary
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ValidationKey: '27996960'
ValidationKey: '28030926'
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: 'mrcommons: MadRat commons Input Data Library'
version: 1.41.0
date-released: '2024-05-13'
version: 1.41.1
date-released: '2024-05-23'
abstract: Provides useful functions and a common structure to all the input data required
to run models like MAgPIE and REMIND of model input data.
authors:
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: mrcommons
Type: Package
Title: MadRat commons Input Data Library
Version: 1.41.0
Date: 2024-05-13
Version: 1.41.1
Date: 2024-05-23
Authors@R: c(person("Benjamin Leon", "Bodirsky", email = "[email protected]", role = "aut"),
person("Kristine", "Karstens", role = "aut"),
person("Lavinia", "Baumstark", role = "aut"),
Expand Down
24 changes: 11 additions & 13 deletions R/calcFeedBaskets.R
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,8 @@ calcFeedBaskets <- function(non_eaten_food = FALSE, # nolint
# convergence to regression values:
outm <- convergence(outm, outShr, start_year = start_year, end_year = end_year, type = type)
# set limit of 10% main share or the share in the last historical year in case it is lower than the limit
outm[, future, ] <- outm[, future, ] * (outm[, future, ] > 0.1) +
outm[, year, ] * (outm[, future, ] < 0.1 &
outm[, year, ] < 0.1) + 0.1 * (outm[, future, ] < 0.1 &
outm[, year, ] > 0.1)
outm[, future, ] <- outm[, future, ] * (outm[, future, ] > 0.1) + outm[, year, ] *
(outm[, future, ] < 0.1 & outm[, year, ] < 0.1) + 0.1 * (outm[, future, ] < 0.1 & outm[, year, ] > 0.1)

# add missing systems
missing <- setdiff(getNames(fbaskShr, dim = 1), getNames(outm, dim = 1))
Expand All @@ -214,8 +212,8 @@ calcFeedBaskets <- function(non_eaten_food = FALSE, # nolint
return(out)
}
calShr <- .calcCalibShr(fbaskShr, outShr,
start_year = year,
end_year = 2050, type = "linear")
start_year = year,
end_year = 2050, type = "linear")


# Read in efficiencies and calibrate them
Expand Down Expand Up @@ -254,18 +252,18 @@ calcFeedBaskets <- function(non_eaten_food = FALSE, # nolint
fbaskSysRef <- setYears(fbaskSys[, year, ], NULL)

mainWeight <- .calcConvergeWeight(years = getYears(calShr),
start = year,
x = fbaskSysRef * ctype[, , "main"],
converge = FALSE)
start = year,
x = fbaskSysRef * ctype[, , "main"],
converge = FALSE)
antiWeight <- .calcConvergeWeight(years = getYears(calShr),
start = year,
x = fbaskSysRef * ctype[, , "anti"],
converge = TRUE)
start = year,
x = fbaskSysRef * ctype[, , "anti"],
converge = TRUE)
# no convergence to global targets for systems
# where the main feed share stays constant over time: "sys_chicken","sys_hen"
tmp <- .calcConvergeWeight(start = year, years = getYears(calShr),
x = (fbaskSysRef[, , c("sys_chicken", "sys_hen")]
* ctype[, , c("sys_chicken", "sys_hen")][, , "anti"]),
* ctype[, , c("sys_chicken", "sys_hen")][, , "anti"]),
converge = FALSE)
antiWeight[, , c("sys_chicken", "sys_hen")] <- tmp

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MadRat commons Input Data Library

R package **mrcommons**, version **1.41.0**
R package **mrcommons**, version **1.41.1**

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

Expand Down Expand Up @@ -39,7 +39,7 @@ In case of questions / problems please contact Jan Philipp Dietrich <dietrich@pi

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

Bodirsky B, Karstens K, Baumstark L, Weindl I, Wang X, Mishra A, Wirth S, Stevanovic M, Steinmetz N, Kreidenweis U, Rodrigues R, Popov R, Humpenoeder F, Giannousakis A, Levesque A, Klein D, Araujo E, Beier F, Oeser J, Pehl M, Leip D, Crawford M, Molina Bacca E, von Jeetze P, Martinelli E, Schreyer F, Soergel B, Sauer P, Hötten D, Hasse R, Abrahão G, Weigmann P, Dietrich J (2024). _mrcommons: MadRat commons Input Data Library_. doi:10.5281/zenodo.3822009 <https://doi.org/10.5281/zenodo.3822009>, R package version 1.41.0, <https://github.com/pik-piam/mrcommons>.
Bodirsky B, Karstens K, Baumstark L, Weindl I, Wang X, Mishra A, Wirth S, Stevanovic M, Steinmetz N, Kreidenweis U, Rodrigues R, Popov R, Humpenoeder F, Giannousakis A, Levesque A, Klein D, Araujo E, Beier F, Oeser J, Pehl M, Leip D, Crawford M, Molina Bacca E, von Jeetze P, Martinelli E, Schreyer F, Soergel B, Sauer P, Hötten D, Hasse R, Abrahão G, Weigmann P, Dietrich J (2024). _mrcommons: MadRat commons Input Data Library_. doi: 10.5281/zenodo.3822009 (URL: https://doi.org/10.5281/zenodo.3822009), R package version 1.41.1, <URL: https://github.com/pik-piam/mrcommons>.

A BibTeX entry for LaTeX users is

Expand All @@ -48,8 +48,8 @@ A BibTeX entry for LaTeX users is
title = {mrcommons: MadRat commons Input Data Library},
author = {Benjamin Leon Bodirsky and Kristine Karstens and Lavinia Baumstark and Isabelle Weindl and Xiaoxi Wang and Abhijeet Mishra and Stephen Wirth and Mishko Stevanovic and Nele Steinmetz and Ulrich Kreidenweis and Renato Rodrigues and Roman Popov and Florian Humpenoeder and Anastasis Giannousakis and Antoine Levesque and David Klein and Ewerton Araujo and Felicitas Beier and Julian Oeser and Michaja Pehl and Debbora Leip and Michael Crawford and Edna {Molina Bacca} and Patrick {von Jeetze} and Eleonora Martinelli and Felix Schreyer and Bjoern Soergel and Pascal Sauer and David Hötten and Robin Hasse and Gabriel Abrahão and Pascal Weigmann and Jan Philipp Dietrich},
year = {2024},
note = {R package version 1.41.0},
url = {https://github.com/pik-piam/mrcommons},
note = {R package version 1.41.1},
doi = {10.5281/zenodo.3822009},
url = {https://github.com/pik-piam/mrcommons},
}
```

0 comments on commit 43f8a28

Please sign in to comment.