# Water preprocessor

## Contents

# Series pulled into water preprocessor

Table | Definition | Source | Notes | Last IFs Update |

SeriesWaterFossilWithdrawal | Water withdrawal from fossil water aquifers | UNESCO Non-Renewable Groundwater Report 2006 | SGH | 2014/08/29 |

SeriesWaterResFossil | Water withdrawal from fossil water aquifers | UNESCO Non-Renewable Groundwater Report 2006; Aquastat country profiles | SGH | 2014/08/29 |

SeriesWaterResGroundAfrica | Water withdrawal from fossil water aquifers for African countries | Quantitative maps of groundwater resources in Africa | SGH | 2014/08/29 |

SeriesWasterwaterTreated | Wastewater: treated volume (10^9 m3/yr) |
AQU BATCH PULL | KK,JM | 2016/05/21 |

SeriesWastewaterProduced | Wastewater: produced volume (10^9 m3/yr) |
AQU BATCH PULL | KK,JM | 2016/05/21 |

SeriesWastewaterTreatedReused | Treated wastewater reused (10^9 m3/yr) |
AQU BATCH PULL | KK,JM | 2016/05/21 |

SeriesWaterDesalinated | Desalinated Water Produced | AQU BATCH PULL | KK,JM | 2016/05/21 |

SeriesWaterGroundWithD | Ground Water Withdrawal | AQU BATCH PULL | KK,JM | 2016/05/21 |

SeriesWaterResExploitGround | Exploitable: regular renewable groundwater (10^9 m3/yr) | AQU BATCH PULL | KK,JM | 2016/05/21 |

SeriesWaterResExploitSurface | Exploitable: total renewable surface water (10^9 m3/yr) | AQU BATCH PULL | KK,JM | 2016/05/21 |

SeriesWaterResOverlap | Overlap between surface and groundwater | AQU BATCH PULL | KK,JM | 2016/05/21 |

SeriesWaterResTotalExploit | Water resources: total exploitable | AQU BATCH PULL | KK,JM | 2016/05/21 |

SeriesWaterResTotalRenew | Water resources: total renewable (actual) | AQU BATCH PULL | KK,JM | 2016/05/21 |

SeriesWaterResTotalRenewGround | Total renewable groundwater (actual) (10^9 m3/yr) | AQU BATCH PULL | KK,JM | 2016/05/21 |

SeriesWaterResTotalRenewSurface | Total renewable suface water (actual) | AQU BATCH PULL | KK,JM | 2016/05/21 |

SeriesWaterSurfaceWithD | Surface Water Withdrawal | AQU BATCH PULL | KK,JM | 2016/05/21 |

SeriesWaterTotalWithdSources | Total water withdrawal (summed by sources) | AQU BATCH PULL | KK,JM | 2016/05/21 |

SeriesWaterWithdAgriculture | Agricultural water withdrawal | AQU BATCH PULL | KK,JM | 2016/05/21 |

SeriesWaterWithdIndustrial | Industrial water withdrawal | AQU BATCH PULL | KK,JM | 2016/05/21 |

SeriesWaterWithdMunicipal | Municipal water withdrawal | AQU BATCH PULL | KK,JM | 2016/05/21 |

SeriesLandIrActual%Equip | Area equipped for irrigation: actually irrigated, % | AQU BATCH PULL | KK;JM | 2016/06/06 |

# Water demand

Start with demand. Read in water demand data by sector (municipal, industrial, agriculture, and total) and fill holes if we have 3 of those 4. Then fill holes for each sector using the same equations we would use to forecast those variables. Then normalize with total water demand (by sector) if there are data.

## Fill holes

If we have 3 of the 4 components of water demand (municipal, industrial, agriculture, and total by sector) then we can deduce the 4th.

For example,

$ WatWithdMun_c=WatWithdTotalSector_c-WatWithdInd_c-WatWithdAg_c $

We do the same for each sector as well as WatWithdTotalSector.

## Municipal water demand

Use SeriesWaterWithdMunicipal to initialize municipal water demand (WatWithdMun).

If null, then calculate urban population:

$ UrbanPercent = POPURBAN_c / POP_c $

Then estimate municipal water demand using the equation: "MunDemandPC (Linear) versus GDP2011PCPPP(MOSTRECENT) (Log) AND Connections" which is in AnalFunc.

$ Prediction = (x_1*ln(GDPPCP_c)) + (x_2*ln(UrbanPercent)) + (x_3*ln(WATSAFE_{c,3})) + b $

Multiply municipal water demand per capita by the size of the urban population.

$ WatWithdMun_c = Prediction * POPURBAN_r $

## Industrial water demand

Use SeriesWaterWithdIndustrial to initialize industrial water demand (WatWithdInd).

If null, then estimate using manufacturing value added. The equation is, "WaterWithdIndustrial(MOSTRECENT minus elec) (Linear) versus Man (Linear)" and is in TablFunc.

$ Prediction = x_c*VADD_{c,manufacturing} $

## Agricultural water demand

Initialize agriculture water demand using SeriesWatWithdAg. If null, estimate using land irrigated.

Initialize land irrigated (LANDIRAREAACTUAL) using SeriesLandIrActual%Equip.

If null, set to 90 (percent).

Multiply by land equipped for irrigation:

$ LANDIRAREAACTUAL_r = LANDIRAREAACTUAL_c * (CLandIrAreaEquip_c / 100) $

If LANDIRAREAACTUAL is still null, then set to 0.001.

Use LANDIRAREAACTUAL to estimate agricultural water demand using the equation: "WaterWithdAgriculture(MOSTRECENT) (Linear) versus Irrigated land (Linear)"

$ WatWithdAg_c=x*LANDIRAREAACTUAL_c+b $

## Normalize with total demand

If we have data for total water demand (WatWithdTotalSector) but it does not match with the sum of our sectors, we normalize the sectors to match the total data. For example,

$ WatWithdMun_c=(WatWithdMun_c/WatTotalDemand)*WatWithdTotalSector_c $

where

$ WatTotalDemand = \sum_{sector}^3 WaterDemand_{c,sector} $

## Water withdrawal growth rates

Initialize water withdrawal growth rates (WaterWithdrawalSurfaceGR, WaterWithdrawalGroundGR, WaterWithdrawalFossilGroundGR) using the "getAnnualGrowthRate" function and the tables: SeriesWatWithdSurface, SeriesWatWithDGround, and SeriesWatWithDFossilGround.

# Total and exploitable renewable resources

Initialize total renewable surface water resources (WatResTotalRenewSurface) using SeriesWaterResTotalRenewSurface.

Initialize total renewable groundwater resources (WatResTotalRenewGround) using SeriesWaterResTotalRenewGround.

Initialize total renewable water resources (WatResTotalRenew) using SeriesWaterResTotalRenew.

### Fill holes

If WatResTotalRenewGround is null but WatResTotalRenewSurface and WaterResTotalRenew are not null, then:

$ WatResTotalRenewGround_c=WaterResTotalRenew_c-WatResTotalRenewSurface_c $

If WatResTotalRenewSurface is null, but WatResTotalRenewGround and WaterResTotalRenew are not null, then:

$ WatResTotalRenewSurface_c=WaterResTotalRenew_c-WatResTotalRenewGround_c $

If WaterResTotalRenew is null, but WatResTotalRenewGround and WatResTotalRenewSurface are not null, then:

$ WaterResTotalRenew_c=WatResTotalRenewGround_c+WatResTotalRenewSurface_c $

If we do not have data for any of them, estimate total using land area:

$ WaterResTotalRenew_c=x*LANDAREA_c $

and then assume surface water is 71 percent of total and ground water is 29 percent.

$ WatResTotalRenewGround_c = 0.29 * WaterResTotalRenew_c $

$ WatResTotalRenewSurface_c = 0.71 * WaterResTotalRenew_c $

If we only have data for total, then assume surface is 71 percent and groundwater is 29 percent.

If we only have surface then assume surface is 71 percent of total:

$ WaterResTotalRenew_c = WatResTotalRenewSurface_c / 0.71 $

and that groundwater is 29 percent of total.

If we only have data for groundwater then assume groundwater is 29 percent of total:

$ WaterResTotalRenew_c=WatResTotalRenewGround_c / 0.29 $

and that surface is 71 percent of total.

Subtract overlap between surface and groundwater out. Initialize overlap with SeriesWaterResOverlap.

$ WatResTotalRenewSurface_c=\dfrac{WatResTotalRenewSurface_c}{WaterResTotalSurfaceGround_c}*(WaterResTotalSurfaceGround_c-Overlap_c) $

$ WatResTotalRenewGround_c=\dfrac{WatResTotalRenewGround_c}{WaterResTotalSurfaceGround_c}*(WaterResTotalSurfaceGround_c-Overlap_c) $

If we have data for total renewable water resources (TRWR) but not TRWR surface and ground then we estimate based on the total using global averages. If we do not have data for exploitable surface and ground water resources we estimate using TRWR surface and ground resources.

If WatResTotalRenewGround is still 0 then: $ WatResTotalRenewGround_c=0.29*WaterResTotalRenew_c $

If WatResTotalRenewSurface is still 0 then: $ WatResTotalRenewSurface_c=0.71*WaterResTotalRenew_c $

If WatResExploitRenewGround is 0 then: $ WatResExploitRenewGround_c=0.89*WatResTotalRenewGround_c $

If WatResExploitRenewSurface is 0 then: $ WatResExploitRenewSurface_c=0.36*WatResTotalRenewSurface_c $

WatResExploitRenewSurface was initialized using SeriesWaterResExploitSurface and WatResExploitRenewGround was initialized using SeriesWaterResExploitGround.

If total exploitable is 0 then use sum of surface and ground: $ WaterResTotalExploit_c=WatResExploitSurface_c+WatResExploitRenewGround_c $

If total renewable is still 0 then use sum of surface and ground: $ WaterResTotalRenew_c=WatResTotalRenewSurface_c+WatResTotalRenewGround_c $

# Withdrawals (by source)

AQUASTAT includes fossil water withdrawals in their groundwater withdrawal data so we must subtract it out.

$ WatWithDGround_c=WatWithDGround_c-WatWithDFossilGround_c $

The fossil water reserve data we have (WaterResGroundAfrica) also includes both renewable and fossil, so we must subtract out renewable.

$ WATERRESFOSSIL_c=WaterResGroundAfrica_c-WatResTotalRenewGround_c $

If we do not have fossil water data resources (WATERRESFOSSIL) but we do have fossil water withdrawals (WatWithDFossilGround) then we estimate that withdrawals are 10 percent of reserves.

$ WATERRESFOSSIL_c=10*WatWithDFossilGround_c $

If we have no data for either fossil water reserves or withdrawals, then assume they are 0.

If we have data for both total renewable withdrawals and groundwater withdrawals, we estimate surface water withdrawals:

$ WatWithDSurface_c=WatWithDTotalSources_c-WatWithDGround_c $ [check this]

If we have data for both total renewable withdrawals and surface water withdrawals, we estimate groundwater withdrawals:

$ WatWithDGround_c=WatWithDTotalSources_c-WatWithDSurface_c $

If we have total water withdrawal, but not for surface and ground then we estimate using global averages:

$ WatWithDSurface_c=0.67*WatWithDTotalSources_c $ $ WatWithDGround_c=0.33*WatWithDTotalSources_c $

If we do not have data for total withdrawals, or surface, or ground, then estimate total using demand and then global averages for surface and ground.

$ WatWithDSurface_c=0.67*TotalDemand_c $ $ WatWithDGround_c=0.33*TotalDemand_c $ [make sure this is OK, feel like we're missing the third piece in this branch of the logic]

# Wastewater

Initialize produced wastewater (WastewaterProduced) using **SeriesWastewaterProduced**

Initialize treated wastewater (WastewaterTreated) using **SeriesWasterwaterTreated**

Initialize treated and reused wastewater (WastewaterTreatedReused) using **SeriesWastewaterTreatedReused**

If we have data for both wastewater produced and wastewater treated and the data says that treated > produced we change volume treated to a portion of produced. This is because a country cannot treat more wastewater than is produced and is probably from a problem in taking the most recent data i.e. we are taking different years for treated v. produced.

If WastewaterTreated > WasteWaterProduced then

$ WastewaterTreated_c=0.95*WastewaterProduced_c $

The same logic that applies to the relationship between treated wastewater and produced wastewater applies to the relationship between treated wastewater and treated-and-reused wastewater i.e. if we have data for both and treated and reused exceeds treated then we know there is a problem with the data and assume that the country reused 95% of treated wastewater.

If WastewaterTreatedReused > WastewaterTreated then

$ WastewaterTreatedReused_c=0.95*WastewaterTreated_c $

If we do not have data for wastewater produced then we estimate using municipal water demand.

$ WastewaterProduced_c=x*WatWithDMun_c+b $

If treated wastewater is still greater than produced wastewater then that means that there was data for treated wastewater but not produced wastewater and that the equation we used to estimate produced wastewater (using Mun demand) was an underestimation. We correct for this by assuming these countries treat 80% of their produced wastewater.

If WastewaterTreated > WastewaterProduced then $ WastewaterProduced_c=WastewaterTreated_c*1.2 $

If WastewaterTreated is still 0 then use GDP per capita (2011) to estimate the portion of produced wastewater that's treated. The equation is called: "WastewaterTreated pct of produced (Linear) versus GDP2011PCPPP(MOSTRECENT) (Log)"

$ TreatedPortionProduced_c=x*GDPPCP_c+b $ $ WastewaterTreated_c=TreatedPortionProduced_c*WastewaterProduced_c $

If WastewaterTreatedReused is still null, then assume it is 66 percent of WastewaterTreated $ WasteWaterTreatedReused_c=0.66*WastewaterTreated_c $

# Total water supply

Before calculating total water supply, we need to add secondary water into exploitable surface water. Secondary water is treated wastewater that is not directly reused.

$ WatResExploitRenewSurface_c+WatResExploitRenewSurface_c+WastewaterTreated_c-WastewaterTreatedReused_c $

Calculate total water supply

$ WATERTOTALSUPPLY_c=WatWithDFossilGround_c+WatResExploitRenewSurface_c+WatResExploitRenewGround_c+WastewaterTreatedReused_c+WATERDESALINATED_c $