diff --git a/src/lisfloodutilities/water-demand-historic/README.md b/src/lisfloodutilities/water-demand-historic/README.md index 3b805cd..90fb463 100644 --- a/src/lisfloodutilities/water-demand-historic/README.md +++ b/src/lisfloodutilities/water-demand-historic/README.md @@ -9,7 +9,7 @@ The global sectoral water demand maps at 3 arcmin (or 0.05 degrees) resolution, # Data The utility consists of five scripts which require several following datasets and files. The full list of datasets is provided below. For each dataset, this documentation provides the link and the instructions relative to available version at the time of creation of the scripts. The correct functioning of the scripts is guaranteed for those datasets. Clearly, updated versions are regularly published: one relevant example is [Global Human Settlement - Datasets - European Commission (europa.eu)](https://ghsl.jrc.ec.europa.eu/datasets.php) (see Global Human Settlement Layer (GHSL)). Albeit the functioning of the utility is expected to be maintained, the users are invited to report problems or suggestions via GitHub issues. -1. [FAO AQUASTAT](http://fao.org/aquastat/statistics/query/index.html?lang=en) sectoral water withdrawal estimates. Select "All Countries". Then Select the variable groups "Geography and population" and "Water use" (if needed select the subgroubps "Economy, development and food security" and "Water withdrawal by sector"). From these variable groups, select the following seven fields: "Gross Domestic Product (GDP)", "Industry, value added to GDP", "Agricultural water withdrawal", "Industrial water withdrawal", "Municipal water withdrawal", "Total water withdrawal", and "Irrigation water withdrawal". Select All Years, or manually select the years from 1976 to 2021. Select "Design your own" to add "Area","M49","Variable","Value","Year" fields if not present, then click on the "Show Data" button. Finally click on the "Download" button on the top right corner to download the csv file containing all data (or copy and paste the Table in CSV format shown in the web page to a csv file). Save the csv file as `aquastat_clean.csv` in `aquastat_folder` specified in the configuration file. +1. [FAO AQUASTAT](http://fao.org/aquastat/statistics/query/index.html?lang=en) sectoral water withdrawal estimates. Select "All Countries". Then Select the variable groups "Geography and population" and "Water use" (if needed select the subgroubps "Economy, development and food security" and "Water withdrawal by sector"). From these variable groups, select the following seven fields: "Gross Domestic Product (GDP)", "Industry, value added to GDP", "Agricultural water withdrawal", "Industrial water withdrawal", "Municipal water withdrawal", "Total water withdrawal", and "Irrigation water withdrawal". Select All Years, or manually select the years from 1976 to 2021. Select "Design your own" to add "Area","m49","Variable","Value","Year" fields if not present, then click on the "Show Data" button. Finally click on the "Download" button on the top right corner to download the csv file containing all data (or copy and paste the Table in CSV format shown in the web page to a csv file). Save the csv file as `aquastat_clean.csv` in `aquastat_folder` specified in the configuration file. 1. [Global Human Settlement Layer (GHSL)](https://human-settlement.emergency.copernicus.eu/ghs_pop2023.php) POP R2023A residential population estimates for target years from 1975 to 2020. You will find data as an archive [here](https://jeodpp.jrc.ec.europa.eu/ftp/jrc-opendata/GHSL/GHS_POP_GLOBE_R2023A/). For each year, download the 3 arcsec (folders ending by "_3ss"), e.g. "GHS_POP_E2015_GLOBE_R2023A_4326_3ss") maps in WGS84 projection and resample them to 0.01° using `gdalwarp -t_srs EPSG:4326 -tr 0.01 0.01 -r average -of GTiff GHS_POP_E_GLOBE_R2023A_4326_3ss_V1_0.tif GHS_POP_E_GLOBE_R2023A_4326_3ss_V1_0_reprojected.tif`, where `` is 1975 to 2020. We resample the maps using `average` instead of `sum` as the latter is broken. Put resampled files in `ghsl_folder`. You will need to specify also the 'ghsl_folder_factor = 144' to account for resampling from 0.000833 (3 arcsec) to 0.01 degrees. 1. [Global Change Analysis Model (GCAM)](https://github.com/JGCRI/gcam-core/releases) regional water withdrawal and electricity consumption estimates. Download the Windows release package version 7.1, execute `run-gcam.bat`, wait for the model to finish. Execute `run-model-interface.bat`, click "File" > "Open" > "DB Open", select `output/database_basexdb`, and select all scenarios and all regions. Select `water demand`, select `water withdrawals by sector`, and click "Run query". Select `energy transformation`, select `electricity`, select `elec consumption by demand sector`, and click "Run query". For each tab, select all data with ctrl-a and click "Edit" > "Copy". Open a blank [Google Sheets](http://sheets.google.com/) spreadsheet, press ctrl-v, manually add the headers, click "File" > "Download" > "Comma-separated values", save as `water_demand.csv` and `elec_consumption.csv`, respectively, and put both files in `gcam_folder`. 1. [Gridded Livestock of the World (GLW 3)](https://doi.org/10.1038/sdata.2018.227) species distribution dataset. Download the eight zip files (each representing a different species) and extract them to `glw_folder`. diff --git a/src/lisfloodutilities/water-demand-historic/step2_domestic_demand.py b/src/lisfloodutilities/water-demand-historic/step2_domestic_demand.py index b82f3b6..76d8207 100644 --- a/src/lisfloodutilities/water-demand-historic/step2_domestic_demand.py +++ b/src/lisfloodutilities/water-demand-historic/step2_domestic_demand.py @@ -174,7 +174,7 @@ def main(): country_code = country_codes.iloc[jj]['country-code'] # Find location of data in AQUASTAT table - sel = np.where((aquastat['M49']==country_code) & (aquastat['Variable Name']=='Municipal water withdrawal'))[0] + sel = np.where((aquastat['m49']==country_code) & (aquastat['Variable Name']=='Municipal water withdrawal'))[0] if len(sel)==0: continue diff --git a/src/lisfloodutilities/water-demand-historic/step3a_industrial_demand.py b/src/lisfloodutilities/water-demand-historic/step3a_industrial_demand.py index e310907..f6f5db0 100644 --- a/src/lisfloodutilities/water-demand-historic/step3a_industrial_demand.py +++ b/src/lisfloodutilities/water-demand-historic/step3a_industrial_demand.py @@ -368,7 +368,7 @@ def main(): for jj in np.arange(country_codes.shape[0]): country_code = country_codes.iloc[jj]['country-code'] for ii in np.arange(len(years)): - sel = (aquastat['M49']==country_code) & (aquastat['Variable Name']=='Industrial water withdrawal') & (aquastat['Year']==years[ii]) + sel = (aquastat['m49']==country_code) & (aquastat['Variable Name']=='Industrial water withdrawal') & (aquastat['Year']==years[ii]) if np.sum(sel)==0: continue table_aquastat_industry_withdrawal[jj,ii] = aquastat['Value'][sel].values # km3/year diff --git a/src/lisfloodutilities/water-demand-historic/step4_livestock_demand.py b/src/lisfloodutilities/water-demand-historic/step4_livestock_demand.py index fb21459..6e17d40 100644 --- a/src/lisfloodutilities/water-demand-historic/step4_livestock_demand.py +++ b/src/lisfloodutilities/water-demand-historic/step4_livestock_demand.py @@ -106,10 +106,10 @@ def main(): for jj in np.arange(country_codes.shape[0]): country_code = country_codes.iloc[jj]['country-code'] for ii in np.arange(len(years)): - sel_ir = (aquastat['M49']==country_code) & (aquastat['Variable Name']=='Irrigation water withdrawal') & (aquastat['Year']==years[ii]) + sel_ir = (aquastat['m49']==country_code) & (aquastat['Variable Name']=='Irrigation water withdrawal') & (aquastat['Year']==years[ii]) if np.sum(sel_ir)>0: table_aquastat_irrigation_withdrawal[jj,ii] = aquastat['Value'][sel_ir].values # km3/year - sel_ag = (aquastat['M49']==country_code) & (aquastat['Variable Name']=='Agricultural water withdrawal') & (aquastat['Year']==years[ii]) + sel_ag = (aquastat['m49']==country_code) & (aquastat['Variable Name']=='Agricultural water withdrawal') & (aquastat['Year']==years[ii]) if np.sum(sel_ag)>0: table_aquastat_agriculture_withdrawal[jj,ii] = aquastat['Value'][sel_ag].values # km3/year