Skip to content

Commit

Permalink
croplandTree costs
Browse files Browse the repository at this point in the history
  • Loading branch information
flohump committed Feb 21, 2025
1 parent af7548a commit 04b6294
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .buildlibrary
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ValidationKey: '43701630'
ValidationKey: '43723940'
AutocreateReadme: yes
AcceptedWarnings:
- 'Warning: package ''.*'' was built under R version'
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: 'magpie4: MAgPIE outputs R package for MAgPIE version 4.x'
version: 2.17.0
date-released: '2025-02-20'
version: 2.17.1
date-released: '2025-02-21'
abstract: Common output routines for extracting results from the MAgPIE framework
(versions 4.x).
authors:
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: magpie4
Title: MAgPIE outputs R package for MAgPIE version 4.x
Version: 2.17.0
Date: 2025-02-20
Version: 2.17.1
Date: 2025-02-21
Authors@R: c(
person("Benjamin Leon", "Bodirsky", , "[email protected]", role = c("aut", "cre")),
person("Florian", "Humpenoeder", , "[email protected]", role = "aut"),
Expand Down
11 changes: 10 additions & 1 deletion R/costs.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ costs <- function(gdx, file = NULL, level = "reg", type = "annuity", sum = TRUE)
tmpCost(gdx, "ov_cost_urban", "Punishment urban deviation"),
tmpCost(gdx, "ov_water_cost", "Irrigation water"),
tmpCost(gdx, "ov_cost_packaging", "Wholesale Costs"),
tmpCost(gdx, "ov_cost_cropland", "Cropland costs"),
tmpCost(gdx, "ov_cost_scm", "Costs for soil carbon management on cropland")
)

Expand Down Expand Up @@ -144,6 +143,15 @@ costs <- function(gdx, file = NULL, level = "reg", type = "annuity", sum = TRUE)
tmpCost(gdx, "ov32_cost_establishment", "Forestry") * fAn
}

# CroplandTree
if (suppressWarnings(is.null(readGDX(gdx, "ov29_cost_treecover_est")))) {
croplandTree <- tmpCost(gdx, "ov_cost_cropland", "CroplandTree")

} else {
croplandTree <- tmpCost(gdx, "ov_cost_cropland", "CroplandTree") - tmpCost(gdx, "ov29_cost_treecover_est", "CroplandTree") +
tmpCost(gdx, "ov29_cost_treecover_est", "CroplandTree") * fAn
}

# TC
if (suppressWarnings(is.null(readGDX(gdx, "ov13_cost_tc")))) {
technology <- tmpCost(gdx, "ov_tech_cost", "TC")
Expand Down Expand Up @@ -175,6 +183,7 @@ costs <- function(gdx, file = NULL, level = "reg", type = "annuity", sum = TRUE)
x[[length(x) + 1]] <- inputCosts
x[[length(x) + 1]] <- peatland
x[[length(x) + 1]] <- forestry
x[[length(x) + 1]] <- croplandTree
x[[length(x) + 1]] <- technology
x[[length(x) + 1]] <- emissions

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MAgPIE outputs R package for MAgPIE version 4.x

R package **magpie4**, version **2.17.0**
R package **magpie4**, version **2.17.1**

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

Expand Down Expand Up @@ -39,7 +39,7 @@ In case of questions / problems please contact Benjamin Leon Bodirsky <bodirsky@

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

Bodirsky B, Humpenoeder F, Dietrich J, Stevanovic M, Weindl I, Karstens K, Wang X, Mishra A, Beier F, Breier J, Yalew A, Chen D, Biewald A, Wirth S, von Jeetze P, Leip D, Crawford M, Alves M, Bonsch M, Vartika S (2025). "magpie4: MAgPIE outputs R package for MAgPIE version 4.x." doi:10.5281/zenodo.1158582 <https://doi.org/10.5281/zenodo.1158582>, Version: 2.17.0, <https://github.com/pik-piam/magpie4>.
Bodirsky B, Humpenoeder F, Dietrich J, Stevanovic M, Weindl I, Karstens K, Wang X, Mishra A, Beier F, Breier J, Yalew A, Chen D, Biewald A, Wirth S, von Jeetze P, Leip D, Crawford M, Alves M, Bonsch M, Vartika S (2025). "magpie4: MAgPIE outputs R package for MAgPIE version 4.x." doi:10.5281/zenodo.1158582 <https://doi.org/10.5281/zenodo.1158582>, Version: 2.17.1, <https://github.com/pik-piam/magpie4>.

A BibTeX entry for LaTeX users is

Expand All @@ -48,9 +48,9 @@ A BibTeX entry for LaTeX users is
title = {magpie4: MAgPIE outputs R package for MAgPIE version 4.x},
author = {Benjamin Leon Bodirsky and Florian Humpenoeder and Jan Philipp Dietrich and Miodrag Stevanovic and Isabelle Weindl and Kristine Karstens and Xiaoxi Wang and Abhijeet Mishra and Felicitas Beier and Jannes Breier and Amsalu Woldie Yalew and David Chen and Anne Biewald and Stephen Wirth and Patrick {von Jeetze} and Debbora Leip and Michael Crawford and Marcos Alves and Markus Bonsch and Singh Vartika},
doi = {10.5281/zenodo.1158582},
date = {2025-02-20},
date = {2025-02-21},
year = {2025},
url = {https://github.com/pik-piam/magpie4},
note = {Version: 2.17.0},
note = {Version: 2.17.1},
}
```

0 comments on commit 04b6294

Please sign in to comment.