@@ -78,14 +78,16 @@ if (FALSE)
7878# Working with targets in the "new" reference system ---------------------------
7979if (FALSE )
8080{
81- # Statistics on measure implementation in new reference system (share of total
82- # area)
83- get_measure_stats_new(blocks )
81+ # Statistics on measures in new reference system (shares of total area)
82+ kwb.rabimo :: get_measure_stats(blocks , reference_system = 2 )
8483
85- # Convert new targets (all percentages referring to total area) to targets
86- # that are expected by distribute_measures()
84+ # Define targets in new reference system (all shares referring to total area)
8785 new_targets <- list (green_roof = 0.259 , unpaved = 0.5 , to_swale = 0.67 )
8886
87+ # Convert targets in new reference system to targets in old reference system
88+ # that is expected by distribute_measures(). In the old system, the shares
89+ # relate to areas that are specific to the measure (e.g. green_roof is related
90+ # to the area of roofs, to swale is related to the area of sealed surfaces).
8991 targets <- rescale_target_values(
9092 new_targets ,
9193 total_area = sum(kwb.rabimo ::: get_main_area(blocks )),
@@ -358,78 +360,6 @@ rescale_target_values <- function(
358360 list (green_roof = green_roof , unpaved = unpaved , to_swale = to_swale )
359361}
360362
361- # get_measure_stats_new --------------------------------------------------------
362- get_measure_stats_new <- function (blocks , refer_to_total = TRUE )
363- {
364- # blocks <- kwb.rabimo::rabimo_inputs_2020$data
365- get <- kwb.utils :: createAccessor(blocks )
366-
367- total_areas <- get(" total_area" )
368- roofs <- get(" roof" )
369- pvds <- get(" pvd" )
370-
371- area_total <- sum(total_areas )
372- area_roof <- sum(total_areas * roofs )
373- area_green_roof <- sum(total_areas * roofs * get(" green_roof" ))
374- area_pvd <- sum(total_areas * pvds )
375- area_unpvd <- sum(total_areas * (1 - roofs - pvds ))
376- area_sca <- sum(total_areas * (roofs + pvds ) * get(" to_swale" ))
377- area_sealed <- area_roof + area_pvd
378-
379- mean_roof <- area_roof / area_total
380- mean_pvd <- area_pvd / area_total
381-
382- mean_green_roof <- if (refer_to_total ) {
383- area_green_roof / area_total
384- } else {
385- area_green_roof / area_roof
386- }
387-
388- mean_unpvd <- area_unpvd / area_total
389-
390- mean_sca <- if (refer_to_total ) {
391- area_sca / area_total
392- } else {
393- area_sca / area_sealed
394- }
395-
396- max_green_roof <- if (refer_to_total ) mean_roof else 1
397- max_unpvd <- 1 - mean_roof
398- max_sca <- if (refer_to_total ) {
399- 1 - mean_unpvd
400- } else {
401- 1
402- }
403-
404- # area_total <- sum(kwb.rabimo:::get_main_area(blocks))
405- # area_green_roof <- sum(kwb.rabimo:::get_green_roof_area(blocks))
406- # area_roof <- sum(kwb.rabimo:::get_roof_area(blocks))
407- # area_unpvd <- sum(kwb.rabimo:::get_unpaved_area(blocks))
408- # area_pvd <- sum(kwb.rabimo:::get_paved_area(blocks))
409- # area_sca <- sum(kwb.rabimo:::get_to_swale_area(blocks))
410- # area_sealed <- sum(kwb.rabimo:::get_sealed_area(blocks))
411- #
412- # mean_green_roof <- area_green_roof / area_total
413- # max_green_roof <- area_roof / area_total
414- # mean_unpvd <- area_unpvd / area_total
415- # max_unpvd <- area_pvd / area_total
416- # mean_sca <- area_sca / area_total
417- # max_sca <- area_sealed / area_total
418-
419- cbind(
420- mean = c(
421- green_roof = mean_green_roof ,
422- unpaved = mean_unpvd ,
423- to_swale = mean_sca
424- ),
425- max = c(
426- green_roof = max_green_roof ,
427- unpaved = max_unpvd ,
428- to_swale = max_sca
429- )
430- )
431- }
432-
433363# check_distribution -----------------------------------------------------------
434364check_distribution <- function (
435365 green_roof_table ,
0 commit comments