Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
5b7883b
...
bodirsky Apr 10, 2026
aa72b25
merge master into croparea branch
FelicitasBeier May 8, 2026
b22f064
added multiple cropping function call to fullCELLULAR
FelicitasBeier May 13, 2026
eb758d4
Merge branch 'master' into cropareaUpdate
FelicitasBeier May 13, 2026
70a2f03
Added calcmulticropping call in addition to calcmulticroppingintensit…
FelicitasBeier May 13, 2026
8db6255
removed calcMulticroppingIntensity call since it relies on newer LPJm…
FelicitasBeier May 13, 2026
40bb8e1
remove cellular argument from calcMulticropping cal
FelicitasBeier Jun 1, 2026
1827032
merge master into feature branch
FelicitasBeier Jun 1, 2026
9cbe4e7
build to confirm version in preprocessing
FelicitasBeier Jun 1, 2026
083d7f5
return only past subset of years for croparea_initialisation
FelicitasBeier Jun 3, 2026
21741c2
return past from 1965 to 2020 for croparea initialization
FelicitasBeier Jun 4, 2026
c49db01
Changed pasttil2020 to pasttil2015 because MAgPIE doesn't fully suppo…
FelicitasBeier Jun 12, 2026
7acd707
Merge branch 'master' into cropareaUpdate
FelicitasBeier Jul 8, 2026
9943510
updated years to past_til2020 in croparea call
FelicitasBeier Jul 9, 2026
8740f83
calcAvlLandSi changed from LUH3 to LanduseInitialisation
georg-schroeter Jul 15, 2026
b2fce3b
remove R/calcPastrTauHist.R as it isn't called anymore
georg-schroeter Jul 15, 2026
9f6a8c7
merge master into cropareaUpdate branch
FelicitasBeier Aug 6, 2026
8900cda
changed years of croparea to until 2015 instead of 2020
FelicitasBeier Aug 6, 2026
50d2197
reintroduced calcPastrTauHist because it is still called in fullCELLU…
FelicitasBeier Aug 6, 2026
ee73f6c
calcAreaActuallyIrrigated: assign the aggregated result to out
bodirsky Aug 7, 2026
7f0e0d3
merge master into cropareaUpdate branch
FelicitasBeier Aug 10, 2026
446fba6
calcAreaActuallyIrrigated: exclude fallow land, drop round = 6
bodirsky Aug 10, 2026
5d92434
..
bodirsky Aug 10, 2026
d7bc404
removed unused cells argument from calcCroplandTreecover calls
FelicitasBeier Aug 13, 2026
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
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
^.*CITATION.cff$
^\.claude$
^_pkgdown\.yml$
^\.positai$
2 changes: 1 addition & 1 deletion .buildlibrary
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ValidationKey: '34377536'
ValidationKey: '34532260'
AutocreateReadme: yes
AcceptedWarnings:
- 'Warning: package .* was built under R version'
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
.Rhistory
.RData
.Ruserdata
.positai
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.66.3
date-released: '2026-08-07'
version: 1.67.0
date-released: '2026-08-13'
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.66.3
Date: 2026-08-07
Version: 1.67.0
Date: 2026-08-13
Authors@R: c(
person("Kristine", "Karstens", , "karstens@pik-potsdam.de", role = c("aut", "cre")),
person("Jan Philipp", "Dietrich", , "dietrich@pik-potsdam.de", role = "aut"),
Expand Down
16 changes: 8 additions & 8 deletions R/calcAreaActuallyIrrigated.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@

calcAreaActuallyIrrigated <- function(aggregationlevel = "iso", selectyears = "y1995") {
# Read in data: crop- and water supply type specific crop area (in Mha):
x <- calcOutput("Croparea", physical = TRUE, cellular = TRUE, irrigation = TRUE, round = 6, aggregate = FALSE, years = selectyears)
x <- calcOutput("Croparea", physical = TRUE, cellular = TRUE, irrigation = TRUE,
aggregate = FALSE, years = selectyears, fallow = FALSE)

# extract irrigated area:
x <- dimSums(x[, , "irrigated"], dim = 3.1)
Expand All @@ -24,17 +25,16 @@ calcAreaActuallyIrrigated <- function(aggregationlevel = "iso", selectyears = "y

if (aggregationlevel == "iso") {
# country to cell mapping
CountryToCell <- toolGetMapping(type = "cell", name = "CountryToCellMapping.csv", where = "mappingfolder")
countryToCell <- toolGetMapping(type = "cell", name = "CountryToCellMapping.csv", where = "mappingfolder")
# aggregate data
toolAggregate(x, dim = 1, rel = CountryToCell)
out <- toolAggregate(x, dim = 1, rel = countryToCell)

} else {
out <- x
}

return(list(
x = out,
weight = NULL,
unit = "Million ha",
description = "Irrigated cropland area"))
return(list(x = out,
weight = NULL,
unit = "Million ha",
description = "Irrigated cropland area"))
}
5 changes: 2 additions & 3 deletions R/calcAvlLandSi.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ calcAvlLandSi <- function(cells = "lpjcell") {
x <- readSource("Ramankutty", convert = "onlycorrect")

# land area according to LUH in initialization year (1995) [note: landarea is constant, so the year does not matter]
landarea <- calcOutput("LUH3",
landuseTypes = "magpie",
landarea <- calcOutput("LanduseInitialisation",
nclasses = "five",
aggregate = FALSE,
cellular = TRUE,
irrigation = FALSE,
years = "y1995")
croparea <- landarea[, , "crop"]
landarea <- dimSums(landarea, dim = 3)
Expand Down
19 changes: 16 additions & 3 deletions R/fullCELLULARMAGPIE.R
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ fullCELLULARMAGPIE <- function(rev = numeric_version("0.1"), dev = "",
magYearsPastLong <- c("y1995", "y2000", "y2005", "y2010", "y2015")
magYears <- findset("time")
shortYears <- findset("t_all")
pastTil2015 <- c(findset("past"), "y2015")
lpjYears <- seq(1995, 2100, by = 5)
roundArea <- 5
stats <- c("summary", "sum")
Expand Down Expand Up @@ -223,12 +224,24 @@ fullCELLULARMAGPIE <- function(rev = numeric_version("0.1"), dev = "",
# 30 crop
calcOutput("Croparea", sectoral = "kcr", physical = TRUE,
cellular = TRUE, irrigation = FALSE, round = roundArea,
years = pastTil2015,
aggregate = "cluster", outputStatistics = stats,
file = paste0("f30_croparea_initialisation_", ctype, ".mz"))
calcOutput("Croparea", sectoral = "kcr", physical = TRUE,
cellular = TRUE, irrigation = TRUE, round = roundArea,
years = pastTil2015,
aggregate = "cluster", outputStatistics = stats,
file = paste0("f30_croparea_w_initialisation_", ctype, ".mz"))

### As part of mrwater/multiple cropping integration: Change to this function.
#calcOutput("MulticroppingIntensity", selectyears = magYears, round = 4,
# scenario = "crop", sectoral = "kcr",
# outputStatistics = stats, file = "fm_multicropping_j.cs3",
# aggregate = "cluster")
calcOutput("Multicropping", years = magYears, round = 4,
outputStatistics = stats, file = "fm_multicropping_j.cs3",
aggregate = "cluster")

## For cellular comparison
calcOutput("MAPSPAM", subtype = "physical", aggregate = FALSE, round = NULL,
outputStatistics = stats, file = paste0("MAPSPAM_croparea_0.5.mz"))
Expand All @@ -247,13 +260,13 @@ fullCELLULARMAGPIE <- function(rev = numeric_version("0.1"), dev = "",
round = roundArea, outputStatistics = stats, file = "avl_cropland_iso.cs3")

calcOutput("CroplandTreecover",
aggregate = FALSE, cells = cells,
aggregate = FALSE,
round = NULL, outputStatistics = stats, file = "CroplandTreecover_0.5.mz")
calcOutput("CroplandTreecover",
aggregate = "cluster", cells = cells,
aggregate = "cluster",
round = roundArea, outputStatistics = stats, file = paste0("CroplandTreecover_", ctype, ".mz"))
calcOutput("CroplandTreecover",
aggregate = FALSE, cells = cells, countryLevel = TRUE,
aggregate = FALSE, countryLevel = TRUE,
round = roundArea, outputStatistics = stats, file = "CroplandTreecover_iso.cs2")

calcOutput("SNVTargetCropland",
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 based MAgPIE Input Data Library

R package **mrmagpie**, version **1.66.3**
R package **mrmagpie**, version **1.67.0**

[![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,7 +39,7 @@ 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, Rein P (2026). "mrmagpie: madrat based MAgPIE Input Data Library." doi:10.5281/zenodo.4319612 <https://doi.org/10.5281/zenodo.4319612>, Version: 1.66.3, <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, Rein P (2026). "mrmagpie: madrat based MAgPIE Input Data Library." doi:10.5281/zenodo.4319612 <https://doi.org/10.5281/zenodo.4319612>, Version: 1.67.0, <https://github.com/pik-piam/mrmagpie>.

A BibTeX entry for LaTeX users is

Expand All @@ -48,9 +48,9 @@ A BibTeX entry for LaTeX users is
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 and Patrick Rein},
doi = {10.5281/zenodo.4319612},
date = {2026-08-07},
date = {2026-08-13},
year = {2026},
url = {https://github.com/pik-piam/mrmagpie},
note = {Version: 1.66.3},
note = {Version: 1.67.0},
}
```
1 change: 1 addition & 0 deletions mrmagpie.Rproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Version: 1.0
ProjectId: c5effd79-0000-4588-804c-cc44eff34666

RestoreWorkspace: Default
SaveWorkspace: Default
Expand Down