Skip to content

Commit

Permalink
small bugfix and warning related to negative values in AreaPotIrrig
Browse files Browse the repository at this point in the history
  • Loading branch information
FelicitasBeier committed Sep 4, 2023
1 parent 0a75881 commit 359a890
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .buildlibrary
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ValidationKey: '37600472'
ValidationKey: '37620076'
AcceptedWarnings:
- 'Warning: package ''.*'' was built under R version'
- 'Warning: namespace ''.*'' is not available and has been replaced'
Expand Down
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cff-version: 1.2.0
message: If you use this software, please cite it using the metadata from this file.
type: software
title: 'mrwater: madrat based MAgPIE water Input Data Library'
version: 1.9.18
version: 1.9.19
date-released: '2023-09-04'
abstract: Provides functions for MAgPIE cellular input data generation and stand-alone
water calculations.
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: mrwater
Title: madrat based MAgPIE water Input Data Library
Version: 1.9.18
Version: 1.9.19
URL: https://github.com/pik-piam/mrwater,
https: //doi.org/10.5281/zenodo.5801680
License: LGPL-3 | file LICENSE
Expand Down
10 changes: 8 additions & 2 deletions R/calcAreaPotIrrig.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#' if !NULL: already irrigated area is subtracted;
#' year specified here is the year of the initialization
#' used for cropland area initialization in calcIrrigatedArea (e.g. NULL, 1995, 2010)
#' @param fossilGW This argument is only relevant when comagyear != NULL
#' @param fossilGW This argument is only relevant when comagyear != NULL
#' as it determines the area that is set aside as it is already
#' reserved by the committed agriculture iteration.
#' If TRUE: non-renewable groundwater can be used.
Expand All @@ -32,7 +32,7 @@
#' @param scenarios Scenarios for object dimension consisting of "EFP.scenario".
#' Default is c("on.ISIMIP", "on.ssp1", "on.ssp2", "on.ssp3",
#' "off.ISIMIP", "off.ssp1", "off.ssp2", "off.ssp3")
#' If scenarios change, they have to be adjusted in the default
#' If scenarios change, they have to be adjusted in the default
#' setting of this function.
#'
#'
Expand Down Expand Up @@ -144,6 +144,12 @@ calcAreaPotIrrig <- function(selectyears, comagyear, iniyear, landScen,

# area that is not protected
areaNOprotect <- landarea - protectArea
# correct areas where more area is protected than land is available
if (any(areaNOprotect < 0)) {
warning("The protected area seems to be calculated based on a different
land availability than LUH. Negative values are set to 0 in calcAreaPotIrrig")
areaNOprotect[areaNOprotect < 0] <- 0
}

#########################################################
### Land that is potentially available for irrigation ###
Expand Down
2 changes: 1 addition & 1 deletion R/fullSIMPLE.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ fullSIMPLE <- function(transDist = 100, fossilGW = TRUE,
landScen = paste0("potCropland:", protectLand),
lpjml = NULL, climatetype = NULL,
efrMethod = NULL, fossilGW = FALSE,
multicropping = NULL, transDist = NULL,
multicropping = FALSE, transDist = NULL,
aggregate = FALSE,
file = "avlIrrigarea_pot.mz")

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# madrat based MAgPIE water Input Data Library

R package **mrwater**, version **1.9.18**
R package **mrwater**, version **1.9.19**

[![CRAN status](https://www.r-pkg.org/badges/version/mrwater)](https://cran.r-project.org/package=mrwater) [![R build status](https://github.com/pik-piam/mrwater/workflows/check/badge.svg)](https://github.com/pik-piam/mrwater/actions) [![codecov](https://codecov.io/gh/pik-piam/mrwater/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/mrwater) [![r-universe](https://pik-piam.r-universe.dev/badges/mrwater)](https://pik-piam.r-universe.dev/builds)

Expand Down Expand Up @@ -50,7 +50,7 @@ In case of questions / problems please contact Felicitas Beier <beier@pik-potsda

To cite package **mrwater** in publications use:

Beier F, Heinke J, Karstens K, Bodirsky B, Dietrich J (2023). _mrwater: madrat based MAgPIE water Input Data Library_. R package version 1.9.18, <https://github.com/pik-piam/mrwater>.
Beier F, Heinke J, Karstens K, Bodirsky B, Dietrich J (2023). _mrwater: madrat based MAgPIE water Input Data Library_. R package version 1.9.19, <https://github.com/pik-piam/mrwater>.

A BibTeX entry for LaTeX users is

Expand All @@ -59,7 +59,7 @@ A BibTeX entry for LaTeX users is
title = {mrwater: madrat based MAgPIE water Input Data Library},
author = {Felicitas Beier and Jens Heinke and Kristine Karstens and Benjamin Leon Bodirsky and Jan Philipp Dietrich},
year = {2023},
note = {R package version 1.9.18},
note = {R package version 1.9.19},
url = {https://github.com/pik-piam/mrwater},
}
```
4 changes: 2 additions & 2 deletions man/calcAreaPotIrrig.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 359a890

Please sign in to comment.