11# ' Convert Abimo Configuration to List
22# '
33# ' @param abimo_config as returned by \code{kwb.abimo:::read_config}
4- # ' @return list with elements \code{"potentialEvaporation "},
5- # ' \code{"runoffFactors "}, \code{"bagrovValues "}, \code{"diverse"},
6- # ' \code{"resultDigits "}
4+ # ' @return list with elements \code{"potential_evaporation "},
5+ # ' \code{"runoff_factors "}, \code{"bagrov_values "}, \code{"diverse"},
6+ # ' \code{"result_digits "}
77# ' @export
88abimo_config_to_config <- function (abimo_config )
99{
@@ -28,16 +28,16 @@ abimo_config_to_config <- function(abimo_config)
2828 expand_district_ranges() %> %
2929 all_columns_to_int() %> %
3030 rename_columns(list (eg = " etp" )) %> %
31- cbind(etps = - 1L , isWaterbody = TRUE )
31+ cbind(etps = 0 , is_waterbody = TRUE )
3232
3333 evap_else <- result %> %
3434 select_elements(element_else ) %> %
3535 expand_district_ranges() %> %
3636 all_columns_to_int() %> %
37- cbind(isWaterbody = FALSE )
37+ cbind(is_waterbody = FALSE )
3838
39- result [[" potentialEvaporation " ]] <- rbind(evap_water , evap_else ) %> %
40- move_columns_to_front(" isWaterbody " )
39+ result [[" potential_evaporation " ]] <- rbind(evap_water , evap_else ) %> %
40+ move_columns_to_front(" is_waterbody " )
4141
4242 convert_element <- function (config , from , to , convert = identity ) {
4343 x <- select_elements(config , from )
@@ -48,19 +48,19 @@ abimo_config_to_config <- function(abimo_config)
4848 remove_elements(config , from )
4949 }
5050
51- result %> %
51+ result <- result %> %
5252 remove_elements(c(
5353 element_water ,
5454 element_else
5555 )) %> %
5656 convert_element(
5757 from = " Infiltrationsfaktoren" ,
58- to = " runoffFactors " ,
58+ to = " runoff_factors " ,
5959 convert = function (x ) 1 - as.numeric(x )
6060 ) %> %
6161 convert_element(
6262 from = " Bagrovwerte" ,
63- to = " bagrovValues " ,
63+ to = " bagrov_values " ,
6464 convert = as.numeric
6565 ) %> %
6666 convert_element(
@@ -69,9 +69,15 @@ abimo_config_to_config <- function(abimo_config)
6969 ) %> %
7070 convert_element(
7171 from = " ErgebnisNachkommaStellen" ,
72- to = " resultDigits " ,
72+ to = " result_digits " ,
7373 convert = as.numeric
7474 )
75+
76+ result [[" precipitation_correction_factor" ]] <- as.numeric(
77+ select_elements(result , " diverse" )[[" NIEDKORRF" ]]
78+ )
79+
80+ result
7581}
7682
7783# get_all_item_data ------------------------------------------------------------
0 commit comments