diff --git a/.buildlibrary b/.buildlibrary index 3addd5e5..35f7423f 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '33460316' +ValidationKey: '33479872' AcceptedWarnings: - 'Warning: package ''.*'' was built under R version' - 'Warning: namespace ''.*'' is not available and has been replaced' diff --git a/CITATION.cff b/CITATION.cff index 0fc97bd7..9dd87ab5 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -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.7.11 +version: 1.7.12 date-released: '2023-07-18' abstract: Provides functions for MAgPIE cellular input data generation and stand-alone water calculations. diff --git a/DESCRIPTION b/DESCRIPTION index b08361b3..f24b3be7 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: mrwater Title: madrat based MAgPIE water Input Data Library -Version: 1.7.11 +Version: 1.7.12 URL: https://github.com/pik-piam/mrwater, https: //doi.org/10.5281/zenodo.5801680 License: LGPL-3 | file LICENSE diff --git a/R/calcRiverHumanUseAccounting.R b/R/calcRiverHumanUseAccounting.R index 3c82c4f1..bd2d5d0e 100755 --- a/R/calcRiverHumanUseAccounting.R +++ b/R/calcRiverHumanUseAccounting.R @@ -188,12 +188,16 @@ calcRiverHumanUseAccounting <- function(iteration, tmpDischarge <- discharge[, y, scen] # Cells to be calculated - cellsCalc <- which(tmpRequestWWlocal > 0) + cellsCalc <- unique(c(which(tmpRequestWWlocal > 0), + which(tmpDischarge + prevReservedWC[ , y, scen] < prevReservedWW[ , y, scen]))) cellsCalc <- unique(c(cellsCalc, unlist(rs$downstreamcells[cellsCalc]))) cellsCalc <- cellsCalc[order(rs$calcorder[cellsCalc], decreasing = FALSE)] for (c in cellsCalc) { + # Does the respective cell request water withdrawal? + # Or: Is available water is smaller than previously reserved withdrawal? + # Then: update of discharge required. if ((tmpRequestWWlocal[c] > 0) || ((tmpDischarge[c] + prevReservedWC[c, y, scen]) < prevReservedWW[c, y, scen])) { diff --git a/R/toolRiverUpDownBalanceSINGLE.R b/R/toolRiverUpDownBalanceSINGLE.R index 527642ec..ffad1b23 100755 --- a/R/toolRiverUpDownBalanceSINGLE.R +++ b/R/toolRiverUpDownBalanceSINGLE.R @@ -34,7 +34,7 @@ toolRiverUpDownBalanceSINGLE <- function(inLIST, inoutLIST) { # Available water # (Note: since it is compared to water reserved in previous time step, - # it needs to include prevWC, otherwise: there would be double-accouting) + # it needs to include prevWC, otherwise: there would be double-accounting) avlWat <- q[1] + prevWC ############################################ diff --git a/README.md b/README.md index 1bf9d7d9..221e7aa3 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # madrat based MAgPIE water Input Data Library -R package **mrwater**, version **1.7.11** +R package **mrwater**, version **1.7.12** [![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) @@ -48,7 +48,7 @@ In case of questions / problems please contact Felicitas Beier . +Beier F, Heinke J, Karstens K, Bodirsky B, Dietrich J (2023). _mrwater: madrat based MAgPIE water Input Data Library_. R package version 1.7.12, . A BibTeX entry for LaTeX users is @@ -57,7 +57,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.7.11}, + note = {R package version 1.7.12}, url = {https://github.com/pik-piam/mrwater}, } ```