```{css, echo=FALSE} .pagedtable-wrapper { border: unset; } .pagedtable-not-empty .pagedtable-footer { border-top: unset; } .pagedtable-header-name { overflow: unset; }
```r library(rmarkdown) library(shiny) # Load this development package devtools::load_all(".") th <- function(hc, ...) hc %>% hc_legend(enabled=TRUE, align="right") %>% hc_tooltip(valueSuffix="km³") %>% hc_xAxis(type="datetime", dateTimeLabelFormats=list(month="%Y %b")) %>% hc_rangeSelector(enabled=FALSE) %>% hc_navigator(enabled=FALSE) %>% hc_scrollbar(enabled=FALSE) %>% hc_chart(zoomType="x") %>% hc_themed(...)
# Verify data periodicity data <- DATA[iso3=="ken"] data[, .N, by=.(sheet, period)]
Collection of visuals for WA Dashboard. Variable codes and definitions are in this shared catalog.
(1 – (outflow[^s1] / gross inflow[^s1])) * 100
# Yearly dt <- data[id %in% c("outflow", "gross_inflow") & period=="year"] dt <- dcast(dt, ...~id)[, value := 100 * (1 - (outflow / gross_inflow))] plot_ts(dt, name="Pct. basin closure", unit="%", title="Mara Basin Closure")
available water[^s1] / population[^ext]
# Basin population from config tot_pop <- ISO3[["ken"]]$population # Yearly dt <- data[id %in% c("available_water") & period=="year"] dt <- dcast(dt, ...~id)[, value := 1E9 * (available_water) / tot_pop] plot_ts(dt, name="Per Capita Water Consumption", unit="m³", title="Mara Basin Per Capita Water Consumption")
Intra-annual summary below shows entire period statistics and 3 most recent years (can also be displayed as a polar/circular, see end of page).
# Monthly profile dt <- data[id %in% c("available_water") & period=="month"] dt <- dcast(dt, ...~id)[, value := 1E9 * available_water / tot_pop] plot_profile(dt, unit="m³", title="Mara Basin Per Capita Water Consumption")
(utilizable outflow[^s1])
# Yearly dt <- data[id %in% c("utilized_flow") & period=="year"] dt <- dcast(dt, ...~id)[, value := 1000 * utilized_flow] plot_ts(dt, name="Utilizable Outflow", unit="MCM", title="Mara Basin Utilizable Outflow")
((managed water use[^s2] – non-ag ET[^s2]) / water consumed[^s1])
# Yearly time-series dt <- data[id %in% c("molu_et", "malu_et", "consumed_water", "molu_settlements_et", "molu_others_et", "malu_waterbodies_et", "malu_residential_et", "malu_industry_et", "malu_idomestic_et", "malu_iindustry_et", "malu_powerandenergy_et", "malu_others2_et") & period=="year"] dt <- dcast(dt, year+month+date_end+date_start~id)[, value := 100 * ( + molu_et + malu_et - molu_settlements_et - molu_others_et - malu_waterbodies_et - malu_residential_et - malu_industry_et - malu_idomestic_et - malu_iindustry_et - malu_powerandenergy_et - malu_others2_et ) / consumed_water] plot_ts(dt, name="Ag. water use", unit="%", title="Agricultural water use")
# Monthly dt <- data[id %in% c("molu_et", "malu_et", "consumed_water", "molu_settlements_et", "molu_others_et", "malu_waterbodies_et", "malu_residential_et", "malu_industry_et", "malu_idomestic_et", "malu_iindustry_et", "malu_powerandenergy_et", "malu_others2_et") & period=="month"] dt <- dcast(dt, year+month+date_end+date_start~id)[, value := 100 * ( + molu_et + malu_et - molu_settlements_et - molu_others_et - malu_waterbodies_et - malu_residential_et - malu_industry_et - malu_idomestic_et - malu_iindustry_et - malu_powerandenergy_et - malu_others2_et ) / consumed_water] plot_profile(dt, name="Ag. water use", unit="%", title="Agricultural water use")
(percentage of time (months in the time series) during which environmental flows are not met) – Manohar/Mansoor to advise calculation from CSV WA output).
We use a low threshold value (e.g. < 0.05 km³). More details to follow.
threshold = 0.05 # Yearly time-series dt <- data[id %in% c("reserved_outflow") & period=="month"] dt <- dcast(dt, ...~id)[, value := reserved_outflow ][, .( date_end = max(date_end), date_start = min(date_end), value = 100 * sum(value <= threshold, na.rm=T)/.N ), by=.(iso3, year)] plot_ts(dt, name="Insuffient Flow", unit="%", title="Mara Basin - Environmental Stress", subtitle=sprintf("2003-2017 (%% of months in period below %s km³)", threshold) )
(inter and intra-annual min and max over the time series)
Add option in dashboard for users to toggle units between volume and height?
wzxhzdk:9 wzxhzdk:10 Intra-annual variability can also be shown as a polar chart: wzxhzdk:11 # Other Diagrams Using a chord diagram to show water allocation between agricultural and non-ag. uses (or other breakdowns). wzxhzdk:12 Using a Sankey graph to show ET allocation across land use categories (can be used to show a different combination of variables). wzxhzdk:13 Based on additional graphs found in WA+ basin reports. wzxhzdk:14 wzxhzdk:15
Verify definitions of inflow and outflow above.
[^s1]: Indicator from resource base sheet [^ext]: Indicator from external database [^s2]: Indicator from ET sheetAdd the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.