From f7f11f341d69f1d11109eca23cf6d6da456c42b7 Mon Sep 17 00:00:00 2001 From: Jake Tommey Date: Fri, 25 Oct 2024 13:49:09 +0200 Subject: [PATCH 1/3] Added functions for applying a yield shock due to ozone --- CITATION.cff | 2 + DESCRIPTION | 3 +- NAMESPACE | 1 + R/calcOzoneYieldShock.R | 89 ++++++++++++++++++++++ R/calcYields.R | 83 ++------------------- R/calcYieldsWeight.R | 135 ++++++++++++++++++++++++++++++++++ R/correctOzoneYieldShock.R | 26 +++++++ R/readOzoneYieldShock.R | 19 +++++ man/calcOzoneYieldShock.Rd | 49 ++++++++++++ man/calcYieldsWeight.Rd | 55 ++++++++++++++ man/correctOzoneYieldShock.Rd | 25 +++++++ man/readOzoneYieldShock.Rd | 23 ++++++ 12 files changed, 433 insertions(+), 77 deletions(-) create mode 100644 R/calcOzoneYieldShock.R create mode 100644 R/calcYieldsWeight.R create mode 100644 R/correctOzoneYieldShock.R create mode 100644 R/readOzoneYieldShock.R create mode 100644 man/calcOzoneYieldShock.Rd create mode 100644 man/calcYieldsWeight.Rd create mode 100644 man/correctOzoneYieldShock.Rd create mode 100644 man/readOzoneYieldShock.Rd diff --git a/CITATION.cff b/CITATION.cff index 7a01b63..c4176f5 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -39,6 +39,8 @@ authors: given-names: David - family-names: Sauer given-names: Pascal +- family-names: Tommey + given-names: Jake license: LGPL-3.0 repository-code: https://github.com/pik-piam/mrland doi: 10.5281/zenodo.3822083 diff --git a/DESCRIPTION b/DESCRIPTION index d1b7e9b..aea99aa 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -19,7 +19,8 @@ Authors@R: c( person("Stephen", "Wirth", role = "aut"), person("Felicitas", "Beier", role = "aut"), person("David", "Hoetten", role = "aut"), - person("Pascal", "Sauer", role = "aut") + person("Pascal", "Sauer", role = "aut"), + person("Jake", "Tommey", role = "aut") ) Description: The package provides land related data via the madrat framework. diff --git a/NAMESPACE b/NAMESPACE index 2aad0e3..31809a5 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -104,6 +104,7 @@ importFrom(raster,aggregate) importFrom(raster,brick) importFrom(raster,raster) importFrom(raster,rasterToPoints) +importFrom(readxl,read_xlsx) importFrom(reshape2,acast) importFrom(stats,complete.cases) importFrom(stats,median) diff --git a/R/calcOzoneYieldShock.R b/R/calcOzoneYieldShock.R new file mode 100644 index 0000000..845dd07 --- /dev/null +++ b/R/calcOzoneYieldShock.R @@ -0,0 +1,89 @@ +#' @title calcOzoneYieldShock +#' @description calculate Ozone yield shocks +#' Data from the EAT-Lancet deepdive on Ozone shock effects on crop yields. +#' @param weighting use of different weights (totalCrop (default), +#' totalLUspecific, cropSpecific, crop+irrigSpecific, +#' avlCropland, avlCropland+avlPasture) +#' @param marginal_land Defines which share of marginal land should be included (see options below) and +#' whether suitable land under irrigated conditions ("irrigated"), under rainfed conditions ("rainfed") +#' or suitability under rainfed conditions including currently irrigated land (rainfed_and_irrigated) +#' should be used. Options combined via ":" +#' The different marginal land options are: +#' \itemize{ +#' \item \code{"all_marginal"}: All marginal land (suitability index between 0-0.33) is included as suitable +#' \item \code{"q33_marginal"}: The bottom tertile (suitability index below 0.13) of the +#' marginal land area is excluded. +#' \item \code{"q50_marginal"}: The bottom half (suitability index below 0.18) of the +#' marginal land area is excluded. +#' \item \code{"q66_marginal"}: The first and second tertile (suitability index below 0.23) of +#' the marginal land area are excluded. +#' \item \code{"q75_marginal"}: The first, second and third quartiles (suitability index below 0.25) +#' of the marginal land are are excluded +#' \item \code{"no_marginal"}: Areas with a suitability index of 0.33 and lower are excluded. +#' \item \code{"magpie"}: Returns "all_marginal:rainfed_and_irrigated", +#' "q33_marginal:rainfed_and_irrigated" and +#' "no_marginal:rainfed_and_irrigated" in a magclass object to be used as magpie input. +#' } +#' @return magpie object in cellular resolution +#' @author Jake Tommey +#' @examples +#' \dontrun{ +#' calcOutput("OzoneYieldShock") +#' } +#' @importFrom mstools toolGetMappingCoord2Country + +calcOzoneYieldShock <- function( + weighting = "totalCrop", + marginal_land = "magpie" #nolint +) { + shocks <- readSource("OzoneYieldShock", convert = "onlycorrect") + shocks <- add_columns(shocks, addnm = "y2020", dim = 2, fill = 0) + # time interpolate the shock + shocks <- magclass::time_interpolate( + shocks, + interpolated_year = seq(1965, 2150, 5), + integrate_interpolated_years = TRUE, + extrapolation_type = "constant" + ) + + mapping <- toolGetMappingCoord2Country() + mapping$coordiso <- paste(mapping$coords, mapping$iso, sep = ".") + shocks <- toolAggregate(shocks, mapping, from = "iso", to = "coordiso") + getSets(shocks) <- c("x.y.iso", "year", "rcp.crop") + + # create a MAgPIE object with the correct shape. + cropNames <- toolGetMapping("MAgPIE_LPJmL.csv", type = "sectoral", where = "mappingfolder")$MAgPIE + yieldShock <- new.magpie( + cells_and_regions = getCells(shocks), + years = getYears(shocks), + names = c(paste0("rcp2p6.", cropNames), paste0("rcp7p0.", cropNames)) + ) + + yieldShock[, , "tece"] <- shocks[, , "Wheat"] + yieldShock[, , "soybean"] <- shocks[, , "soybean"] + yieldShock[, , "rice_pro"] <- shocks[, , "Rice"] + yieldShock[, , "sugr_beet"] <- shocks[, , "sugarbeet"] + yieldShock[, , "maiz"] <- shocks[, , "Maize"] + otherCrops <- yieldShock[, , c("tece", "soybean", "rice_pro", "sugr_beet", "maiz"), invert = TRUE] + yieldShock[, , getItems(otherCrops, dim = 3)] <- (dimSums(shocks, dim = 3) / length(getItems(shocks, dim = 3))) + yieldShock[, , "pasture"] <- 0 + + getSets(yieldShock) <- c("x", "y", "iso", "year", "rcp", "crop") + + cropAreaWeights <- calcOutput( + "YieldsWeight", + weighting = weighting, + marginal_land = marginal_land, + aggregate = FALSE + ) + + return( + list( + x = yieldShock, + weight = cropAreaWeights, + unit = "t per ha", + description = "percentage yield shock due to ozone", + isocountries = FALSE + ) + ) +} diff --git a/R/calcYields.R b/R/calcYields.R index a5e49d2..67096b6 100644 --- a/R/calcYields.R +++ b/R/calcYields.R @@ -203,82 +203,13 @@ calcYields <- function(source = c(lpjml = "ggcmi_phase3_nchecks_9ca735cb", isimi } - # Weight for spatial aggregation - if (weighting == "totalCrop") { - - cropAreaWeight <- dimSums(calcOutput("Croparea", sectoral = "kcr", physical = TRUE, irrigation = FALSE, - cellular = TRUE, cells = cells, aggregate = FALSE, - years = "y1995", round = 6), - dim = 3) + 10e-10 - - } else if (weighting %in% c("totalLUspecific", "cropSpecific", "crop+irrigSpecific")) { - - crop <- calcOutput("Croparea", sectoral = "kcr", physical = TRUE, irrigation = TRUE, - cellular = TRUE, cells = cells, aggregate = FALSE, years = "y1995", round = 6) - - past <- calcOutput("LanduseInitialisation", aggregate = FALSE, cellular = TRUE, nclasses = "seven", - input_magpie = TRUE, cells = cells, years = "y1995", round = 6)[, , "past"] - - if (weighting == "crop+irrigSpecific") { - - cropAreaWeight <- new.magpie(cells_and_regions = getCells(yields), - years = NULL, - names = getNames(yields), - fill = NA) - cropAreaWeight[, , findset("kcr")] <- crop + 10e-10 - cropAreaWeight[, , "pasture"] <- mbind(setNames(past + 10e-10, "irrigated"), - setNames(past + 10e-10, "rainfed")) - - } else if (weighting == "cropSpecific") { - - cropAreaWeight <- new.magpie(cells_and_regions = getCells(yields), - years = NULL, - names = getNames(yields, dim = 1), - fill = NA) - - cropAreaWeight[, , findset("kcr")] <- dimSums(crop, dim = 3.1) + 10e-10 - cropAreaWeight[, , "pasture"] <- past + 10e-10 - - } else { - - cropAreaWeight <- new.magpie(cells_and_regions = getCells(yields), - years = NULL, - names = getNames(yields, dim = 1), - fill = (dimSums(crop, dim = 3) + 10e-10)) - - cropAreaWeight[, , "pasture"] <- past + 10e-10 - - } - - } else if (weighting == "avlCropland") { - - cropAreaWeight <- setNames(calcOutput("AvlCropland", marginal_land = marginal_land, cells = cells, - country_level = FALSE, aggregate = FALSE), - NULL) + 10e-10 - - } else if (weighting == "avlCropland+avlPasture") { - - avlCrop <- setNames(calcOutput("AvlCropland", marginal_land = marginal_land, cells = cells, - country_level = FALSE, aggregate = FALSE), "avlCrop") - - lu1995 <- setYears(calcOutput("LanduseInitialisation", aggregate = FALSE, cellular = TRUE, nclasses = "seven", - input_magpie = TRUE, cells = cells, years = "y1995", round = 6), NULL) - - cropAreaWeight <- new.magpie(cells_and_regions = getCells(yields), - years = NULL, - names = getNames(yields, dim = 1), - fill = avlCrop) - - cropAreaWeight[, , "pasture"] <- pmax(avlCrop, - dimSums(lu1995[, , c("primforest", "secdforest", "forestry", "past")], - dim = 3)) + 10e-10 - - } else { - - stop("Weighting setting is not available.") - } - - if (any(is.na(cropAreaWeight))) stop("NAs in weights.") + cropAreaWeight <- calcOutput( + "YieldsWeight", + cells = cells, + weighting = weighting, + marginal_land = marginal_land, + aggregate = FALSE + ) # Special case for India case study if (indiaYields) { diff --git a/R/calcYieldsWeight.R b/R/calcYieldsWeight.R new file mode 100644 index 0000000..a5761bc --- /dev/null +++ b/R/calcYieldsWeight.R @@ -0,0 +1,135 @@ +#' @title calcYieldsWeight +#' +#' @description This function calculates the crop area weightings to use for yields. +#' @param weighting use of different weights (totalCrop (default), +#' totalLUspecific, cropSpecific, crop+irrigSpecific, +#' avlCropland, avlCropland+avlPasture) +#' @param cells if cellular is TRUE: "magpiecell" for 59199 cells or "lpjcell" for 67420 cells +#' @param marginal_land Defines which share of marginal land should be included (see options below) and +#' whether suitable land under irrigated conditions ("irrigated"), under rainfed conditions ("rainfed") +#' or suitability under rainfed conditions including currently irrigated land (rainfed_and_irrigated) +#' should be used. Options combined via ":" +#' The different marginal land options are: +#' \itemize{ +#' \item \code{"all_marginal"}: All marginal land (suitability index between 0-0.33) is included as suitable +#' \item \code{"q33_marginal"}: The bottom tertile (suitability index below 0.13) of the +#' marginal land area is excluded. +#' \item \code{"q50_marginal"}: The bottom half (suitability index below 0.18) of the +#' marginal land area is excluded. +#' \item \code{"q66_marginal"}: The first and second tertile (suitability index below 0.23) of +#' the marginal land area are excluded. +#' \item \code{"q75_marginal"}: The first, second and third quartiles (suitability index below 0.25) +#' of the marginal land are are excluded +#' \item \code{"no_marginal"}: Areas with a suitability index of 0.33 and lower are excluded. +#' \item \code{"magpie"}: Returns "all_marginal:rainfed_and_irrigated", +#' "q33_marginal:rainfed_and_irrigated" and +#' "no_marginal:rainfed_and_irrigated" in a magclass object to be used as magpie input. +#' } +#' @return magpie object in cellular resolution +#' +#' @author Kristine Karstens, Felicitas Beier +#' +#' @examples +#' \dontrun{ +#' calcOutput("YieldsWeight", yields, aggregate = FALSE) +#' } +#' +#' @importFrom magpiesets findset +#' @importFrom magclass getYears add_columns dimSums time_interpolate +#' @importFrom madrat toolFillYears toolGetMapping toolTimeAverage +#' @importFrom mstools toolHarmonize2Baseline +#' @importFrom mrlandcore toolLPJmLVersion +#' @importFrom stringr str_split +#' @importFrom withr local_options + +calcYieldsWeight <- function(cells = "lpjcell", weighting = "totalCrop", marginal_land = "magpie") { # nolint + + yieldNames <- toolGetMapping("MAgPIE_LPJmL.csv", type = "sectoral", where = "mappingfolder")$MAgPIE + isos <- toolGetMappingCoord2Country() + yieldCells <- paste(isos$coords, isos$iso, sep = ".") + + + # Weight for spatial aggregation + if (weighting == "totalCrop") { + + cropAreaWeight <- dimSums(calcOutput("Croparea", sectoral = "kcr", physical = TRUE, irrigation = FALSE, + cellular = TRUE, cells = cells, aggregate = FALSE, + years = "y1995", round = 6), + dim = 3) + 10e-10 + + } else if (weighting %in% c("totalLUspecific", "cropSpecific", "crop+irrigSpecific")) { + + crop <- calcOutput("Croparea", sectoral = "kcr", physical = TRUE, irrigation = TRUE, + cellular = TRUE, cells = cells, aggregate = FALSE, years = "y1995", round = 6) + + past <- calcOutput("LanduseInitialisation", aggregate = FALSE, cellular = TRUE, nclasses = "seven", + input_magpie = TRUE, cells = cells, years = "y1995", round = 6)[, , "past"] + + if (weighting == "crop+irrigSpecific") { + + cropAreaWeight <- new.magpie(cells_and_regions = yieldCells, + years = NULL, + names = c(paste(yieldNames, "irrigated", sep = "."), + paste(yieldNames, "rainfed", sep = ".")), + fill = NA) + cropAreaWeight[, , findset("kcr")] <- crop + 10e-10 + cropAreaWeight[, , "pasture"] <- mbind(setNames(past + 10e-10, "irrigated"), + setNames(past + 10e-10, "rainfed")) + + } else if (weighting == "cropSpecific") { + + cropAreaWeight <- new.magpie(cells_and_regions = yieldCells, + years = NULL, + names = yieldNames, + fill = NA) + + cropAreaWeight[, , findset("kcr")] <- dimSums(crop, dim = 3.1) + 10e-10 + cropAreaWeight[, , "pasture"] <- past + 10e-10 + + } else { + + cropAreaWeight <- new.magpie(cells_and_regions = yieldCells, + years = NULL, + names = yieldNames, + fill = (dimSums(crop, dim = 3) + 10e-10)) + + cropAreaWeight[, , "pasture"] <- past + 10e-10 + + } + + } else if (weighting == "avlCropland") { + + cropAreaWeight <- setNames(calcOutput("AvlCropland", marginal_land = marginal_land, cells = cells, + country_level = FALSE, aggregate = FALSE), + NULL) + 10e-10 + + } else if (weighting == "avlCropland+avlPasture") { + + avlCrop <- setNames(calcOutput("AvlCropland", marginal_land = marginal_land, cells = cells, + country_level = FALSE, aggregate = FALSE), "avlCrop") + + lu1995 <- setYears(calcOutput("LanduseInitialisation", aggregate = FALSE, cellular = TRUE, nclasses = "seven", + input_magpie = TRUE, cells = cells, years = "y1995", round = 6), NULL) + + cropAreaWeight <- new.magpie(cells_and_regions = yieldCells, + years = NULL, + names = yieldNames, + fill = avlCrop) + + cropAreaWeight[, , "pasture"] <- pmax(avlCrop, + dimSums(lu1995[, , c("primforest", "secdforest", "forestry", "past")], + dim = 3)) + 10e-10 + + } else { + + stop("Weighting setting is not available.") + } + + if (any(is.na(cropAreaWeight))) stop("NAs in weights.") + + return(list(x = cropAreaWeight, + weight = NULL, + unit = "Mha", + description = "Yields in tons per hectar for different crop types.", + isocountries = FALSE)) +} diff --git a/R/correctOzoneYieldShock.R b/R/correctOzoneYieldShock.R new file mode 100644 index 0000000..a8b7901 --- /dev/null +++ b/R/correctOzoneYieldShock.R @@ -0,0 +1,26 @@ +#' @title correctOzoneYieldShock +#' @description correct Ozone Yield shock data +#' @return x corrected magpie object containing all ISO countries +#' @param x magpie object provided by the read function +#' @author Jake Tommey +#' @examples +#' \dontrun{ +#' readSource("OzoneShock", convert="onlycorrect") +#' } +#' @importFrom madrat toolGetMapping + + +correctOzoneYieldShock <- function(x) { + x <- toolConditionalReplace(x, conditions = "is.na()", replaceby = 0) + isocountries <- unique(toolGetMapping("mapCoords2Country.rds", where = "mrcommons")$iso) + missingImport <- c("QAT", "HTI", "IRL", "CHN", "IND", + "ZAF", "MDG", "CRI", "AUS", "HTI", + "MYS", "ZAF", "IDN", "VEN", "CHN" + ) + names(missingImport) <- c("BHR", "DOM", "GBR", "HKG", "LKA", + "LSO", "MUS", "NIC", "NZL", "PRI", + "SGP", "SWZ", "TLS", "TTO", "TWN" + ) + x <- toolCountryFill(x, fill = 0.0, countrylist = isocountries, verbosity = 0, map = missingImport) + return(x) +} diff --git a/R/readOzoneYieldShock.R b/R/readOzoneYieldShock.R new file mode 100644 index 0000000..a3a2f9b --- /dev/null +++ b/R/readOzoneYieldShock.R @@ -0,0 +1,19 @@ +#' @title readOzoneYieldShock +#' @description read Ozone Yield Shock +#' Data from the EAT-Lancet deepdive on Ozone shock effects on crop yields. +#' @return MAgPIE object with country level yield shock data for year 2050. +#' @author Jake Tommey +#' @examples +#' \dontrun{ +#' readSource("OzoneShock", convert = "onlycorrect") +#' } +#' @importFrom readxl read_xlsx + +readOzoneYieldShock <- function() { + # read-in file for ozone shocks + x <- readxl::read_excel("Ag_CCShocks.xlsx", sheet = "Ozone") + # convert to magclass object + x <- as.magpie(x[, 1:4], spatial = 1) + getYears(x) <- 2050 + return(x) +} diff --git a/man/calcOzoneYieldShock.Rd b/man/calcOzoneYieldShock.Rd new file mode 100644 index 0000000..3cd58c6 --- /dev/null +++ b/man/calcOzoneYieldShock.Rd @@ -0,0 +1,49 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/calcOzoneYieldShock.R +\name{calcOzoneYieldShock} +\alias{calcOzoneYieldShock} +\title{calcOzoneYieldShock} +\usage{ +calcOzoneYieldShock(weighting = "totalCrop", marginal_land = "magpie") +} +\arguments{ +\item{weighting}{use of different weights (totalCrop (default), +totalLUspecific, cropSpecific, crop+irrigSpecific, +avlCropland, avlCropland+avlPasture)} + +\item{marginal_land}{Defines which share of marginal land should be included (see options below) and + whether suitable land under irrigated conditions ("irrigated"), under rainfed conditions ("rainfed") + or suitability under rainfed conditions including currently irrigated land (rainfed_and_irrigated) + should be used. Options combined via ":" + The different marginal land options are: +\itemize{ +\item \code{"all_marginal"}: All marginal land (suitability index between 0-0.33) is included as suitable +\item \code{"q33_marginal"}: The bottom tertile (suitability index below 0.13) of the +marginal land area is excluded. +\item \code{"q50_marginal"}: The bottom half (suitability index below 0.18) of the +marginal land area is excluded. +\item \code{"q66_marginal"}: The first and second tertile (suitability index below 0.23) of +the marginal land area are excluded. +\item \code{"q75_marginal"}: The first, second and third quartiles (suitability index below 0.25) +of the marginal land are are excluded +\item \code{"no_marginal"}: Areas with a suitability index of 0.33 and lower are excluded. +\item \code{"magpie"}: Returns "all_marginal:rainfed_and_irrigated", + "q33_marginal:rainfed_and_irrigated" and + "no_marginal:rainfed_and_irrigated" in a magclass object to be used as magpie input. +}} +} +\value{ +magpie object in cellular resolution +} +\description{ +calculate Ozone yield shocks +Data from the EAT-Lancet deepdive on Ozone shock effects on crop yields. +} +\examples{ +\dontrun{ +calcOutput("OzoneYieldShock") +} +} +\author{ +Jake Tommey +} diff --git a/man/calcYieldsWeight.Rd b/man/calcYieldsWeight.Rd new file mode 100644 index 0000000..188de44 --- /dev/null +++ b/man/calcYieldsWeight.Rd @@ -0,0 +1,55 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/calcYieldsWeight.R +\name{calcYieldsWeight} +\alias{calcYieldsWeight} +\title{calcYieldsWeight} +\usage{ +calcYieldsWeight( + cells = "lpjcell", + weighting = "totalCrop", + marginal_land = "magpie" +) +} +\arguments{ +\item{cells}{if cellular is TRUE: "magpiecell" for 59199 cells or "lpjcell" for 67420 cells} + +\item{weighting}{use of different weights (totalCrop (default), +totalLUspecific, cropSpecific, crop+irrigSpecific, +avlCropland, avlCropland+avlPasture)} + +\item{marginal_land}{Defines which share of marginal land should be included (see options below) and + whether suitable land under irrigated conditions ("irrigated"), under rainfed conditions ("rainfed") + or suitability under rainfed conditions including currently irrigated land (rainfed_and_irrigated) + should be used. Options combined via ":" + The different marginal land options are: +\itemize{ +\item \code{"all_marginal"}: All marginal land (suitability index between 0-0.33) is included as suitable +\item \code{"q33_marginal"}: The bottom tertile (suitability index below 0.13) of the +marginal land area is excluded. +\item \code{"q50_marginal"}: The bottom half (suitability index below 0.18) of the +marginal land area is excluded. +\item \code{"q66_marginal"}: The first and second tertile (suitability index below 0.23) of +the marginal land area are excluded. +\item \code{"q75_marginal"}: The first, second and third quartiles (suitability index below 0.25) +of the marginal land are are excluded +\item \code{"no_marginal"}: Areas with a suitability index of 0.33 and lower are excluded. +\item \code{"magpie"}: Returns "all_marginal:rainfed_and_irrigated", + "q33_marginal:rainfed_and_irrigated" and + "no_marginal:rainfed_and_irrigated" in a magclass object to be used as magpie input. +}} +} +\value{ +magpie object in cellular resolution +} +\description{ +This function calculates the crop area weightings to use for yields. +} +\examples{ +\dontrun{ +calcOutput("YieldsWeight", yields, aggregate = FALSE) +} + +} +\author{ +Kristine Karstens, Felicitas Beier +} diff --git a/man/correctOzoneYieldShock.Rd b/man/correctOzoneYieldShock.Rd new file mode 100644 index 0000000..20be669 --- /dev/null +++ b/man/correctOzoneYieldShock.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/correctOzoneYieldShock.R +\name{correctOzoneYieldShock} +\alias{correctOzoneYieldShock} +\title{correctOzoneYieldShock} +\usage{ +correctOzoneYieldShock(x) +} +\arguments{ +\item{x}{magpie object provided by the read function} +} +\value{ +x corrected magpie object containing all ISO countries +} +\description{ +correct Ozone Yield shock data +} +\examples{ +\dontrun{ +readSource("OzoneShock", convert="onlycorrect") +} +} +\author{ +Jake Tommey +} diff --git a/man/readOzoneYieldShock.Rd b/man/readOzoneYieldShock.Rd new file mode 100644 index 0000000..63b1db0 --- /dev/null +++ b/man/readOzoneYieldShock.Rd @@ -0,0 +1,23 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/readOzoneYieldShock.R +\name{readOzoneYieldShock} +\alias{readOzoneYieldShock} +\title{readOzoneYieldShock} +\usage{ +readOzoneYieldShock() +} +\value{ +MAgPIE object with country level yield shock data for year 2050. +} +\description{ +read Ozone Yield Shock +Data from the EAT-Lancet deepdive on Ozone shock effects on crop yields. +} +\examples{ +\dontrun{ +readSource("OzoneShock", convert = "onlycorrect") +} +} +\author{ +Jake Tommey +} From 368ec4142182a732e2333110f6ea7248653c48fa Mon Sep 17 00:00:00 2001 From: Jake Tommey Date: Fri, 25 Oct 2024 14:00:03 +0200 Subject: [PATCH 2/3] ran lucode2 --- .buildlibrary | 3 ++- CITATION.cff | 4 ++-- DESCRIPTION | 4 ++-- README.md | 8 ++++---- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.buildlibrary b/.buildlibrary index 7378447..0dc0a01 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '12606930' +ValidationKey: '12813440' AcceptedWarnings: - 'Warning: package ''.*'' was built under R version' - 'Warning: namespace ''.*'' is not available and has been replaced' @@ -8,3 +8,4 @@ AcceptedNotes: AutocreateReadme: yes allowLinterWarnings: no enforceVersionUpdate: no +skipCoverage: no diff --git a/CITATION.cff b/CITATION.cff index c4176f5..d1bbc6e 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: 'mrland: MadRaT land data package' -version: 0.63.0 -date-released: '2024-10-15' +version: 0.64.0 +date-released: '2024-10-25' abstract: The package provides land related data via the madrat framework. authors: - family-names: Dietrich diff --git a/DESCRIPTION b/DESCRIPTION index aea99aa..2964ad0 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Type: Package Package: mrland Title: MadRaT land data package -Version: 0.63.0 -Date: 2024-10-15 +Version: 0.64.0 +Date: 2024-10-25 Authors@R: c( person("Jan Philipp", "Dietrich", , "dietrich@pik-potsdam.de", role = c("aut", "cre")), person("Abhijeet", "Mishra", role = "aut"), diff --git a/README.md b/README.md index a89c15e..0d60b69 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # MadRaT land data package -R package **mrland**, version **0.63.0** +R package **mrland**, version **0.64.0** [![CRAN status](https://www.r-pkg.org/badges/version/mrland)](https://cran.r-project.org/package=mrland) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3822083.svg)](https://doi.org/10.5281/zenodo.3822083) [![R build status](https://github.com/pik-piam/mrland/workflows/check/badge.svg)](https://github.com/pik-piam/mrland/actions) [![codecov](https://codecov.io/gh/pik-piam/mrland/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/mrland) [![r-universe](https://pik-piam.r-universe.dev/badges/mrland)](https://pik-piam.r-universe.dev/builds) @@ -39,16 +39,16 @@ In case of questions / problems please contact Jan Philipp Dietrich , R package version 0.63.0, . +Dietrich J, Mishra A, Weindl I, Bodirsky B, Wang X, Baumstark L, Kreidenweis U, Klein D, Steinmetz N, Chen D, Humpenoeder F, von Jeetze P, Wirth S, Beier F, Hoetten D, Sauer P, Tommey J (2024). _mrland: MadRaT land data package_. doi:10.5281/zenodo.3822083 , R package version 0.64.0, . A BibTeX entry for LaTeX users is ```latex @Manual{, title = {mrland: MadRaT land data package}, - author = {Jan Philipp Dietrich and Abhijeet Mishra and Isabelle Weindl and Benjamin Leon Bodirsky and Xiaoxi Wang and Lavinia Baumstark and Ulrich Kreidenweis and David Klein and Nele Steinmetz and David Chen and Florian Humpenoeder and Patrick {von Jeetze} and Stephen Wirth and Felicitas Beier and David Hoetten and Pascal Sauer}, + author = {Jan Philipp Dietrich and Abhijeet Mishra and Isabelle Weindl and Benjamin Leon Bodirsky and Xiaoxi Wang and Lavinia Baumstark and Ulrich Kreidenweis and David Klein and Nele Steinmetz and David Chen and Florian Humpenoeder and Patrick {von Jeetze} and Stephen Wirth and Felicitas Beier and David Hoetten and Pascal Sauer and Jake Tommey}, year = {2024}, - note = {R package version 0.63.0}, + note = {R package version 0.64.0}, url = {https://github.com/pik-piam/mrland}, doi = {10.5281/zenodo.3822083}, } From bd22e457a7c48e8385d432563851332042a67896 Mon Sep 17 00:00:00 2001 From: Jake Tommey Date: Fri, 25 Oct 2024 15:14:33 +0200 Subject: [PATCH 3/3] correct unit of calcOzoneYieldShock to % --- R/calcOzoneYieldShock.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/calcOzoneYieldShock.R b/R/calcOzoneYieldShock.R index 845dd07..ba0aaa5 100644 --- a/R/calcOzoneYieldShock.R +++ b/R/calcOzoneYieldShock.R @@ -81,7 +81,7 @@ calcOzoneYieldShock <- function( list( x = yieldShock, weight = cropAreaWeights, - unit = "t per ha", + unit = "%", description = "percentage yield shock due to ozone", isocountries = FALSE )