Reusing wastewater for agricultural irrigation: a Nexus assessment in the North Western Sahara Aquifer System
This is the repository containing the model scripts used for the paper "Reusing wastewater for agricultural irrigation: a Nexus assessment in the North Western Sahara Aquifer System". The entire results of the paper can be replicated by running this scripts.
Download or git clone
this repository and install the required python packages found in the environment.yml
file. If you use conda
, create a new environment with the required packages by running the following command in the bash:
conda env create -n name-of-environment -f environment.yml
After succesfully creating the environment activate it running conda activate name-of-environment
.
Note: replace name-of-environment
with a name of you choice.
Geospatial characteristics of the NWSAS were obtained from open sources as described in table 1. All data layers were converted into matching units, re-projected into the Sud Algerie Degree projection (ESRI: 102592), re-scaled to the same resolution and, in the case of the groundwater quality layer, interpolated to extend the data to the entire analysed area. Furthermore, all layers were merged into a large data frame.
Table 1. Geographic Information System data sources.
Layer | Coverage | Format | Resolution | Year | Source |
---|---|---|---|---|---|
Population | Algeria, Tunisia, Libya | raster (tif) | 100 m grid cell | 2015 | WorldPop |
Depth to groundwater | Africa | txt table | 5 km grid cell | 2012 | British Geological Survey |
Administrative boundaries | Algeria, Tunisia, Libya | shapefile | Level 1 (provinces) polygons | 2015 | GADM |
Transboundary aquifers borders | Global | shapefile | Individual polygons | 2015 | IGRAC |
Groundwater quality | NWSAS Basin | data points | 206 data points | 2016 | Provided by regional Authorities1 |
Land cover | Africa | raster (tif) | 20 m grid cell | 2016 | ESA Climate Change Initiative |
Climate data | Global | raster (tif) | 30 arc second, monthly | 1970-2000 | WorldClim |
1 Available upon request to the authors
More details about this process can be found in the respective publication and its supplementary material. In addition, a test dataframe test_data_10km.csv
with 10X10 km resolution, is provided in this repository for testing purposes.
To run the model, first you need to calculate the water requirements from agriculture. In this study, the FAO-56 Penman-Monteith method was used to compute cropland water requirements based on evapotranspiration. The Python package Pyeto was used for such purpose and everything is condenced in the Jupyter notebook Ag Eto model/water_demand_runner.ipynb
, which makes use of a class with several methods defined as a nexus_tool
(this tool under ongoing development in KTH). To run such model open the aforementioned notebook and follow the steps. This process, should provide a ne data frame, containing all the features from the GIS analysis and the features related to the cropland water requirements.
To run the model, run python to the runner.py
file (make shure that the previously created environment is activated). Some text will be printed in the console asking to choose and option:
Select module: 1) Scenario analysis 2) Graphics 3) Cancel:
Select option 1 to run calculations and option 2 to generate results graphics based on previous calculations. If option 1 is selected, the programe will ask for the file containing the scenarios information, i.e. the Scenarios.xlsx
file:
Enter the path for the excel file containing all scenarios specifications: Scenarios.xlsx
The program will read the data contained in the file and will ask to specify which scenarios should it run:
The following scenarios were found, 1) WWR per cluster, 2) Priv ag water - Low pop water, 3) Priv ag water - High pop water, 4) Sub ag water - Low pop water, 5) Sub ag water - High pop water, 6) Free ag water - Low pop water, 7) Free ag water - High pop water, please write the number of the scenarios that you want to run separated by commas, or type "all" to run all scenarios:
You should select the scenarios you whish to run by writing the numbers separated by commas (e.g. 1, 2, 3) or type "all" to run all scenarios. Then, the program will ask for the name of the file containing the population wastewater treatment technologies to evaluate Treatment Systems - population.xlsx
:
Enter the path for the excel file containing all population treatment systems specifications: Treatment Systems - population.xlsx
Similarly, it will aks for the name of the file containing the agriculture wastewater treatment technologies to evaluate Treatment Systems - agriculture.xlsx
:
Enter the path for the excel file containing all agricultural treatment systems specifications: Treatment Systems - agriculture.xlsx
Then, it will give two options:
1) Create dataframe from separate layer files, 2) Load dataframe from file, 3) Cancel:
Option 1 will ask for a path where all the GIS layers needed for the analysis are contained in individual csv files (each file should contain the feature values and the coordinates X and Y). A dataframe would be created out of the layers found in such path. If option 2 is selected, the name/path of the input file should be provided nwsas_10km_data.gz
:
Enter the name of the input file: nwsas_10km_data.gz
Then the cell size of the data will be required, being 10 sqkm for the test data provided in this repository:
Enter the cell area size in km: 10
Then, the program gives the option of running each selected scenario at a time, or to run all the procedures for all scenarios:
1) Run the "WWR per cluster" scenario 2) Run all procedures on all scenarios 3) Skip scenario:
After this step, the program will start the calculations, will give feedback on which process is being excecuted and will report the elapsed time at the end:
Show output
------------------------------
Running WWR per cluster scenario
------------------------------
Calibrating population...
- Region Algeria...
- Region Tunisia...
- Region Libya...
Calibrating irrigation area and calculating irrigation water needs...
- Region Algeria...
- Region Tunisia...
- Region Libya...
Calculating population water needs...
- Region Algeria...
- Region Tunisia...
- Region Libya...
Calculating Groundwater Stress indicator...
- Region Algeria...
- Region Tunisia...
- Region Libya...
Calculating groundwater pumping energy intensity...
- Region Algeria...
- Region Tunisia...
- Region Libya...
Calculating groundwater desalination energy intensity...
- Region Algeria...
- Region Tunisia...
- Region Libya...
Calculating irrigation energy needs...
- Region Algeria...
- Region Tunisia...
- Region Libya...
Running clustering algorithm for population and irrigated land areas...
Calculating per-cluster data...
Calculating final water extractions and reuse share...
Calculating ExtendedAeration treatment system CAPEX, OPEX and energy requirements...
Calculating Membrane Bioreactor treatment system CAPEX, OPEX and energy requirements...
Calculating SequencingBatchReactor treatment system CAPEX, OPEX and energy requirements...
Calculating RotatingBiologicalContractors treatment system CAPEX, OPEX and energy requirements...
Calculating IntermittentSandFilter treatment system CAPEX, OPEX and energy requirements...
Calculating TricklingFilter treatment system CAPEX, OPEX and energy requirements...
Calculating MovingBedBiofilmReactor treatment system CAPEX, OPEX and energy requirements...
Calculating PondSystem treatment system CAPEX, OPEX and energy requirements...
Calculating Wetlands treatment system CAPEX, OPEX and energy requirements...
Calculating LCOWs for each treatment technology:
Calculating ExtendedAeration treatment system LCOW...
Calculating Membrane Bioreactor treatment system LCOW...
Calculating SequencingBatchReactor treatment system LCOW...
Calculating RotatingBiologicalContractors treatment system LCOW...
Calculating IntermittentSandFilter treatment system LCOW...
Calculating TricklingFilter treatment system LCOW...
Calculating MovingBedBiofilmReactor treatment system LCOW...
Calculating PondSystem treatment system LCOW...
Calculating Wetlands treatment system LCOW...
Choosing the least-costs treatment system based on LCOW...
Calculating final energy requirements...
Calculating final Groundwater Stress indicator...
- Region Algeria...
- Region Tunisia...
- Region Libya...
Creating results files...
- Saving Centroid layer...
- Saving GroundwaterStress layer...
- Saving GroundwaterStressEnd layer...
- Saving LeastCostSystem layer...
- Saving Cluster layer...
- Saving IrrigatedArea layer...
- Saving WWR per cluster scenario dataframe...
Total enlapsed time
0 hours, 1 min, 23.79 sec