BACKGROUND

The Nile Basin is home to over 257 million people, which is about 54% of the total population of the 11 countries that share the Nile. The Nile Basin has hugely diverse ecosystems with a significant part classified as arid and semi-arid. These diverse ecosystems coupled with the diverse climatic zones have been observed to determine the distribution of the population within the basin.

Ethiopia’s Grand Ethiopian Renaissance Dam project, on the Blue Nile, threatens downstream countries (Egypt and Sudan) current water supply. The dam will create a huge reservoir once the project is completed.

library(dplyr)
library(reshape2)
library(readxl)
library(plotly)
WR <- read_excel("C:/Users/Ahmed Adham/Desktop/CAP - FINAL PROJECT/EASTERN NILE FINAL.xlsx")

Plots

a) Yearly renewable and available water resources in the Nile Basin countries

In computing water resources on a country basis, a distinction is to be made between renewable and non-renewable water resources. • Renewable water resources are computed on the basis of the water cycle. In this report, they represent the long-term average annual flow of rivers (surface water) and groundwater. • Non-renewable water resources are groundwater bodies (deep aquifers) that have a negligible rate of recharge on the human time-scale and thus can be considered non-renewable.

Natural renewable water resources are the total amount of a country’s water resources (internal and external resources), both surface water and groundwater, which is generated through the hydrological cycle. The amount is computed on a yearly basis.

Internal renewable water resources (IRWR) is that part of the water resources (surface water and groundwater) generated from endogenous precipitation (Figure 3). The IRWR figures are the only water resources figures that can be added up for regional assessment and they are used for this purpose.

Where the external water resources are defined as the part of a country’s renewable water resources that enter from upstream countries through rivers (external surface water) or aquifers (external groundwater resources). The total external resources are the inflow from neighbouring countries (transboundary flow) and a part of the resources of shared lakes or border rivers.

Most of the inflow consists of river runoff, but it can also consist of groundwater transfer between countries (e.g. between Belgium and France, Bulgaria and Romania, or Sudan and Egypt). However, groundwater transfers are rarely known and their assessment requires a good knowledge of the piezometry of the aquifers at the border.

# External and Internal Water resources 
df_EX <- subset(WR, abbrev == 'External')
df_IR <- subset(WR, abbrev == 'Internal')
# Combining the external and Internal together in the same dataframe
df_IR_EX <- rbind(df_EX,df_IR)
# Extracting the total available resources
df_total_resources <- subset(WR, abbrev == 'Total')
#Removing the CONGO, DR from the list because it will affect the size scale
df_TR<-df_total_resources[-2,]

#plot options
g <- list(scope = 'africa',
          showframe = F,
          showland = T,
          landcolor = toRGB("grey90"))
g1 <- c(g,resolution = 4000,
        showcoastlines = T,
        countrycolor = toRGB("black"),
        coastlinecolor = toRGB("black"),
        projection = list(type = 'Mercator'),
        list(lonaxis = list(range = c(16, 45))),
        list(lataxis = list(range = c(-12, 34))),
        list(domain = list(x = c(0, 1), y = c(0, 1))))
g2 <- c(g, showcountries = F,
        bgcolor = toRGB("white", alpha = 0),
        list(domain = list(x = c(0, 0.3), y = c(0, 0.3))))

Figure_1 <- df_IR_EX %>% plot_geo(locationmode = 'country names', sizes = c(1, 6000), color = I("black"))

Figure_1 <- Figure_1 %>% add_markers( y = ~Lat, x = ~Lon, locations = ~Country,
  size = ~Value, color = ~abbrev, text = ~paste(Value, "BCM"))

Figure_1 <- Figure_1 %>% add_text(
  x = 10, y = 12, text = 'Africa', showlegend = F, geo = "geo2")

Figure_1 <- Figure_1 %>% add_trace( data = df_TR, z = ~Value, locations = ~Country, color = 'value' , showscale = F, geo = "geo2")

Figure_1 <- Figure_1 %>% layout(
  title = 'FRESH WATER RESOURCES IN BCM - Nile Basin Countries <br> Source: FAO,2012',
  geo = g1, geo2 = g2)

Figure_1

b. Dependency ratio of Water resources in NB countries

Dependency ratio expresses the part of the total renewable water resources originating outside the country. This indicator may theoretically vary between 0% (the country does not receive water from neighbouring countries) and 100% (country receives all its water from outside without producing any). This indicator does not consider the possible allocation of water to downstream countries. In order to compare how different countries depend on external water resources, the dependency ratio is calculated. The dependency ratio of a country is an indicator expressing the part of the water resources originating outside the country.

NB_data <- read_excel("C:/Users/Ahmed Adham/Desktop/CAP - FINAL PROJECT/EASTERN NILE FINAL 2.xlsx")

Figure_2 <- plot_ly(NB_data, x = ~Country, y = ~DR, type = 'bar', text = 'DR',
               marker = list(color = c('rgb(158,202,225)','rgb(158,202,225)',
                                       'rgba(222,45,38,0.8)','rgba(222,45,38,0.8)',
                                       'rgb(158,202,225)','rgb(158,202,225)',
                                       'rgb(158,202,225)','rgba(222,45,38,0.8)',
                                       'rgb(158,202,225)','rgb(158,202,225)'),
                             line = list(color = 'rgb(8,48,107)',
                                         width = 1.5)))
Figure_2 <- Figure_2 %>% layout(title = "Dependancy ratios of renewable water resources <br> for Nile Basin countries",
                      xaxis = list(title = "Countries"),
                      yaxis = list(title = "Percentage"))

Figure_2

c) Population in the Nile Basin Countries

For this component, the focus was to collect the relevant and available population data for the Nile basin countries and the best source found for the years 1950-2020 was www.worldometers.info

g <- list(scope = 'africa', showframe = F, showland = T, landcolor = toRGB("white"))
g1 <- c(g,resolution = 4000, showcoastlines = T, countrycolor = toRGB("black"),
        coastlinecolor = toRGB("black"), projection = list(type = 'Mercator'),
        list(lonaxis = list(range = c(5, 50))), list(lataxis = list(range = c(-20, 40))), 
list(domain = list(x = c(0, 1), y = c(0, 1))))

Figure_3<- plot_geo(NB_data, locationmode = 'country names')

Figure_3 <- Figure_3 %>% add_trace(
  z = ~Population, locations = ~Country,
  color = ~Population, colors = 'Reds')

Figure_3 <- Figure_3 %>% colorbar(title = "Millions")

Figure_3 <- Figure_3 %>% layout(title = 'Populations in Nile Basin Countries, Year:2020 <br> Source: World Info Meters', geo = g1)

Figure_3

d) Renewable fresh water resources per capita

Renewable fresh water resources per capita is calculated by UNSD through dividing the total renewable fresh water resources by the total population of the country.

Hydrologists today typically assess water scarcity by looking at the population-water equation. This is done by comparing the amount of total available water resources per year to the population of a country. For example, a country or region is said to experience “water stress” when annual water supplies drop below 1,700 cubic metres per person per year. At levels between 1,700 and 1,000 cubic metres per person per year, periodic or limited water shortages can be expected. When water supplies drop below 1,000 cubic metres per person per year, the country faces “water scarcity”.

NB_data_new<-cbind(NB_data,df_total_resources$Value)

NB_data_new$WS_capita<- NB_data_new$`df_total_resources$Value`*1000000000/NB_data_new$Population

NB_data_new<-NB_data_new[-2,]

Figure_4 <- plot_ly(NB_data_new, x = ~Country, y = ~WS_capita, type = 'bar', text = 'WS_capita',name = 'Amount of Water in cubic meter',
                    marker = list(color = 'rgb(158,202,225)',
                                  line = list(color = 'rgb(8,48,107)',
                                              width = 0.5)))
Figure_4 <- Figure_4 %>% add_lines(y = ~1000, name = "WATER SCARCITY THRESHOLD<br> according to UN , below 1000 CM", line = list(shape = "linear",color = 'rgba(67,67,67,1)', size =200 , dash = 'dash')) 

Figure_4 <- Figure_4 %>% layout(title = "WATER SHARE PER CAPITA for Nile Basin countries <BR> YEAR:2020",
                                xaxis = list(title = "Countries"),
                                yaxis = list(title = "CUBIC METER", type = "log"))

Figure_4

e) Projection of population using linear regression till 2070 only for the Eastern Nile basin countries

Similar to oil and other fossil fuels, water is a finite resource, and the knowledge for world leaders to be able to manage a limited resource with a growing population will be critical in order to maintain or grow their nations’ prosperity.

A growing population that needs a higher demand for drinking water and water for agriculture shows that the shortages of water that are expected to affect many regions of the world will have severe consequences on the lives of millions of people. Thus, world leaders will need to find solutions in order to conserve and protect water resources for their countries, or find alternative methods to find new sources of water, such as desalination.

population_eastern_nile <- read_excel("C:/Users/Ahmed Adham/Desktop/CAP - FINAL PROJECT/EASTERN NILE YEARS AND POPULATION.xlsx")

#arranging the values based on ascending order from 1955 to 2020

population_arranged<- arrange(population_eastern_nile,Year)

#dividing the popultion by million
population_arranged$Population=population_arranged$Population/1000000

#based on the historical data estimates
# applying safeblind colors
#applying subsets for easy prediction of population

egy_pop<- subset(population_arranged,population_arranged$Country=='Egypt')
eth_pop<- subset(population_arranged,population_arranged$Country=='Ethiopia')
sud_pop<- subset(population_arranged,population_arranged$Country=='Sudan')

#Building the Model

  #FOR EGYPT
fit_egy = lm(data=egy_pop,formula= Population ~ Year)
summary(fit_egy)
## 
## Call:
## lm(formula = Population ~ Year, data = egy_pop)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -4.5508 -3.7318  0.2409  2.9508  7.1247 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -2.441e+03  8.328e+01  -29.32 2.46e-15 ***
## Year         1.257e+00  4.176e-02   30.10 1.63e-15 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 3.848 on 16 degrees of freedom
## Multiple R-squared:  0.9826, Adjusted R-squared:  0.9816 
## F-statistic: 906.2 on 1 and 16 DF,  p-value: 1.625e-15
  #FOR ETHIOPIA
fit_eth = lm(data=eth_pop,formula= Population ~ Year)
summary(fit_eth)
## 
## Call:
## lm(formula = Population ~ Year, data = eth_pop)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -11.558  -8.108   1.309   6.109  14.691 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -3.022e+03  1.813e+02  -16.66 1.56e-11 ***
## Year         1.548e+00  9.092e-02   17.03 1.13e-11 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 8.379 on 16 degrees of freedom
## Multiple R-squared:  0.9477, Adjusted R-squared:  0.9444 
## F-statistic:   290 on 1 and 16 DF,  p-value: 1.125e-11
  #FOR Sudan
fit_sud = lm(data=sud_pop,formula= Population ~ Year)
summary(fit_sud)
## 
## Call:
## lm(formula = Population ~ Year, data = sud_pop)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2.9864 -1.9235 -0.0628  1.5352  4.7121 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -1187.7398    49.4572  -24.02 5.60e-14 ***
## Year            0.6085     0.0248   24.54 4.01e-14 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 2.285 on 16 degrees of freedom
## Multiple R-squared:  0.9741, Adjusted R-squared:  0.9725 
## F-statistic:   602 on 1 and 16 DF,  p-value: 4.01e-14
egy_new = data.frame(Year=c(2030,2035,2040,2045,2050,2055,2060,2065,2070),Country = "Egypt")
eth_new = data.frame(Year=c(2030,2035,2040,2045,2050,2055,2060,2065,2070),Country = "Ethiopia")
sud_new = data.frame(Year=c(2030,2035,2040,2045,2050,2055,2060,2065,2070),Country = "Sudan")


# Make predictions
egy_new$Population = predict(fit_egy, newdata=egy_new)
eth_new$Population = predict(fit_eth, newdata=eth_new)
sud_new$Population = predict(fit_sud, newdata=sud_new)

#combining and arranging new data sets
egy_included<- rbind(population_arranged,egy_new)
eth_included<- rbind(egy_included,eth_new)
population_combined<- rbind(eth_included,sud_new)

pop_combined_arranged<- arrange(population_combined,Year)

#plotting predictions till 2070

colors <- c('#d7191c','#2c7bb6','#fdae61')

Figure_5 <- plot_ly(pop_combined_arranged, x = ~Year, y = ~Population, type = 'scatter', mode = 'lines+markers', color = ~Country, colors = colors,
                    hoverinfo = 'text',
                    text = ~paste('Year:', Year,'<br>Population:', Population))

Figure_5 <- Figure_5 %>% layout(title ='Predicted Population over the period 2030 - 2070 <br>based on linear regression analysis',
                                xaxis = list(showgrid = TRUE,title = 'YEARS'),
                                yaxis = list(title = 'POPULATION (millions)', showgrid = TRUE),
                                showlegend = TRUE)


Figure_5 <- layout(Figure_5, shapes = list(type = "rect", fillcolor = "light grey", opacity=0.7,
                                       x0 = "2025", x1 = "2075", xref = "x",
                                       y0 = 40, y1 = 185, yref = "y"))


Figure_5

The negative impact that humans will have on earths are finite resources, especially water, will become increasingly apparent, as many areas of the world (and in our case tudy in th eastern nile) will start to experience drastic shortages of water, leading to instability in food production, industry, social order, and political and military control.

f) Decay of Yearly Water Share per capita in Eastern Nile Basin countries till 2070

If current water resources are not properly regulated, an eventual increase in world population will become problematic. Overpopulation will strain current water resources to their limits, cause an increase in water pollution, and lead to an increase in civil and international conflicts over existing water supplies.

Eastern_Nile_data<- NB_data[c(3,4,8),c(1,4,7)]

Eastern_Nile_data$Year<-"2020"

Eastern_Nile_data<-Eastern_Nile_data[c(4,3,1,2)]

Eastern_Nile_data_WR<- Eastern_Nile_data[,4]

Eastern_Nile_data_pop<-Eastern_Nile_data[,c(1,2,3)]

Prediction_2030_2070<-filter(pop_combined_arranged, Year>2020)

Prediction_2030_2070$Population <-Prediction_2030_2070$Population*1000000

Eastern_nile_final<-rbind(Eastern_Nile_data_pop,Prediction_2030_2070)

EN_final<-cbind(Eastern_nile_final,Eastern_Nile_data_WR)

EN_final$WS_capita<- EN_final$Value*1000000000/EN_final$Population


Figure_6 <- plot_ly(EN_final, x = ~Year, y = ~WS_capita, type = 'bar',color = ~ Country)

Figure_6 <- Figure_6 %>% layout(yaxis = list(title = 'Count'), barmode = 'group')

Figure_6 <- Figure_6 %>% add_lines(y = ~500, name = "ABSOLUTE SCARCITY THRESHOLD<br>below 500 CM", line = list(shape = "linear",color = 'rgba(67,67,67,1)', size =200 , dash = 'dash')) 

Figure_6 <- Figure_6 %>% layout(title = "DECAY OF WATER SHARE PER CAPITA <br>EASTERN NILE BASIN <br> 2020 - 2070",
                                xaxis = list(title = "YEAR"),
                                yaxis = list(title = "CUBIC METER"),
                                barmode = 'group')
Figure_6

In order to limit the amount of chaos and conflict that will ensue over limited water resources, there needs to be compromise and cooperation between all countries, not just the nations that are water stressed; to provide water management techniques, newer and more efficient technology to conserve as much water as possible, and strict security and enforcement of all regulations to prevent groups and individuals using water to gain power.

The urgency of reaching an agreement for a reasonable and equitable sharing of benefits on the Nile Basin cannot be overstated. Apart from the need to manage a precious resource carefully, the process of reaching cooperation would create a stabilizing and more transparent atmosphere in the countries that depend on the Nile basin and especilly in the eastern Nile countries(Blue Nile).