Skip to content

Commit

Permalink
bugfix soil carbon layer data
Browse files Browse the repository at this point in the history
  • Loading branch information
k4rst3ns committed Jan 10, 2025
1 parent 206160e commit 2f1473a
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .buildlibrary
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ValidationKey: '30673440'
ValidationKey: '30770038'
AutocreateReadme: yes
AcceptedWarnings:
- 'Warning: package .* was built under R version'
Expand All @@ -9,3 +9,4 @@ AcceptedNotes:
allowLinterWarnings: no
enforceVersionUpdate: no
skipCoverage: no
AutocreateCITATION: yes
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exclude: '^tests/testthat/_snaps/.*$'
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 2c9f875913ee60ca25ce70243dc24d5b6415598c # frozen: v4.6.0
rev: cef0300fd0fc4d2a87a85fa2093c6b283ea36f4b # frozen: v5.0.0
hooks:
- id: check-case-conflict
- id: check-json
Expand All @@ -15,7 +15,7 @@ repos:
- id: mixed-line-ending

- repo: https://github.com/lorenzwalthert/precommit
rev: bae853d82da476eee0e0a57960ee6b741a3b3fb7 # frozen: v0.4.3
rev: 3b70240796cdccbe1474b0176560281aaded97e6 # frozen: v0.4.3.9003
hooks:
- id: parsable-R
- id: deps-in-desc
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: 'mrmagpie: madrat based MAgPIE Input Data Library'
version: 1.53.0
date-released: '2024-11-21'
version: 1.53.1
date-released: '2025-01-10'
abstract: Provides functions for MAgPIE country and cellular input data generation.
authors:
- family-names: Karstens
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: mrmagpie
Title: madrat based MAgPIE Input Data Library
Version: 1.53.0
Date: 2024-11-21
Version: 1.53.1
Date: 2025-01-10
Authors@R: c(
person("Kristine", "Karstens", , "[email protected]", role = c("aut", "cre")),
person("Jan Philipp", "Dietrich", , "[email protected]", role = "aut"),
Expand Down
7 changes: 6 additions & 1 deletion R/calcTopsoilCarbon.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,13 @@ calcTopsoilCarbon <- function(cells = "lpjcell",
stage <- "harmonized2020"
}

soilcLayerNatveg <- calcOutput("LPJmL_new", version = lpjml["natveg"], climatetype = climatetype,
soilcLayerShare <- calcOutput("LPJmL_new", version = lpjml["natveg"], climatetype = climatetype,
subtype = "soilc_layer", stage = stage, aggregate = FALSE)
soilcLayerShare <- soilcLayerShare / dimSums(soilcLayerShare, dim = 3) # calculating a share per layer
soilcLayerShare <- toolConditionalReplace(soilcLayerShare, conditions = c("is.na()"), replaceby = 0)
soilcLayerNatveg <- calcOutput("LPJmL_new", version = lpjml["natveg"], climatetype = climatetype,
subtype = "soilc", stage = stage, aggregate = FALSE) * soilcLayerShare

topsoilc <- soilcLayerNatveg[, , 1] + 1 / 3 * soilcLayerNatveg[, , 2]
getNames(topsoilc) <- "topsoilc"

Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# madrat based MAgPIE Input Data Library

R package **mrmagpie**, version **1.53.0**
R package **mrmagpie**, version **1.53.1**

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

Expand Down Expand Up @@ -39,17 +39,18 @@ In case of questions / problems please contact Kristine Karstens <karstens@pik-p

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

Karstens K, Dietrich J, Chen D, Windisch M, Alves M, Beier F, Köberle A, v. Jeetze P, Mishra A, Humpenoeder F, Sauer P (2024). _mrmagpie: madrat based MAgPIE Input Data Library_. doi:10.5281/zenodo.4319612 <https://doi.org/10.5281/zenodo.4319612>, R package version 1.53.0, <https://github.com/pik-piam/mrmagpie>.
Karstens K, Dietrich J, Chen D, Windisch M, Alves M, Beier F, Köberle A, v. Jeetze P, Mishra A, Humpenoeder F, Sauer P (2025). "mrmagpie: madrat based MAgPIE Input Data Library." doi:10.5281/zenodo.4319612 <https://doi.org/10.5281/zenodo.4319612>, Version: 1.53.1, <https://github.com/pik-piam/mrmagpie>.

A BibTeX entry for LaTeX users is

```latex
@Manual{,
@Misc{,
title = {mrmagpie: madrat based MAgPIE Input Data Library},
author = {Kristine Karstens and Jan Philipp Dietrich and David Chen and Michael Windisch and Marcos Alves and Felicitas Beier and Alexandre Köberle and Patrick {v. Jeetze} and Abhijeet Mishra and Florian Humpenoeder and Pascal Sauer},
year = {2024},
note = {R package version 1.53.0},
doi = {10.5281/zenodo.4319612},
date = {2025-01-10},
year = {2025},
url = {https://github.com/pik-piam/mrmagpie},
note = {Version: 1.53.1},
}
```

0 comments on commit 2f1473a

Please sign in to comment.