diff --git a/.buildlibrary b/.buildlibrary index 9e0c4ee..1186b0b 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '55784700' +ValidationKey: '56029250' AutocreateReadme: yes AcceptedWarnings: - 'Warning: package .* was built under R version' diff --git a/CITATION.cff b/CITATION.cff index e6daad0..2a6254b 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -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: 'mrvalidation: madrat data preparation for validation purposes' -version: 2.70.0 -date-released: '2026-07-27' +version: 2.71.0 +date-released: '2026-08-10' abstract: Package contains routines to prepare data for validation exercises. authors: - family-names: Bodirsky diff --git a/DESCRIPTION b/DESCRIPTION index fd286cc..f026ad5 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Type: Package Package: mrvalidation Title: madrat data preparation for validation purposes -Version: 2.70.0 -Date: 2026-07-27 +Version: 2.71.0 +Date: 2026-08-10 Authors@R: c( person("Benjamin Leon", "Bodirsky", , "bodirsky@pik-potsdam.de", role = c("aut", "cre")), person("Stephen", "Wirth", role = "aut"), diff --git a/R/calcValidCarbon.R b/R/calcValidCarbon.R index dcbf7f3..7d0c5ce 100644 --- a/R/calcValidCarbon.R +++ b/R/calcValidCarbon.R @@ -45,7 +45,7 @@ calcValidCarbon <- function(datasource = "LPJmL4_for_MAgPIE_44ac93de:GSWP3-W5E5: stock <- mbind(setNames(soilc, "soilc"), setNames(litc, "litc"), setNames(vegc, "vegc")) rm(soilc, litc, vegc) - area <- dimSums(calcOutput("LUH3", landuseTypes = "LUH3", irrigation = FALSE, + area <- dimSums(calcOutput("LanduseInitialisation", cellular = TRUE, years = "y1995", aggregate = FALSE), dim = 3) diff --git a/R/calcValidCroparea.R b/R/calcValidCroparea.R index 9fc58b2..1bc7f7b 100644 --- a/R/calcValidCroparea.R +++ b/R/calcValidCroparea.R @@ -1,15 +1,18 @@ #' @title calcValidCroparea #' -#' @description Returns historical areas of individual crops. These are derived by -#' correcting harvested areas to match to physical cropland areas. Both these -#' datasets are from FAO. Output is meant to be used for model validation. +#' @description Returns historical areas of individual crops, meant to be used for +#' model validation. The default source is the madrat croparea preprocessing, which +#' harmonises LandInG against LUH and calibrates it to LanduseInitialisation cropland; +#' it is no longer FAOSTAT, so the series is labelled accordingly rather than as "FAO". #' Ostberg2023 is a slightly modified version of #' https://gmd.copernicus.org/articles/16/3375/2023/gmd-16-3375-2023-assets.html #' -#' @param datasource "FAO": croparea according to FAOSTAT, +#' @param datasource "MadratLandInGLUH": croparea as returned by calcCroparea, i.e. +#' LandInG harmonised against LUH and calibrated +#' to LanduseInitialisation cropland #' "ostberg2023": croparea according to LandInG data harmonization -#' by Ostberg et al. (2023) -#' "FAOfallow": fallow land according to FAOSTAT +#' by Ostberg et al. (2023), uncorrected +#' "FAOfallow": fallow land according to FAOSTAT #' @param detail TRUE: data provided for different crop types, FALSE: aggregated data #' #' @return magpie object @@ -18,9 +21,9 @@ #' @importFrom magclass getNames #' -calcValidCroparea <- function(datasource = "FAO", detail = FALSE) { +calcValidCroparea <- function(datasource = "MadratLandInGLUH", detail = FALSE) { - if (datasource == "FAO") { + if (datasource == "MadratLandInGLUH") { data <- calcOutput("Croparea", sectoral = "kcr", physical = TRUE, aggregate = FALSE) out <- reporthelper(x = data, dim = 3.1, level_zero_name = "Resources|Land Cover|Cropland|Croparea", @@ -32,12 +35,14 @@ calcValidCroparea <- function(datasource = "FAO", detail = FALSE) { out <- add_dimension(out, dim = 3.2, add = "model", nm = datasource) } else if (datasource == "ostberg2023") { + # read in uncorrected/raw data from LandInG toolbox by Sebastian Ostberg + # based on FAO-LUH2v2 data <- calcOutput("CropareaLandInG", aggregate = FALSE) croparea <- reporthelper(x = data, dim = 3.1, level_zero_name = "Resources|Land Cover|Cropland|Croparea", detail = detail) croparea <- summationhelper(croparea, sep = "+") - fallow <- setNames(calcOutput("FallowLand", + fallow <- setNames(calcOutput("Fallow", aggregate = FALSE, cellular = FALSE), paste("Resources|Land Cover|Cropland|+|", diff --git a/R/calcValidCropareaDiversity.R b/R/calcValidCropareaDiversity.R index 5953d21..0bfbb01 100644 --- a/R/calcValidCropareaDiversity.R +++ b/R/calcValidCropareaDiversity.R @@ -19,9 +19,10 @@ calcValidCropareaDiversity <- function(index = "shannon", groupdiv = "agg1") { area <- readSource("LandInG", subtype = "harvestedArea") area <- area[, , c("pasture"), invert = TRUE] area <- collapseNames(area[, , "irrigated"]) + collapseNames(area[, , "rainfed"]) - fallow <- calcOutput("FallowLand", aggregate = FALSE, cellular = TRUE) + fallow <- calcOutput("Fallow", aggregate = FALSE, cellular = TRUE) fallow <- setNames(fallow, "fallow") - area <- mbind(area, fallow) + combinedYears <- intersect(getYears(fallow), getYears(area)) + area <- mbind(area[, combinedYears, ], fallow[, combinedYears, ]) land <- dimSums(area, dim = 3) @@ -89,26 +90,26 @@ calcValidCropareaDiversity <- function(index = "shannon", groupdiv = "agg1") { ) } else if (groupdiv == "agg2") { mix <- c( - cellvalue["tece"], #c3 - cellvalue["maiz"] + cellvalue["trce"], #c4 - cellvalue["rice_pro"], #rice - cellvalue["puls_pro"] + cellvalue["soybean"] + cellvalue["groundnut"], #legumes - cellvalue["begr"] + cellvalue["sugr_cane"] + cellvalue["betr"] + cellvalue["oilpalm"], #plantations - cellvalue["potato"] + cellvalue["cassav_sp"] + cellvalue["sugr_beet"], #roots - cellvalue["rapeseed"] + cellvalue["sunflower"] + cellvalue["cottn_pro"], #non-legume oil crops - rep(cellvalue["fallow"] / 2, 2), #fallow - rep(cellvalue["foddr"] / 2, 2), #foddr - rep(cellvalue["others"] / 5, 5) #fruits vegetables nuts + cellvalue["tece"], # c3 + cellvalue["maiz"] + cellvalue["trce"], # c4 + cellvalue["rice_pro"], # rice + cellvalue["puls_pro"] + cellvalue["soybean"] + cellvalue["groundnut"], # legumes + cellvalue["begr"] + cellvalue["sugr_cane"] + cellvalue["betr"] + cellvalue["oilpalm"], # plantations + cellvalue["potato"] + cellvalue["cassav_sp"] + cellvalue["sugr_beet"], # roots + cellvalue["rapeseed"] + cellvalue["sunflower"] + cellvalue["cottn_pro"], # non-legume oil crops + rep(cellvalue["fallow"] / 2, 2), # fallow + rep(cellvalue["foddr"] / 2, 2), # foddr + rep(cellvalue["others"] / 5, 5) # fruits vegetables nuts ) } else if (groupdiv == "agg3") { mix <- c( - cellvalue["tece"] + cellvalue["maiz"] + cellvalue["trce"] + cellvalue["rice_pro"], #rice - cellvalue["puls_pro"] + cellvalue["soybean"] + cellvalue["groundnut"], #legumes - cellvalue["begr"] + cellvalue["sugr_cane"] + cellvalue["betr"] + cellvalue["oilpalm"], #plantations + cellvalue["tece"] + cellvalue["maiz"] + cellvalue["trce"] + cellvalue["rice_pro"], # rice + cellvalue["puls_pro"] + cellvalue["soybean"] + cellvalue["groundnut"], # legumes + cellvalue["begr"] + cellvalue["sugr_cane"] + cellvalue["betr"] + cellvalue["oilpalm"], # plantations cellvalue["potato"] + cellvalue["cassav_sp"] + cellvalue["sugr_beet"] + - cellvalue["rapeseed"] + cellvalue["sunflower"] + cellvalue["cottn_pro"] + cellvalue["foddr"], #other - cellvalue["others"], #fruits vegetables nuts - cellvalue["fallow"] #fallow + cellvalue["rapeseed"] + cellvalue["sunflower"] + cellvalue["cottn_pro"] + cellvalue["foddr"], # other + cellvalue["others"], # fruits vegetables nuts + cellvalue["fallow"] # fallow ) } else { mix <- cellvalue diff --git a/R/calcValidGridCroparea.R b/R/calcValidGridCroparea.R index d320e2b..db31f90 100644 --- a/R/calcValidGridCroparea.R +++ b/R/calcValidGridCroparea.R @@ -23,7 +23,8 @@ calcValidGridCroparea <- function(physical = TRUE) { descName <- "harvested area" } - out <- calcOutput("Croparea", cellular = TRUE, aggregate = FALSE, physical = physical, irrigation = TRUE) + out <- calcOutput("Croparea", cellular = TRUE, aggregate = FALSE, + physical = physical, irrigation = TRUE) getNames(out, dim = 1) <- reportingnames(getNames(out, dim = 1)) getNames(out, dim = 2) <- reportingnames(getNames(out, dim = 2)) out <- clean_magpie(out) diff --git a/R/calcValidGridYields.R b/R/calcValidGridYields.R index 2363a88..8bb2418 100644 --- a/R/calcValidGridYields.R +++ b/R/calcValidGridYields.R @@ -74,8 +74,8 @@ calcValidGridYields <- function(datasource = "downscaledFAO", future = NULL, phy refYear <- "y2010" out <- calcOutput("YieldsCalibrated", source = c(lpjml = lpjml, isimip = isimip), - climatetype = climatetype, refYear = refYear, cells = "magpiecell", - multicropping = physical, aggregate = FALSE)[, , findset("kcr")] + climatetype = climatetype, refYear = refYear, cells = "lpjcell", + multicropping = FALSE, aggregate = FALSE)[, , findset("kcr")] getNames(out, dim = 1) <- reportingnames(getNames(out, dim = 1)) getNames(out, dim = 2) <- reportingnames(getNames(out, dim = 2)) diff --git a/R/calcValidTau.R b/R/calcValidTau.R index 5dc34a4..447ef4a 100644 --- a/R/calcValidTau.R +++ b/R/calcValidTau.R @@ -2,9 +2,10 @@ #' #' @description Returns historical land use intensity estimates (tau). #' -#' @param datasource Currently available: \code{"FAO2012"} (original data set) -#' and \code{"FAOonline"} (projection of tau values from 1995 based on recent FAO yield -#' projections.) +#' @param datasource Currently available: \code{"FAO2012"} (original data set), +#' \code{"FAOonline"} (projection of tau values from 1995 based on recent FAO yield +#' projections) and \code{"MadratLandInGFAOLUH"} (projection from 1995 based on the +#' calcValidYield series, i.e. FAO production over LandInG croparea). #' @return tau time series #' @author Jan Philipp Dietrich @@ -44,8 +45,13 @@ calcValidTau <- function(datasource = "FAO2012") { out <- tauHist description <- "Historic Trends in Agricultural Land Use Intensity Tau based on FAO yield trends (updated)" sourceName <- "dietrich_et_al_2012_updated" - } else if (datasource == "FAOValidYields") { - cropYields <- calcOutput("ValidYield", aggregate = FALSE)[, , "historical.FAO.Productivity|Yield|+|Crops (t DM/ha)"] + } else if (datasource == "MadratLandInGFAOLUH") { + # the model name is stamped onto the series by calcValidYield, so ask for the + # datasource explicitly and build the subscript from the same string + yieldSource <- "MadratLandInGFAOLUH" + cropYields <- calcOutput("ValidYield", datasource = yieldSource, aggregate = FALSE) + cropYields <- cropYields[, , paste0("historical.", yieldSource, + ".Productivity|Yield|+|Crops (t DM/ha)")] yieldIndex <- collapseDim(cropYields / cropYields[, 1995, ]) # average growth rates of more than 20% per year are assumed to be incorrect @@ -58,8 +64,9 @@ calcValidTau <- function(datasource = "FAO2012") { weight[is.na(tauHist)] <- 0 tauHist[is.na(tauHist)] <- 0 out <- tauHist - description <- "Trends in Agricultural Land Use Intensity Tau based on FAO yield trends from calcValidYield" - sourceName <- "yield validation FAO" + description <- paste("Trends in Agricultural Land Use Intensity Tau based on the", + "calcValidYield series, i.e. FAO production over LandInG croparea") + sourceName <- "yield validation MadratLandInGFAOLUH" } else { stop("Unknown datasource chosen in calcValidTau!") } diff --git a/R/calcValidTauPastr.R b/R/calcValidTauPastr.R deleted file mode 100644 index d840f33..0000000 --- a/R/calcValidTauPastr.R +++ /dev/null @@ -1,86 +0,0 @@ -#' @title ValidTauPastr -#' @description Calculates managed pastures Tau based on FAO yield trends for 1995. -#' -#' @return List of magpie objects with results on country level, weight on country level, unit and description. -#' @author Marcos Alves -#' @examples -#' \dontrun{ -#' calcOutput("ValidTauPastr") -#' } -#' -calcValidTauPastr <- function() { - past <- findset("past") - # Production - prod <- calcOutput("GrasslandBiomass", aggregate = FALSE)[, past, "pastr"] - prod <- toolCountryFill(prod, fill = 0) - - # pasture areas - luh <- calcOutput("LUH3", landuseTypes = "LUH3", cellular = FALSE, aggregate = FALSE) - area <- luh[, past, "pastr"] - area <- toolCountryFill(area, fill = 0) - - # Adding 'otherland' as an extra source of grass biomass comparable - # to managed pastures in India, Pakistan and Bangladesh. - otherland <- luh[, past, c("secdn", "primn")] - area["IND", , "pastr"] <- - area["IND", , "pastr"] + - setNames(dimSums(otherland["IND", , ], dim = 3), "pastr") - area["BGD", , "pastr"] <- - area["BGD", , "pastr"] + - setNames(dimSums(otherland["BGD", , ], dim = 3), "pastr") - area["PAK", , "pastr"] <- - area["PAK", , "pastr"] + - setNames(dimSums(otherland["PAK", , ], dim = 3), "pastr") - - # Actual yields - yact <- prod[, past, ] / area[, past, ] - yact[is.nan(yact) | is.infinite(yact)] <- 0 - - # reference yields - yref <- calcOutput("GrasslandsYields", - lpjml = "lpjml5p2_pasture", - climatetype = "MRI-ESM2-0:ssp245", - subtype = "/co2/Nreturn0p5", # nolint: absolute_path_linter. - lsu_levels = c(seq(0, 2.2, 0.2), 2.5), past_mngmt = "mdef", - aggregate = FALSE)[, past, "pastr.rainfed"] - - yrefWeights <- calcOutput("LUH3", landuseTypes = "LUH3", cellular = TRUE, - aggregate = FALSE)[, past, "pastr"] - cell2iso <- data.frame(cell = getItems(yref, 1, full = TRUE), - iso = getItems(yref, if (dimExists("iso", yref)) "iso" else 1.1, full = TRUE)) - yref <- toolAggregate(yref, rel = cell2iso, from = "cell", to = "iso", weight = yrefWeights + 10^(-10)) - yref <- toolCountryFill(yref, fill = 0) - - # tau calculation - t <- yact[, past, ] / yref[, past, ] - t[is.nan(t) | is.infinite(t)] <- 0 - t <- collapseNames(t) - - # replacing unrealistic high tau values by regional averages - regMap <- toolGetMapping("regionmappingH12.csv", type = "regional", where = "madrat") - tReg <- toolAggregate(t, rel = regMap, weight = area, from = "CountryCode", to = "RegionCode") - regions <- regMap$RegionCode - names(regions) <- regMap[, "CountryCode"] - - largeTC <- where(t >= 10)$true$individual # tau threshold - colnames(largeTC)[1] <- "country" - largeTC <- as.data.frame(largeTC) - - for (i in as.vector(largeTC[, "country"])) { - for (j in as.vector(largeTC[largeTC$country == i, "year"])) { - t[i, j, ] <- tReg[regions[i], j, ] - } - } - - names(dimnames(t))[3] <- "scenario.model.variable" - getNames(t) <- - "historical.MAgPIEOwn.Productivity|Landuse Intensity Indicator Tau managed pastures (Index)" # nolint - - return(list( - x = t, - weight = yref * area, # Xref - unit = "-", - description = - "Historic Trends in managed pastures Land Use Intensity Tau based on FAO yield trends" # nolint - )) -} diff --git a/R/calcValidYield.R b/R/calcValidYield.R index 23df947..1fb3a3f 100644 --- a/R/calcValidYield.R +++ b/R/calcValidYield.R @@ -7,7 +7,7 @@ #' Returns yield as calculated from area area and production. #' #' @param datasource Specify which datasource needs to be used. -#' Currently only "FAO" and "calibratedLPJmL" is available. +#' Currently only "MadratLandInGFAOLUH" and "calibratedLPJmL" is available. #' @param future if NULL no future values are returned (default). #' specify climate scenario (gcm:rcp), if future is needed #' @param physical if true (default) physical area (croparea) used for yield calculation; @@ -28,7 +28,8 @@ #' @importFrom magclass getNames<- as.magpie #' @importFrom magpiesets reporthelper summationhelper findset -calcValidYield <- function(datasource = "FAO", faoVersion = "join2010", future = NULL, physical = TRUE) { +calcValidYield <- function(datasource = "MadratLandInGFAOLUH", faoVersion = "join2010", + future = NULL, physical = TRUE) { if (physical) { indicatorName <- "Productivity|Yield" @@ -38,9 +39,9 @@ calcValidYield <- function(datasource = "FAO", faoVersion = "join2010", future descName <- "harvested area" } - if (datasource == "FAO") { + if (datasource == "MadratLandInGFAOLUH") { - if (!is.null(future)) stop("Future options is not available for source type 'FAO'.") + if (!is.null(future)) stop("Future options are not available for source type 'MadratLandInGFAOLUH'.") # Calculate areas of individual crops and pasture croparea <- collapseNames(calcOutput("Croparea", sectoral = "kcr", @@ -121,89 +122,6 @@ calcValidYield <- function(datasource = "FAO", faoVersion = "join2010", future scenario <- "historical" description <- paste("FAO massbalance production divided by", descName, " from FAO.") - } else if (datasource == "Ostberg2023_FAO_LUH2v2") { - - if (!is.null(future)) stop("Future options is not available for source type 'FAO'.") - - # Calculate areas of individual crops and pasture - croparea <- calcOutput("CropareaLandInG", aggregate = FALSE, physical = physical) - pastarea <- setNames(calcOutput("LanduseInitialisation", aggregate = FALSE)[, , "past"], - "pasture") - - cyears <- intersect(getYears(croparea), getYears(pastarea)) - area <- mbind(croparea[, cyears, ], pastarea[, cyears, ]) - area <- summationhelper(reporthelper(area, - level_zero_name = indicatorName), - sep = NULL) - - # Calculate production - if (faoVersion == "join2010") { - histproduction <- collapseNames(calcOutput("FAOmassbalance", aggregate = FALSE)) - } else if (faoVersion == "FAOpre2010") { - histproduction <- collapseNames(calcOutput("FAOmassbalance", version = "pre2010", aggregate = FALSE)) - } else if (faoVersion == "FAOpost2010") { - histproduction <- collapseNames(calcOutput("FAOmassbalance", version = "post2010", aggregate = FALSE)) - } - - # extract DryMatter(dm) from production data - # Extract Production from subsetted production data containing only DryMatter(dm) - histproduction <- collapseNames(histproduction[, , "dm"][, , "production"]) - - # Figure out which commodities are common and make sure that production and area has same commodity names - kcr <- findset("kcr") - cropproduction <- histproduction[, , kcr] - pastproduction <- histproduction[, , "pasture"] - production <- mbind(cropproduction, pastproduction) - - # Calculate Yields - production <- summationhelper(reporthelper(production, - level_zero_name = indicatorName), - sep = NULL) - cyears <- intersect(getYears(production), getYears(area)) - yield <- production[, cyears, ] / area[, cyears, ] - - # Check for NaN values - indexNaN <- which(is.nan(yield)) - # Change NaN to 0 - yield[is.nan(yield)] <- 0 - if (length(indexNaN) > 0) { - vcat(verbosity = 2, "NaN values were found in the calculated yields ---> NaN values set to 0") - } else if (length(indexNaN) == 0) { - vcat(verbosity = 2, paste0("No NaN values detected in calculated yields. ", - "Yields for area reported as 0 are converted to 0.")) - } - - # Check for infinite values - Production reported but on 0 area - infindex <- which(is.infinite(yield)) # Lots of inf values. Being too diplomatic FAO aren't we!! - # Change inf to 0 - yield[is.infinite(yield)] <- 0 - if (length(infindex) > 0) { - vcat(verbosity = 2, "inf values were found in the calculated yields ---> inf values set to 0") - } else if (length(infindex) == 0) { - vcat(verbosity = 2, "No inf values found in the calculated yields") - } - - ## Additional checks required because we are reporting insanely high yields - ## Check which(yield>200,arr.ind = TRUE) - ## looks like Vatican are the best producers of oil - - ## We decided to set these outliers to 0 - # look for the Region names which are outliers - region <- rownames(which(yield > 200, arr.ind = TRUE)) - # look for the Years where reporting is flawed - year <- which(yield > 200, arr.ind = TRUE)[, 2] - # look for the scenario.model.Variable where reporting is flawed - variable <- which(yield > 200, arr.ind = TRUE)[, 3] - - ## Now do the operation of our magpie object - yield[region, year, variable] <- 0 - vcat(verbosity = 2, paste0("Yields>200 ton/ha were converted to 0 ", - "when area and production values were ambiguous")) - - scenario <- "historical" - description <- paste("FAO massbalance production divided by", descName, - " from Ostberg et al 2023 (excluding fallow land)") - } else if (datasource == "calibratedLPJmL") { irrigation <- FALSE # can be made function argument if needed diff --git a/R/fullENGAGE.R b/R/fullENGAGE.R index 2b680bd..ef37174 100644 --- a/R/fullENGAGE.R +++ b/R/fullENGAGE.R @@ -29,7 +29,7 @@ fullENGAGE <- function() { x <- convertENGAGE(x) out <- mbind(out, x) - x <- calcOutput(type = "ValidYield", datasource = "FAO", aggregate = "REG+GLO") + x <- calcOutput(type = "ValidYield", datasource = "MadratLandInGFAOLUH", aggregate = "REG+GLO") x <- convertENGAGE(x) out <- mbind(out, x) diff --git a/R/fullVALIDATION.R b/R/fullVALIDATION.R index 709df1f..d1d7bbd 100644 --- a/R/fullVALIDATION.R +++ b/R/fullVALIDATION.R @@ -150,7 +150,7 @@ fullVALIDATION <- function(rev = 0.1, aggregate = "region+global") { # Resources: # Croparea - calcOutput(type = "ValidCroparea", datasource = "FAO", aggregate = aggregate, + calcOutput(type = "ValidCroparea", datasource = "MadratLandInGLUH", aggregate = aggregate, file = valfile, append = TRUE, detail = TRUE, try = TRUE) # ready calcOutput(type = "ValidCroparea", datasource = "ostberg2023", aggregate = aggregate, file = valfile, append = TRUE, detail = TRUE, try = TRUE) # ready @@ -304,7 +304,7 @@ fullVALIDATION <- function(rev = 0.1, aggregate = "region+global") { file = valfile, append = TRUE, try = TRUE) # ready # Yield - for (datasource in c("FAO", "Ostberg2023_FAO_LUH2v2")) { + for (datasource in c("MadratLandInGFAOLUH")) { for (faoVersion in c("join2010", "FAOpre2010", "FAOpost2010")) { for (physical in c(TRUE, FALSE)) { calcOutput(type = "ValidYield", datasource = datasource, physical = physical, @@ -317,7 +317,6 @@ fullVALIDATION <- function(rev = 0.1, aggregate = "region+global") { # Productivity calcOutput(type = "ValidTau", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) - calcOutput(type = "ValidTauPastr", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) calcOutput(type = "ValidLSUdensity", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) calcOutput(type = "ValidAgriResearchIntensity", aggregate = aggregate, datasource = "Pardey", file = valfile, append = TRUE, try = TRUE) diff --git a/README.md b/README.md index 2879d96..47fa6f1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # madrat data preparation for validation purposes -R package **mrvalidation**, version **2.70.0** +R package **mrvalidation**, version **2.71.0** [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.4317826.svg)](https://doi.org/10.5281/zenodo.4317826) [![R build status](https://github.com/pik-piam/mrvalidation/workflows/check/badge.svg)](https://github.com/pik-piam/mrvalidation/actions) [![codecov](https://codecov.io/gh/pik-piam/mrvalidation/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/mrvalidation) [![r-universe](https://pik-piam.r-universe.dev/badges/mrvalidation)](https://pik-piam.r-universe.dev/builds) @@ -39,7 +39,7 @@ In case of questions / problems please contact Benjamin Leon Bodirsky , Version: 2.70.0, . +Bodirsky B, Wirth S, Karstens K, Humpenoeder F, Stevanovic M, Mishra A, Biewald A, Weindl I, Beier F, Chen D, Crawford M, Leip D, Molina Bacca E, Kreidenweis U, W. Yalew A, von Jeetze P, Wang X, Dietrich J, Alves M (2026). "mrvalidation: madrat data preparation for validation purposes." doi:10.5281/zenodo.4317826 , Version: 2.71.0, . A BibTeX entry for LaTeX users is @@ -48,9 +48,9 @@ A BibTeX entry for LaTeX users is title = {mrvalidation: madrat data preparation for validation purposes}, author = {Benjamin Leon Bodirsky and Stephen Wirth and Kristine Karstens and Florian Humpenoeder and Mishko Stevanovic and Abhijeet Mishra and Anne Biewald and Isabelle Weindl and Felicitas Beier and David Chen and Michael Crawford and Debbora Leip and Edna {Molina Bacca} and Ulrich Kreidenweis and Amsalu {W. Yalew} and Patrick {von Jeetze} and Xiaoxi Wang and Jan Philipp Dietrich and Marcos Alves}, doi = {10.5281/zenodo.4317826}, - date = {2026-07-27}, + date = {2026-08-10}, year = {2026}, url = {https://github.com/pik-piam/mrvalidation}, - note = {Version: 2.70.0}, + note = {Version: 2.71.0}, } ``` diff --git a/man/calcValidCroparea.Rd b/man/calcValidCroparea.Rd index 3d57d2f..af52f7a 100644 --- a/man/calcValidCroparea.Rd +++ b/man/calcValidCroparea.Rd @@ -4,13 +4,15 @@ \alias{calcValidCroparea} \title{calcValidCroparea} \usage{ -calcValidCroparea(datasource = "FAO", detail = FALSE) +calcValidCroparea(datasource = "MadratLandInGLUH", detail = FALSE) } \arguments{ -\item{datasource}{"FAO": croparea according to FAOSTAT, +\item{datasource}{"MadratLandInGLUH": croparea as returned by calcCroparea, i.e. + LandInG harmonised against LUH and calibrated + to LanduseInitialisation cropland "ostberg2023": croparea according to LandInG data harmonization - by Ostberg et al. (2023) - "FAOfallow": fallow land according to FAOSTAT} + by Ostberg et al. (2023), uncorrected +"FAOfallow": fallow land according to FAOSTAT} \item{detail}{TRUE: data provided for different crop types, FALSE: aggregated data} } @@ -18,9 +20,10 @@ calcValidCroparea(datasource = "FAO", detail = FALSE) magpie object } \description{ -Returns historical areas of individual crops. These are derived by -correcting harvested areas to match to physical cropland areas. Both these -datasets are from FAO. Output is meant to be used for model validation. +Returns historical areas of individual crops, meant to be used for +model validation. The default source is the madrat croparea preprocessing, which +harmonises LandInG against LUH and calibrates it to LanduseInitialisation cropland; +it is no longer FAOSTAT, so the series is labelled accordingly rather than as "FAO". Ostberg2023 is a slightly modified version of https://gmd.copernicus.org/articles/16/3375/2023/gmd-16-3375-2023-assets.html } diff --git a/man/calcValidTau.Rd b/man/calcValidTau.Rd index fde4ae0..5258c21 100644 --- a/man/calcValidTau.Rd +++ b/man/calcValidTau.Rd @@ -7,9 +7,10 @@ calcValidTau(datasource = "FAO2012") } \arguments{ -\item{datasource}{Currently available: \code{"FAO2012"} (original data set) -and \code{"FAOonline"} (projection of tau values from 1995 based on recent FAO yield -projections.)} +\item{datasource}{Currently available: \code{"FAO2012"} (original data set), +\code{"FAOonline"} (projection of tau values from 1995 based on recent FAO yield +projections) and \code{"MadratLandInGFAOLUH"} (projection from 1995 based on the +calcValidYield series, i.e. FAO production over LandInG croparea).} } \value{ tau time series diff --git a/man/calcValidTauPastr.Rd b/man/calcValidTauPastr.Rd deleted file mode 100644 index a146f62..0000000 --- a/man/calcValidTauPastr.Rd +++ /dev/null @@ -1,23 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/calcValidTauPastr.R -\name{calcValidTauPastr} -\alias{calcValidTauPastr} -\title{ValidTauPastr} -\usage{ -calcValidTauPastr() -} -\value{ -List of magpie objects with results on country level, weight on country level, unit and description. -} -\description{ -Calculates managed pastures Tau based on FAO yield trends for 1995. -} -\examples{ -\dontrun{ -calcOutput("ValidTauPastr") -} - -} -\author{ -Marcos Alves -} diff --git a/man/calcValidYield.Rd b/man/calcValidYield.Rd index 04df5fd..317fd8c 100644 --- a/man/calcValidYield.Rd +++ b/man/calcValidYield.Rd @@ -5,7 +5,7 @@ \title{calcValidYield} \usage{ calcValidYield( - datasource = "FAO", + datasource = "MadratLandInGFAOLUH", faoVersion = "join2010", future = NULL, physical = TRUE @@ -13,7 +13,7 @@ calcValidYield( } \arguments{ \item{datasource}{Specify which datasource needs to be used. -Currently only "FAO" and "calibratedLPJmL" is available.} +Currently only "MadratLandInGFAOLUH" and "calibratedLPJmL" is available.} \item{faoVersion}{which FAO version to use (pre, post or joined 2010 data)}