From 1eeb27c6955125c5e56d52f221ddb700efc200a3 Mon Sep 17 00:00:00 2001 From: Patrick Rein Date: Thu, 20 Nov 2025 13:12:51 +0100 Subject: [PATCH 1/2] Makes the aggregation level in fullVALIDATION an argument --- R/fullVALIDATION.R | 254 ++++++++++++++++++++++----------------------- 1 file changed, 127 insertions(+), 127 deletions(-) diff --git a/R/fullVALIDATION.R b/R/fullVALIDATION.R index dcbaca3..2a5d9cb 100644 --- a/R/fullVALIDATION.R +++ b/R/fullVALIDATION.R @@ -12,7 +12,7 @@ #' retrieveData("Validation") #' } #' -fullVALIDATION <- function(rev = 0.1) { +fullVALIDATION <- function(rev = 0.1, aggregate = "region+global") { if (rev < numeric_version("4.66")) { stop("mrvalidation(>= 2.34.0) does not support revision below 4.66 anymore. ", @@ -25,107 +25,107 @@ fullVALIDATION <- function(rev = 0.1) { # Population and Income - calcOutput(type = "ValidPopulation", aggregate = "REG+GLO", file = valfile, + calcOutput(type = "ValidPopulation", aggregate = aggregate, file = valfile, append = FALSE, warnNA = FALSE, try = TRUE) # ready calcOutput(type = "ValidIncome", datasource = "WDI_SSPs", - aggregate = "REG+GLO", file = valfile, append = TRUE, try = TRUE) - calcOutput(type = "ValidAgFFGDP", datasource = "WDI", aggregate = "REG+GLO", + aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) + calcOutput(type = "ValidAgFFGDP", datasource = "WDI", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) - calcOutput(type = "ValidAgGDP", datasource = "FAO", aggregate = "REG+GLO", + calcOutput(type = "ValidAgGDP", datasource = "FAO", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) calcOutput(type = "ValidAgGDP", datasource = "FAO_consum", aggregate = FALSE, file = valfile, append = TRUE, try = TRUE) - calcOutput(type = "ValidConsumptionValue", datasource = "FAO", aggregate = "REG+GLO", + calcOutput(type = "ValidConsumptionValue", datasource = "FAO", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) - calcOutput(type = "ValidAgEmployment", datasource = "ILO", dataVersionILO = "Aug24", aggregate = "REG+GLO", + calcOutput(type = "ValidAgEmployment", datasource = "ILO", dataVersionILO = "Aug24", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) - calcOutput(type = "ValidAgEmployment", datasource = "ILO_FAO", dataVersionILO = "Aug24", aggregate = "REG+GLO", + calcOutput(type = "ValidAgEmployment", datasource = "ILO_FAO", dataVersionILO = "Aug24", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) calcOutput(type = "ValidHourlyLaborCosts", datasource = "ILO_completed", dataVersionILO = "Aug24", - aggregate = "REG+GLO", file = valfile, append = TRUE, try = TRUE) + aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) calcOutput(type = "ValidHourlyLaborCosts", datasource = "USDA_FAO_completed", dataVersionILO = "Aug24", - aggregate = "REG+GLO", file = valfile, append = TRUE, try = TRUE) + aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) calcOutput(type = "ValidWageDevelopment", datasource = "ILO_completed", dataVersionILO = "Aug24", baseYear = 2000, - aggregate = "REG+GLO", file = valfile, append = TRUE, try = TRUE) + aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) calcOutput(type = "ValidWageDevelopment", datasource = "ILO_completed", dataVersionILO = "Aug24", baseYear = 2010, - aggregate = "REG+GLO", file = valfile, append = TRUE, try = TRUE) + aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) calcOutput(type = "ValidWageDevelopment", datasource = "USDA_FAO_completed", dataVersionILO = "Aug24", - baseYear = 2000, aggregate = "REG+GLO", file = valfile, append = TRUE, try = TRUE) + baseYear = 2000, aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) calcOutput(type = "ValidWageDevelopment", datasource = "USDA_FAO_completed", dataVersionILO = "Aug24", - baseYear = 2010, aggregate = "REG+GLO", file = valfile, append = TRUE, try = TRUE) - calcOutput(type = "ValidGini", aggregate = "REG+GLO", + baseYear = 2010, aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) + calcOutput(type = "ValidGini", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) - calcOutput(type = "ValidPovertyLine", aggregate = "REG+GLO", + calcOutput(type = "ValidPovertyLine", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) # Food Demand - calcOutput(type = "ValidKcal", datasource = "FAO", aggregate = "REG+GLO", + calcOutput(type = "ValidKcal", datasource = "FAO", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) # ready - calcOutput(type = "ValidKcal", datasource = "FAOmassbalance", aggregate = "REG+GLO", + calcOutput(type = "ValidKcal", datasource = "FAOmassbalance", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) # ready - calcOutput(type = "ValidKcal", datasource = "FAOmassbalancepre2010", aggregate = "REG+GLO", + calcOutput(type = "ValidKcal", datasource = "FAOmassbalancepre2010", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) # ready - calcOutput(type = "ValidKcal", datasource = "FAOmassbalancepost2010", aggregate = "REG+GLO", + calcOutput(type = "ValidKcal", datasource = "FAOmassbalancepost2010", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) # ready - calcOutput(type = "ValidLivestockShare", aggregate = "REG+GLO", file = valfile, + calcOutput(type = "ValidLivestockShare", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) # ready - calcOutput(type = "ValidVegfruitShare", aggregate = "REG+GLO", file = valfile, + calcOutput(type = "ValidVegfruitShare", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) # ready - calcOutput(type = "ValidLivestockDemStructure", aggregate = "REG+GLO", + calcOutput(type = "ValidLivestockDemStructure", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) # ready - calcOutput(type = "ValidFoodExpenditureShare", aggregate = "REG+GLO", + calcOutput(type = "ValidFoodExpenditureShare", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) - calcOutput(type = "ValidFoodExpenditure", aggregate = "REG+GLO", + calcOutput(type = "ValidFoodExpenditure", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) - calcOutput(type = "ValidFoodExpenditure", aggregate = "REG+GLO", + calcOutput(type = "ValidFoodExpenditure", aggregate = aggregate, datasource = "FAOpre2010", file = valfile, append = TRUE, try = TRUE) - calcOutput(type = "ValidFoodExpenditure", aggregate = "REG+GLO", + calcOutput(type = "ValidFoodExpenditure", aggregate = aggregate, datasource = "FAOpost2010", file = valfile, append = TRUE, try = TRUE) # Demand, Production, Trade, Self-Sufficiency - calcOutput(type = "ValidDemand", aggregate = "REG+GLO", file = valfile, + calcOutput(type = "ValidDemand", aggregate = aggregate, file = valfile, append = TRUE, detail = TRUE, try = TRUE) # ready - calcOutput(type = "ValidDemand", aggregate = "REG+GLO", file = valfile, + calcOutput(type = "ValidDemand", aggregate = aggregate, file = valfile, append = TRUE, datasource = "FAOpre2010", detail = TRUE, try = TRUE) # ready - calcOutput(type = "ValidDemand", aggregate = "REG+GLO", file = valfile, + calcOutput(type = "ValidDemand", aggregate = aggregate, file = valfile, append = TRUE, datasource = "FAOpre2010", detail = TRUE, try = TRUE) # ready - calcOutput(type = "ValidDemandBioenergy", aggregate = "REG+GLO", file = valfile, + calcOutput(type = "ValidDemandBioenergy", aggregate = aggregate, file = valfile, append = TRUE, warnNA = FALSE, try = TRUE) # ready - calcOutput(type = "ValidProduction", aggregate = "REG+GLO", file = valfile, + calcOutput(type = "ValidProduction", aggregate = aggregate, file = valfile, append = TRUE, detail = TRUE, try = TRUE) # ready - calcOutput(type = "ValidProduction", aggregate = "REG+GLO", file = valfile, + calcOutput(type = "ValidProduction", aggregate = aggregate, file = valfile, datasource = "FAOpre2010", append = TRUE, detail = TRUE, try = TRUE) # ready - calcOutput(type = "ValidProduction", aggregate = "REG+GLO", file = valfile, + calcOutput(type = "ValidProduction", aggregate = aggregate, file = valfile, datasource = "FAOpost2010", append = TRUE, detail = TRUE, try = TRUE) # ready - calcOutput(type = "ValidTrade", aggregate = "REG+GLO", file = valfile, + calcOutput(type = "ValidTrade", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) # ready - calcOutput(type = "ValidTrade", aggregate = "REG+GLO", file = valfile, + calcOutput(type = "ValidTrade", aggregate = aggregate, file = valfile, append = TRUE, net_trade = FALSE, equalized = FALSE, try = TRUE) # ready - calcOutput(type = "ValidTrade", aggregate = "REG+GLO", file = valfile, + calcOutput(type = "ValidTrade", aggregate = aggregate, file = valfile, datasource = "FAOpre2010", append = TRUE, net_trade = FALSE, equalized = FALSE, try = TRUE) # ready - calcOutput(type = "ValidTrade", aggregate = "REG+GLO", file = valfile, + calcOutput(type = "ValidTrade", aggregate = aggregate, file = valfile, datasource = "FAOpost2010", append = TRUE, net_trade = FALSE, equalized = FALSE, try = TRUE) # ready - calcOutput(type = "ValidTrade", aggregate = "REG+GLO", + calcOutput(type = "ValidTrade", aggregate = aggregate, datasource = "FAOBilateral", file = valfile, append = TRUE, try = TRUE) # ready - calcOutput(type = "ValidTrade", aggregate = "REG+GLO", + calcOutput(type = "ValidTrade", aggregate = aggregate, datasource = "FAOBilateral", file = valfile, append = TRUE, net_trade = FALSE, equalized = FALSE, try = TRUE) # ready - calcOutput(type = "ValidSelfsuff", aggregate = "REG+GLO", file = valfile, + calcOutput(type = "ValidSelfsuff", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) # ready - calcOutput(type = "ValidSelfsuff", aggregate = "REG+GLO", file = valfile, + calcOutput(type = "ValidSelfsuff", aggregate = aggregate, file = valfile, datasource = "FAOpre2010", append = TRUE, try = TRUE) # ready - calcOutput(type = "ValidSelfsuff", aggregate = "REG+GLO", file = valfile, + calcOutput(type = "ValidSelfsuff", aggregate = aggregate, file = valfile, datasource = "FAOpost2010", append = TRUE, try = TRUE) # ready - calcOutput(type = "ValidFeed", datasource = "FAO", aggregate = "REG+GLO", + calcOutput(type = "ValidFeed", datasource = "FAO", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) # ready - calcOutput(type = "ValidFeed", datasource = "FAOpre2010", aggregate = "REG+GLO", + calcOutput(type = "ValidFeed", datasource = "FAOpre2010", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) # ready - calcOutput(type = "ValidFeed", datasource = "FAOpost2010", aggregate = "REG+GLO", + calcOutput(type = "ValidFeed", datasource = "FAOpost2010", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) # ready calcOutput(type = "ValidProcessing", datasource = "FAO", nutrient = "dm", detail = TRUE, indicator = "primary_to_process", file = valfile, append = TRUE, try = TRUE) @@ -139,43 +139,43 @@ fullVALIDATION <- function(rev = 0.1) { indicator = "secondary_from_primary", file = valfile, append = TRUE, try = TRUE) calcOutput(type = "ValidProcessing", datasource = "FAOpost2010", nutrient = "dm", detail = TRUE, indicator = "secondary_from_primary", file = valfile, append = TRUE, try = TRUE) - calcOutput(type = "ValidGrassLSUha", aggregate = "REG+GLO", datasource = "MAgPIEown", + calcOutput(type = "ValidGrassLSUha", aggregate = aggregate, datasource = "MAgPIEown", file = valfile, append = TRUE, try = TRUE) # Resources: # Croparea - calcOutput(type = "ValidCroparea", datasource = "FAO", aggregate = "REG+GLO", + calcOutput(type = "ValidCroparea", datasource = "FAO", aggregate = aggregate, file = valfile, append = TRUE, detail = TRUE, try = TRUE) # ready - calcOutput(type = "ValidCroparea", datasource = "ostberg2023", aggregate = "REG+GLO", + calcOutput(type = "ValidCroparea", datasource = "ostberg2023", aggregate = aggregate, file = valfile, append = TRUE, detail = TRUE, try = TRUE) # ready - calcOutput(type = "ValidCroparea", datasource = "FAOfallow", aggregate = "REG+GLO", + calcOutput(type = "ValidCroparea", datasource = "FAOfallow", aggregate = aggregate, file = valfile, append = TRUE, detail = TRUE, try = TRUE) # ready # Land Cover - calcOutput(type = "ValidLand", datasource = "FAO_crop_past", aggregate = "REG+GLO", + calcOutput(type = "ValidLand", datasource = "FAO_crop_past", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) # ready - calcOutput(type = "ValidLand", datasource = "FRA2015", aggregate = "REG+GLO", + calcOutput(type = "ValidLand", datasource = "FRA2015", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) # ready - calcOutput(type = "ValidLand", datasource = "LUH3", aggregate = "REG+GLO", + calcOutput(type = "ValidLand", datasource = "LUH3", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) # ready - calcOutput(type = "ValidLand", datasource = "MAgPIEown", aggregate = "REG+GLO", + calcOutput(type = "ValidLand", datasource = "MAgPIEown", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) # ready - calcOutput(type = "ValidLand", datasource = "SSPResults", aggregate = "REG+GLO", + calcOutput(type = "ValidLand", datasource = "SSPResults", aggregate = aggregate, file = valfile, append = TRUE, warnNA = FALSE, try = TRUE) # ready - calcOutput(type = "ValidLand", datasource = "FRA2020", aggregate = "REG+GLO", + calcOutput(type = "ValidLand", datasource = "FRA2020", aggregate = aggregate, file = valfile, append = TRUE, warnNA = FALSE, try = TRUE) # ready # Land Cover Change - calcOutput(type = "ValidLandChange", datasource = "FAO_crop_past", aggregate = "REG+GLO", + calcOutput(type = "ValidLandChange", datasource = "FAO_crop_past", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) # ready - calcOutput(type = "ValidLandChange", datasource = "FRA2015", aggregate = "REG+GLO", + calcOutput(type = "ValidLandChange", datasource = "FRA2015", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) # ready - calcOutput(type = "ValidLandChange", datasource = "LUH3", aggregate = "REG+GLO", + calcOutput(type = "ValidLandChange", datasource = "LUH3", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) # ready - calcOutput(type = "ValidLandChange", datasource = "MAgPIEown", aggregate = "REG+GLO", + calcOutput(type = "ValidLandChange", datasource = "MAgPIEown", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) # ready calcOutput(type = "ValidLandChange", datasource = "SSPResults", baseyear = 2005, # 1995 not available as baseyear - aggregate = "REG+GLO", file = valfile, append = TRUE, warnNA = FALSE, try = TRUE) # ready + aggregate = aggregate, file = valfile, append = TRUE, warnNA = FALSE, try = TRUE) # ready # WaterUsage calcOutput(type = "ValidWaterUsage", datasource = "foley_2011", aggregate = FALSE, @@ -197,80 +197,80 @@ fullVALIDATION <- function(rev = 0.1) { calcOutput(type = "ValidWaterUsage", datasource = "shiklomanov", aggregate = FALSE, file = "validation.mif", append = TRUE, try = TRUE) - calcOutput(type = "ValidWaterUsage", datasource = "LPJmL:ipsl-cm5a-lr", aggregate = "REG+GLO", + calcOutput(type = "ValidWaterUsage", datasource = "LPJmL:ipsl-cm5a-lr", aggregate = aggregate, file = "validation.mif", append = TRUE, try = TRUE) - calcOutput(type = "ValidWaterUsage", datasource = "MATSIRO:ipsl-cm5a-lr", aggregate = "REG+GLO", + calcOutput(type = "ValidWaterUsage", datasource = "MATSIRO:ipsl-cm5a-lr", aggregate = aggregate, file = "validation.mif", append = TRUE, try = TRUE) - calcOutput(type = "ValidWaterUsage", datasource = "MPI-HM:ipsl-cm5a-lr", aggregate = "REG+GLO", + calcOutput(type = "ValidWaterUsage", datasource = "MPI-HM:ipsl-cm5a-lr", aggregate = aggregate, file = "validation.mif", append = TRUE, try = TRUE) # Area equipped for Irrigation - calcOutput(type = "ValidAEI", datasource = "LUH3", aggregate = "REG+GLO", + calcOutput(type = "ValidAEI", datasource = "LUH3", aggregate = aggregate, file = "validation.mif", append = TRUE, try = TRUE) - calcOutput(type = "ValidAEI", datasource = "Mehta2024_Siebert2013", aggregate = "REG+GLO", + calcOutput(type = "ValidAEI", datasource = "Mehta2024_Siebert2013", aggregate = aggregate, file = "validation.mif", append = TRUE, try = TRUE) - calcOutput(type = "ValidAEI", datasource = "HID", aggregate = "REG+GLO", + calcOutput(type = "ValidAEI", datasource = "HID", aggregate = aggregate, file = "validation.mif", append = TRUE, try = TRUE) - calcOutput(type = "ValidAEI", datasource = "GMIA", aggregate = "REG+GLO", + calcOutput(type = "ValidAEI", datasource = "GMIA", aggregate = aggregate, file = "validation.mif", append = TRUE, try = TRUE) # Area actually irrigated - calcOutput(type = "ValidAAI", datasource = "LUH3", aggregate = "REG+GLO", + calcOutput(type = "ValidAAI", datasource = "LUH3", aggregate = aggregate, file = "validation.mif", append = TRUE, try = TRUE) - calcOutput(type = "ValidAAI", datasource = "GMIA", aggregate = "REG+GLO", + calcOutput(type = "ValidAAI", datasource = "GMIA", aggregate = aggregate, file = "validation.mif", append = TRUE, try = TRUE) # Nitrogen - calcOutput(type = "ValidNitrogenBudgetCropland", datasource = "Bodirsky", aggregate = "REG+GLO", + calcOutput(type = "ValidNitrogenBudgetCropland", datasource = "Bodirsky", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) # ready - calcOutput(type = "ValidNitrogenBudgetCropland", datasource = "Lassaletta2014", aggregate = "REG+GLO", + calcOutput(type = "ValidNitrogenBudgetCropland", datasource = "Lassaletta2014", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) # ready - calcOutput(type = "ValidNitrogenBudgetCropland", datasource = "FAO", aggregate = "REG+GLO", + calcOutput(type = "ValidNitrogenBudgetCropland", datasource = "FAO", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) - calcOutput(type = "ValidNitrogenBudgetCropland", datasource = "ACCMIP", aggregate = "REG+GLO", + calcOutput(type = "ValidNitrogenBudgetCropland", datasource = "ACCMIP", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) - calcOutput(type = "ValidNitrogenBudgetPasture", aggregate = "REG+GLO", + calcOutput(type = "ValidNitrogenBudgetPasture", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) - calcOutput(type = "ValidNitrogenBudgetNonagland", aggregate = "REG+GLO", + calcOutput(type = "ValidNitrogenBudgetNonagland", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) - calcOutput(type = "ValidManure", datasource = "IPCC", aggregate = "REG+GLO", + calcOutput(type = "ValidManure", datasource = "IPCC", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) # ready - calcOutput(type = "ValidManure", datasource = "Bodirsky", aggregate = "REG+GLO", + calcOutput(type = "ValidManure", datasource = "Bodirsky", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) # ready - calcOutput(type = "ValidNitrogenSurplus", aggregate = "REG+GLO", + calcOutput(type = "ValidNitrogenSurplus", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) # Carbon - calcOutput("ValidResidues", aggregate = "REG+GLO", file = valfile, append = TRUE, try = TRUE) + calcOutput("ValidResidues", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) # Carbon Stocks - calcOutput("ValidCarbon", datasource = "LPJmL4_for_MAgPIE_44ac93de:GSWP3-W5E5:historical", aggregate = "REG+GLO", + calcOutput("ValidCarbon", datasource = "LPJmL4_for_MAgPIE_44ac93de:GSWP3-W5E5:historical", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) # Growing Stocks - calcOutput("ValidGS", datasource = "FAO", aggregate = "REG+GLO", indicator = "relative", + calcOutput("ValidGS", datasource = "FAO", aggregate = aggregate, indicator = "relative", file = valfile, append = TRUE, try = TRUE) - calcOutput("ValidGS", datasource = "FAO", aggregate = "REG+GLO", indicator = "absolute", + calcOutput("ValidGS", datasource = "FAO", aggregate = aggregate, indicator = "absolute", file = valfile, append = TRUE, try = TRUE) # GHG emissions - calcOutput(type = "ValidEmissions", datasource = "EDGAR_LU", aggregate = "REG+GLO", + calcOutput(type = "ValidEmissions", datasource = "EDGAR_LU", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) # ready - calcOutput(type = "ValidEmissions", datasource = "CEDS", aggregate = "REG+GLO", + calcOutput(type = "ValidEmissions", datasource = "CEDS", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) # ready - calcOutput(type = "ValidEmissions", datasource = "FAO_EmisLUC", aggregate = "REG+GLO", + calcOutput(type = "ValidEmissions", datasource = "FAO_EmisLUC", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE, warnNA = FALSE) # ready - calcOutput(type = "ValidEmissions", datasource = "FAO_EmisAg", aggregate = "REG+GLO", + calcOutput(type = "ValidEmissions", datasource = "FAO_EmisAg", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE, warnNA = FALSE) # ready - calcOutput(type = "ValidEmissions", datasource = "GFED", aggregate = "REG+GLO", + calcOutput(type = "ValidEmissions", datasource = "GFED", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) # ready - calcOutput(type = "ValidEmissions", datasource = "EDGAR6", aggregate = "REG+GLO", + calcOutput(type = "ValidEmissions", datasource = "EDGAR6", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) # ready - calcOutput(type = "ValidEmissions", datasource = "PRIMAPhist", aggregate = "REG+GLO", + calcOutput(type = "ValidEmissions", datasource = "PRIMAPhist", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) # ready - calcOutput(type = "ValidEmissions", datasource = "IPCC", aggregate = "REG+GLO", + calcOutput(type = "ValidEmissions", datasource = "IPCC", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) # ready - calcOutput(type = "ValidEmissions", datasource = "Nsurplus2", aggregate = "REG+GLO", + calcOutput(type = "ValidEmissions", datasource = "Nsurplus2", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) # ready calcOutput(type = "ValidAnnualCarbonLTS", datasource = "Lauk_et_al", aggregate = FALSE, file = valfile, append = TRUE, try = TRUE) # ready @@ -282,15 +282,15 @@ fullVALIDATION <- function(rev = 0.1) { file = valfile, append = TRUE, try = TRUE) # ready calcOutput(type = "ValidCumulativeCarbonLTS", datasource = "Johnston_Radeloff_P", aggregate = FALSE, file = valfile, append = TRUE, try = TRUE) # ready - calcOutput(type = "ValidEmisLucGasser", subtype = "bookkeeping", aggregate = "REG+GLO", + calcOutput(type = "ValidEmisLucGasser", subtype = "bookkeeping", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) # ready - calcOutput(type = "ValidEmissionsAFOLU", datasource = "FAO", aggregate = "REG+GLO", + calcOutput(type = "ValidEmissionsAFOLU", datasource = "FAO", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) # ready - calcOutput(type = "ValidEmissionsAFOLU", datasource = "FAO", aggregate = "REG+GLO", cumulative = TRUE, + calcOutput(type = "ValidEmissionsAFOLU", datasource = "FAO", aggregate = aggregate, cumulative = TRUE, file = valfile, append = TRUE, try = TRUE) # ready - calcOutput(type = "ValidEmissionsAFOLU", datasource = "EDGAR_LU", aggregate = "REG+GLO", + calcOutput(type = "ValidEmissionsAFOLU", datasource = "EDGAR_LU", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) # ready - calcOutput(type = "ValidEmissionsAFOLU", datasource = "EDGAR_LU", aggregate = "REG+GLO", cumulative = TRUE, + calcOutput(type = "ValidEmissionsAFOLU", datasource = "EDGAR_LU", aggregate = aggregate, cumulative = TRUE, file = valfile, append = TRUE, try = TRUE) # ready calcOutput(type = "ValidEmissionsPeatland", aggregate = FALSE, file = valfile, append = TRUE, try = TRUE) # ready @@ -304,7 +304,7 @@ fullVALIDATION <- function(rev = 0.1) { for (faoVersion in c("join2010", "FAOpre2010", "FAOpost2010")) { for (physical in c(TRUE, FALSE)) { calcOutput(type = "ValidYield", datasource = datasource, physical = physical, - faoVersion = faoVersion, aggregate = "REG+GLO", file = valfile, + faoVersion = faoVersion, aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) } @@ -312,12 +312,12 @@ fullVALIDATION <- function(rev = 0.1) { } # Productivity - calcOutput(type = "ValidTau", aggregate = "REG+GLO", file = valfile, append = TRUE, try = TRUE) - calcOutput(type = "ValidTauPastr", aggregate = "REG+GLO", file = valfile, append = TRUE, try = TRUE) - calcOutput(type = "ValidLSUdensity", aggregate = "REG+GLO", file = valfile, append = TRUE, try = TRUE) - calcOutput(type = "ValidAgriResearchIntensity", aggregate = "REG+GLO", datasource = "Pardey", + 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) - calcOutput(type = "ValidFeedConversion", aggregate = "REG+GLO", + calcOutput(type = "ValidFeedConversion", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) @@ -327,66 +327,66 @@ fullVALIDATION <- function(rev = 0.1) { file = valfile, append = TRUE, try = TRUE) calcOutput(type = "ValidPriceAgriculture", datasource = "IMPACT3.2.2World_Price", aggregate = FALSE, file = valfile, append = TRUE, try = TRUE) # ready - calcOutput(type = "ValidPriceAgriculture", datasource = "FAO", aggregate = "REG+GLO", + calcOutput(type = "ValidPriceAgriculture", datasource = "FAO", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) calcOutput(type = "ValidPriceAgriculture", datasource = "IniFoodPrice", aggregate = FALSE, file = valfile, append = TRUE, try = TRUE) - calcOutput(type = "ValidPriceBioenergy", aggregate = "REG+GLO", file = valfile, append = TRUE, + calcOutput(type = "ValidPriceBioenergy", aggregate = aggregate, file = valfile, append = TRUE, warnNA = FALSE, try = TRUE) # ready - calcOutput(type = "ValidPriceGHG", datasource = "SSPResults", aggregate = "REG+GLO", + calcOutput(type = "ValidPriceGHG", datasource = "SSPResults", aggregate = aggregate, file = valfile, append = TRUE, warnNA = FALSE, try = TRUE) # PriceIndex calcOutput(type = "ValidPriceIndex", datasource = "FAO", baseyear = "y2010", round = TRUE, - aggregate = "REG+GLO", file = valfile, append = TRUE, try = TRUE) + aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) # SDG - calcOutput(type = "ValidSDG1", datasource = "James", aggregate = "REG+GLO", + calcOutput(type = "ValidSDG1", datasource = "James", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) - calcOutput(type = "ValidSDG12", datasource = "FAO", aggregate = "REG+GLO", + calcOutput(type = "ValidSDG12", datasource = "FAO", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) # Forestry run specific - calcOutput(type = "ValidTimber", aggregate = "REG+GLO", file = valfile, append = TRUE, try = TRUE) # ready + calcOutput(type = "ValidTimber", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) # ready # Costs validation - calcOutput(type = "ValidCostsOverall", datasource = "FAO", aggregate = "REG+GLO", + calcOutput(type = "ValidCostsOverall", datasource = "FAO", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) # Overall costs. - calcOutput(type = "ValidCostsTransport", datasource = "GTAPtransport", aggregate = "REG+GLO", + calcOutput(type = "ValidCostsTransport", datasource = "GTAPtransport", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) - calcOutput(type = "ValidCostsTransport", datasource = "MAgPIEcalc", aggregate = "REG+GLO", + calcOutput(type = "ValidCostsTransport", datasource = "MAgPIEcalc", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) - calcOutput(type = "ValidCostsCapStocks", datasource = "FAO", aggregate = "REG+GLO", + calcOutput(type = "ValidCostsCapStocks", datasource = "FAO", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) - calcOutput(type = "ValidCostsFertilizer", datasource = "FAO", aggregate = "REG+GLO", + calcOutput(type = "ValidCostsFertilizer", datasource = "FAO", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) - calcOutput(type = "ValidCostsLabor", datasource = "Vittis", aggregate = "REG+GLO", + calcOutput(type = "ValidCostsLabor", datasource = "Vittis", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) - calcOutput(type = "ValidCostsTC", datasource = "Pardey", aggregate = "REG+GLO", + calcOutput(type = "ValidCostsTC", datasource = "Pardey", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) - calcOutput(type = "ValidCostsAEI", datasource = "IMPACT", aggregate = "REG+GLO", + calcOutput(type = "ValidCostsAEI", datasource = "IMPACT", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) - calcOutput(type = "ValidTotalLaborCosts", datasource = "ILO", dataVersionILO = "Aug24", aggregate = "REG+GLO", + calcOutput(type = "ValidTotalLaborCosts", datasource = "ILO", dataVersionILO = "Aug24", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) - calcOutput(type = "ValidTotalLaborCosts", datasource = "USDA", aggregate = "REG+GLO", + calcOutput(type = "ValidTotalLaborCosts", datasource = "USDA", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) - calcOutput(type = "ValidTotalLaborCosts", datasource = "GTAP", aggregate = "REG+GLO", + calcOutput(type = "ValidTotalLaborCosts", datasource = "GTAP", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) - calcOutput(type = "ValidCostsTransport", datasource = "GTAPwholesale", aggregate = "REG+GLO", + calcOutput(type = "ValidCostsTransport", datasource = "GTAPwholesale", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) - calcOutput(type = "ValidFactorReqShares", subtype = "crop", aggregate = "REG+GLO", + calcOutput(type = "ValidFactorReqShares", subtype = "crop", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) - calcOutput(type = "ValidFactorReqShares", subtype = "livestock", aggregate = "REG+GLO", + calcOutput(type = "ValidFactorReqShares", subtype = "livestock", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) # Diversity indices - calcOutput(type = "ValidBII", aggregate = "REG+GLO", + calcOutput(type = "ValidBII", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) - calcOutput(type = "ValidCropareaDiversity", index = "shannon", aggregate = "REG+GLO", + calcOutput(type = "ValidCropareaDiversity", index = "shannon", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) - calcOutput(type = "ValidCropareaDiversity", index = "invsimpson", aggregate = "REG+GLO", + calcOutput(type = "ValidCropareaDiversity", index = "invsimpson", aggregate = aggregate, file = valfile, append = TRUE, try = TRUE) # Global surface temperature From 88d351f338a480e538df885811b31c7a826cb443 Mon Sep 17 00:00:00 2001 From: Patrick Rein Date: Thu, 20 Nov 2025 14:07:14 +0100 Subject: [PATCH 2/2] buildLibrary, improves comment for aggregate parameter --- .buildlibrary | 2 +- CITATION.cff | 4 ++-- DESCRIPTION | 6 +++--- R/fullVALIDATION.R | 2 ++ README.md | 8 ++++---- man/fullVALIDATION.Rd | 5 ++++- 6 files changed, 16 insertions(+), 11 deletions(-) diff --git a/.buildlibrary b/.buildlibrary index d51bba4..15b09ef 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '53494200' +ValidationKey: '53887680' AutocreateReadme: yes AcceptedWarnings: - 'Warning: package .* was built under R version' diff --git a/CITATION.cff b/CITATION.cff index d915b68..67dda6a 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.63.0 -date-released: '2025-09-09' +version: 2.64.0 +date-released: '2025-11-20' abstract: Package contains routines to prepare data for validation exercises. authors: - family-names: Bodirsky diff --git a/DESCRIPTION b/DESCRIPTION index c095890..b164aff 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Type: Package Package: mrvalidation Title: madrat data preparation for validation purposes -Version: 2.63.0 -Date: 2025-09-09 +Version: 2.64.0 +Date: 2025-11-20 Authors@R: c( person("Benjamin Leon", "Bodirsky", , "bodirsky@pik-potsdam.de", role = c("aut", "cre")), person("Stephen", "Wirth", role = "aut"), @@ -61,4 +61,4 @@ Suggests: covr Encoding: UTF-8 LazyData: no -RoxygenNote: 7.3.2 +RoxygenNote: 7.3.3 diff --git a/R/fullVALIDATION.R b/R/fullVALIDATION.R index 2a5d9cb..952989a 100644 --- a/R/fullVALIDATION.R +++ b/R/fullVALIDATION.R @@ -4,6 +4,8 @@ #' #' @param rev data revision which should be used as input. Will be converted to #' \code{\link[base]{numeric_version}} when called via \code{\link[madrat]{retrieveData}}. +#' @param aggregate an aggregation level, such as "region+global", to be used for all outputs +#' that are being aggregated. #' @author Jan Philipp Dietrich, Benjamin Leon Bodirsky #' @seealso #' \code{\link[madrat]{readSource}},\code{\link[madrat]{getCalculations}},\code{\link[madrat]{calcOutput}} diff --git a/README.md b/README.md index 9841818..ac7977f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # madrat data preparation for validation purposes -R package **mrvalidation**, version **2.63.0** +R package **mrvalidation**, version **2.64.0** [![CRAN status](https://www.r-pkg.org/badges/version/mrvalidation)](https://cran.r-project.org/package=mrvalidation) [![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.63.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 (2025). "mrvalidation: madrat data preparation for validation purposes." doi:10.5281/zenodo.4317826 , Version: 2.64.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 = {2025-09-09}, + date = {2025-11-20}, year = {2025}, url = {https://github.com/pik-piam/mrvalidation}, - note = {Version: 2.63.0}, + note = {Version: 2.64.0}, } ``` diff --git a/man/fullVALIDATION.Rd b/man/fullVALIDATION.Rd index 2396a53..adb96b5 100644 --- a/man/fullVALIDATION.Rd +++ b/man/fullVALIDATION.Rd @@ -4,11 +4,14 @@ \alias{fullVALIDATION} \title{fullValidation} \usage{ -fullVALIDATION(rev = 0.1) +fullVALIDATION(rev = 0.1, aggregate = "region+global") } \arguments{ \item{rev}{data revision which should be used as input. Will be converted to \code{\link[base]{numeric_version}} when called via \code{\link[madrat]{retrieveData}}.} + +\item{aggregate}{an aggregation level, such as "region+global", to be used for all outputs +that are being aggregated.} } \description{ Function that produces the complete validation data set used for evaluation of MAgPIE outputs