66# ' of type (from the type/yield/irrigation tuple) "waterbody"
77# ' @param district (vector of) integer indicating the district number of the
88# ' plot area (from the original input column "BEZIRK")
9- # ' @param abimo_config list structure as returned by
10- # ' \code{kwb.abimo:::read_config }
9+ # ' @param config list structure as returned by
10+ # ' \code{\link{abimo_config_to_config} }
1111# ' @export
1212# ' @examples
1313# ' \dontrun{
14- # ' abimo_config <- kwb.abimo:::read_config()
14+ # ' config <- abimo_config_to_config( kwb.abimo:::read_config() )
1515# ' getPotentialEvaporation(
1616# ' is_waterbody = TRUE,
1717# ' district = 1,
18- # ' abimo_config = abimo_config
18+ # ' config = config
1919# ' )
2020# ' }
2121# '
22- getPotentialEvaporation2 <- function (isWaterbody , district , abimo_config )
22+ getPotentialEvaporation2 <- function (isWaterbody , district , config )
2323{
2424 # `%>%` <- magrittr::`%>%`
2525 # kwb.utils::assignPackageObjects("kwb.rabimo")
@@ -35,9 +35,7 @@ getPotentialEvaporation2 <- function(isWaterbody, district, abimo_config)
3535 )
3636
3737 # Create lookup table from abimo configuration object
38- lookup <- abimo_config %> %
39- abimo_config_to_config() %> %
40- select_elements(" potentialEvaporation" )
38+ lookup <- select_elements(config , " potentialEvaporation" )
4139
4240 result <- c(perYearInteger = " etp" , inSummerInteger = " etps" ) %> %
4341 lapply(function (column ) {
@@ -46,5 +44,10 @@ getPotentialEvaporation2 <- function(isWaterbody, district, abimo_config)
4644
4745 result [[" perYearFloat" ]] <- as.double(result [[" perYearInteger" ]])
4846
49- result
47+
48+ if (all(lengths(result ) == 1L )) {
49+ return (result )
50+ }
51+
52+ as.data.frame(result )
5053}
0 commit comments