From 7c03630912ab539552131d42814dd25d30297d9c Mon Sep 17 00:00:00 2001 From: Vartika Date: Thu, 22 Aug 2024 16:29:05 +0530 Subject: [PATCH] Remove function for LandFootPrint as it was not needed --- .buildlibrary | 2 +- CITATION.cff | 4 ++-- DESCRIPTION | 4 ++-- NAMESPACE | 1 - R/reportLandFootprint.R | 49 -------------------------------------- README.md | 8 +++---- man/reportLandFootprint.Rd | 31 ------------------------ 7 files changed, 9 insertions(+), 90 deletions(-) delete mode 100644 R/reportLandFootprint.R delete mode 100644 man/reportLandFootprint.Rd diff --git a/.buildlibrary b/.buildlibrary index 5c328855..1e7b9055 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '5704842' +ValidationKey: '5727659' AutocreateReadme: yes AcceptedWarnings: - 'Warning: package ''.*'' was built under R version' diff --git a/CITATION.cff b/CITATION.cff index f30efa11..13240feb 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: 'magpie4: MAgPIE outputs R package for MAgPIE version 4.x' -version: 2.8.6 -date-released: '2024-08-12' +version: 2.8.7 +date-released: '2024-08-22' abstract: Common output routines for extracting results from the MAgPIE framework (versions 4.x). authors: diff --git a/DESCRIPTION b/DESCRIPTION index a1a5c975..4952e470 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Type: Package Package: magpie4 Title: MAgPIE outputs R package for MAgPIE version 4.x -Version: 2.8.6 -Date: 2024-08-12 +Version: 2.8.7 +Date: 2024-08-22 Authors@R: c( person("Benjamin Leon", "Bodirsky", , "bodirsky@pik-potsdam.de", role = c("aut", "cre")), person("Florian", "Humpenoeder", , "humpenoeder@pik-potsdam.de", role = "aut"), diff --git a/NAMESPACE b/NAMESPACE index 3a976619..48c1589c 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -184,7 +184,6 @@ export(reportIntakeDetailed) export(reportKcal) export(reportLSUGrasslands) export(reportLaborProductivity) -export(reportLandFootprint) export(reportLandUse) export(reportLandUseChange) export(reportLandUseForSEALS) diff --git a/R/reportLandFootprint.R b/R/reportLandFootprint.R deleted file mode 100644 index 113f8536..00000000 --- a/R/reportLandFootprint.R +++ /dev/null @@ -1,49 +0,0 @@ -#' @title reportLandFootprint -#' @description reports land footprint of food production for the population in a region -#' accounting for traded food assuming perfect substitution between domestic production -#' and imports - -#' @import magpiesets -#' @export -#' -#' @param gdx GDX file -#' @param level spatial aggregation: "reg", "glo", "regglo", "iso" -#' @return land use for food production per capita (million hectares per-capita) -#' @author Vartika Singh -#' @examples -#' -#' \dontrun{ -#' x <- reportLandFootprint(gdx) -#' } -#' - -reportLandFootprint <- function(gdx, level = "regglo") { - - #million people - population <- population(gdx, level = level) - - #Cropland - million hectares - land <- land(gdx, level = level, types = NULL, subcategories = c("forestry"), sum = FALSE) - - #Quantity of trade of crops in million tonnes - trade <- trade(gdx, level = level, products = "kcr", type = "net-exports") - - #tonnes per hectare - yield <- yields(gdx, level = "regglo", products = "kcr", product_aggr = FALSE, - attributes = "dm", water_aggr = TRUE) - - #land needed to produce crops for trade (million hectares) - landTrade <- trade / yield - landTradetotal <- dimSums(landTrade, dim = 3, na.rm = TRUE) - - - #million hectare - totalLand <- land[, , "crop"] + land[, , "past"] + landTradetotal - - #million hectare / million people - landFootprint <- totalLand / population - - getNames(landFootprint) <- "Productivity|Land for Food Production (hectares per capita)" - - return(clean_magpie(landFootprint)) -} diff --git a/README.md b/README.md index 7b7fba5e..4de3195e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # MAgPIE outputs R package for MAgPIE version 4.x -R package **magpie4**, version **2.8.6** +R package **magpie4**, version **2.8.7** [![CRAN status](https://www.r-pkg.org/badges/version/magpie4)](https://cran.r-project.org/package=magpie4) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1158582.svg)](https://doi.org/10.5281/zenodo.1158582) [![R build status](https://github.com/pik-piam/magpie4/workflows/check/badge.svg)](https://github.com/pik-piam/magpie4/actions) [![codecov](https://codecov.io/gh/pik-piam/magpie4/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/magpie4) [![r-universe](https://pik-piam.r-universe.dev/badges/magpie4)](https://pik-piam.r-universe.dev/builds) @@ -39,7 +39,7 @@ In case of questions / problems please contact Benjamin Leon Bodirsky , R package version 2.8.6, . +Bodirsky B, Humpenoeder F, Dietrich J, Stevanovic M, Weindl I, Karstens K, Wang X, Mishra A, Beier F, Breier J, Yalew A, Chen D, Biewald A, Wirth S, von Jeetze P, Leip D, Crawford M, Alves M (2024). _magpie4: MAgPIE outputs R package for MAgPIE version 4.x_. doi:10.5281/zenodo.1158582 , R package version 2.8.7, . A BibTeX entry for LaTeX users is @@ -48,8 +48,8 @@ A BibTeX entry for LaTeX users is title = {magpie4: MAgPIE outputs R package for MAgPIE version 4.x}, author = {Benjamin Leon Bodirsky and Florian Humpenoeder and Jan Philipp Dietrich and Miodrag Stevanovic and Isabelle Weindl and Kristine Karstens and Xiaoxi Wang and Abhijeet Mishra and Felicitas Beier and Jannes Breier and Amsalu Woldie Yalew and David Chen and Anne Biewald and Stephen Wirth and Patrick {von Jeetze} and Debbora Leip and Michael Crawford and Marcos Alves}, year = {2024}, - note = {R package version 2.8.6}, - url = {https://github.com/pik-piam/magpie4}, + note = {R package version 2.8.7}, doi = {10.5281/zenodo.1158582}, + url = {https://github.com/pik-piam/magpie4}, } ``` diff --git a/man/reportLandFootprint.Rd b/man/reportLandFootprint.Rd deleted file mode 100644 index cf58ba2c..00000000 --- a/man/reportLandFootprint.Rd +++ /dev/null @@ -1,31 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/reportLandFootprint.R -\name{reportLandFootprint} -\alias{reportLandFootprint} -\title{reportLandFootprint} -\usage{ -reportLandFootprint(gdx, level = "regglo") -} -\arguments{ -\item{gdx}{GDX file} - -\item{level}{spatial aggregation: "reg", "glo", "regglo", "iso"} -} -\value{ -land use for food production per capita (million hectares per-capita) -} -\description{ -reports land footprint of food production for the population in a region -accounting for traded food assuming perfect substitution between domestic production -and imports -} -\examples{ - - \dontrun{ - x <- reportLandFootprint(gdx) - } - -} -\author{ -Vartika Singh -}