Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save rutgerhofste/f38debeea3bd6106b7acdc2c77ecf69e to your computer and use it in GitHub Desktop.
Save rutgerhofste/f38debeea3bd6106b7acdc2c77ecf69e to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"/notebooks/Aqueduct/lab\r\n"
]
}
],
"source": [
"!pwd"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"--2017-07-26 01:42:31-- https://s3.amazonaws.com/wri-projects/Aqueduct30/temp/calculatedWS03.csv\n",
"Resolving s3.amazonaws.com (s3.amazonaws.com)... 52.216.230.117\n",
"Connecting to s3.amazonaws.com (s3.amazonaws.com)|52.216.230.117|:443... connected.\n",
"HTTP request sent, awaiting response... 200 OK\n",
"Length: 93972756 (90M) [application/octet-stream]\n",
"Saving to: 'calculatedWS03.csv'\n",
"\n",
"calculatedWS03.csv 100%[===================>] 89.62M 35.5MB/s in 2.5s \n",
"\n",
"2017-07-26 01:42:34 (35.5 MB/s) - 'calculatedWS03.csv' saved [93972756/93972756]\n",
"\n"
]
}
],
"source": [
"!wget https://s3.amazonaws.com/wri-projects/Aqueduct30/temp/calculatedWS03.csv -O calculatedWS03.csv"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import numpy as np\n",
"import pandas as pd\n",
"import math\n",
"import sys"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'3.6.1 |Anaconda custom (64-bit)| (default, May 11 2017, 13:09:58) \\n[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)]'"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"sys.version"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"df = pd.read_csv('/notebooks/Aqueduct/lab/calculatedWS03.csv')"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style>\n",
" .dataframe thead tr:only-child th {\n",
" text-align: right;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: left;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>PFAF_ID</th>\n",
" <th>Unnamed: 0</th>\n",
" <th>Unnamed: 0.1</th>\n",
" <th>HYBAS_ID</th>\n",
" <th>NEXT_DOWN</th>\n",
" <th>NEXT_SINK</th>\n",
" <th>MAIN_BAS</th>\n",
" <th>DIST_SINK</th>\n",
" <th>DIST_MAIN</th>\n",
" <th>SUB_AREA</th>\n",
" <th>...</th>\n",
" <th>upstream_sum_volumem3_TotWW_monthY2014M11</th>\n",
" <th>upstream_sum_volumem3_TotWN_monthY2014M11</th>\n",
" <th>local_sum_volumem3_Runoff_monthY2014M11</th>\n",
" <th>ws_monthY2014M11</th>\n",
" <th>local_sum_volumem3_TotWW_monthY2014M12</th>\n",
" <th>local_sum_volumem3_TotWN_monthY2014M12</th>\n",
" <th>upstream_sum_volumem3_TotWW_monthY2014M12</th>\n",
" <th>upstream_sum_volumem3_TotWN_monthY2014M12</th>\n",
" <th>local_sum_volumem3_Runoff_monthY2014M12</th>\n",
" <th>ws_monthY2014M12</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>111011</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>1060000010</td>\n",
" <td>0</td>\n",
" <td>1.060000e+09</td>\n",
" <td>1.060000e+09</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>1890.8</td>\n",
" <td>...</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>69477.380838</td>\n",
" <td>7.317308e+01</td>\n",
" <td>5.062878e+06</td>\n",
" <td>2.354598e+06</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>81085.620721</td>\n",
" <td>62.438667</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>111012</td>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>1060000100</td>\n",
" <td>0</td>\n",
" <td>1.060000e+09</td>\n",
" <td>1.060000e+09</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>2925.9</td>\n",
" <td>...</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>29361.957127</td>\n",
" <td>2.324595e+01</td>\n",
" <td>6.820849e+05</td>\n",
" <td>2.812766e+05</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>35478.575166</td>\n",
" <td>19.225262</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>111013</td>\n",
" <td>2</td>\n",
" <td>2</td>\n",
" <td>1060000110</td>\n",
" <td>0</td>\n",
" <td>1.060000e+09</td>\n",
" <td>1.060000e+09</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>893.5</td>\n",
" <td>...</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>8503.375061</td>\n",
" <td>7.406315e+01</td>\n",
" <td>6.294456e+05</td>\n",
" <td>2.584279e+05</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>9910.605142</td>\n",
" <td>63.512326</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>111014</td>\n",
" <td>3</td>\n",
" <td>3</td>\n",
" <td>1060000150</td>\n",
" <td>0</td>\n",
" <td>1.060000e+09</td>\n",
" <td>1.060000e+09</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>4217.3</td>\n",
" <td>...</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>0.015992</td>\n",
" <td>5.432920e+06</td>\n",
" <td>8.653364e+04</td>\n",
" <td>4.124410e+04</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>24135.710823</td>\n",
" <td>3.585295</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>111015</td>\n",
" <td>4</td>\n",
" <td>4</td>\n",
" <td>1060000160</td>\n",
" <td>0</td>\n",
" <td>1.060000e+09</td>\n",
" <td>1.060000e+09</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>16638.1</td>\n",
" <td>...</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>249.185016</td>\n",
" <td>3.732086e+04</td>\n",
" <td>9.289624e+06</td>\n",
" <td>3.870654e+06</td>\n",
" <td>0.0</td>\n",
" <td>0.0</td>\n",
" <td>7520.378455</td>\n",
" <td>1235.260158</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>5 rows × 623 columns</p>\n",
"</div>"
],
"text/plain": [
" PFAF_ID Unnamed: 0 Unnamed: 0.1 HYBAS_ID NEXT_DOWN NEXT_SINK \\\n",
"0 111011 0 0 1060000010 0 1.060000e+09 \n",
"1 111012 1 1 1060000100 0 1.060000e+09 \n",
"2 111013 2 2 1060000110 0 1.060000e+09 \n",
"3 111014 3 3 1060000150 0 1.060000e+09 \n",
"4 111015 4 4 1060000160 0 1.060000e+09 \n",
"\n",
" MAIN_BAS DIST_SINK DIST_MAIN SUB_AREA ... \\\n",
"0 1.060000e+09 0.0 0.0 1890.8 ... \n",
"1 1.060000e+09 0.0 0.0 2925.9 ... \n",
"2 1.060000e+09 0.0 0.0 893.5 ... \n",
"3 1.060000e+09 0.0 0.0 4217.3 ... \n",
"4 1.060000e+09 0.0 0.0 16638.1 ... \n",
"\n",
" upstream_sum_volumem3_TotWW_monthY2014M11 \\\n",
"0 0.0 \n",
"1 0.0 \n",
"2 0.0 \n",
"3 0.0 \n",
"4 0.0 \n",
"\n",
" upstream_sum_volumem3_TotWN_monthY2014M11 \\\n",
"0 0.0 \n",
"1 0.0 \n",
"2 0.0 \n",
"3 0.0 \n",
"4 0.0 \n",
"\n",
" local_sum_volumem3_Runoff_monthY2014M11 ws_monthY2014M11 \\\n",
"0 69477.380838 7.317308e+01 \n",
"1 29361.957127 2.324595e+01 \n",
"2 8503.375061 7.406315e+01 \n",
"3 0.015992 5.432920e+06 \n",
"4 249.185016 3.732086e+04 \n",
"\n",
" local_sum_volumem3_TotWW_monthY2014M12 \\\n",
"0 5.062878e+06 \n",
"1 6.820849e+05 \n",
"2 6.294456e+05 \n",
"3 8.653364e+04 \n",
"4 9.289624e+06 \n",
"\n",
" local_sum_volumem3_TotWN_monthY2014M12 \\\n",
"0 2.354598e+06 \n",
"1 2.812766e+05 \n",
"2 2.584279e+05 \n",
"3 4.124410e+04 \n",
"4 3.870654e+06 \n",
"\n",
" upstream_sum_volumem3_TotWW_monthY2014M12 \\\n",
"0 0.0 \n",
"1 0.0 \n",
"2 0.0 \n",
"3 0.0 \n",
"4 0.0 \n",
"\n",
" upstream_sum_volumem3_TotWN_monthY2014M12 \\\n",
"0 0.0 \n",
"1 0.0 \n",
"2 0.0 \n",
"3 0.0 \n",
"4 0.0 \n",
"\n",
" local_sum_volumem3_Runoff_monthY2014M12 ws_monthY2014M12 \n",
"0 81085.620721 62.438667 \n",
"1 35478.575166 19.225262 \n",
"2 9910.605142 63.512326 \n",
"3 24135.710823 3.585295 \n",
"4 7520.378455 1235.260158 \n",
"\n",
"[5 rows x 623 columns]"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.head()"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(16397, 623)"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.shape"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['PFAF_ID' 'Unnamed: 0' 'Unnamed: 0.1' 'HYBAS_ID' 'NEXT_DOWN' 'NEXT_SINK'\n",
" 'MAIN_BAS' 'DIST_SINK' 'DIST_MAIN' 'SUB_AREA' 'UP_AREA' 'ENDO' 'COAST'\n",
" 'ORDER_' 'SORT' 'Upstream_HYBAS_IDs' 'Upstream_PFAF_IDs' 'PfafIDarea30sm2'\n",
" 'countarea30sm2' 'meanarea30sm2' 'PfafIDDomWN_monthY2014M01'\n",
" 'countDomWN_monthY2014M01' 'meanDomWN_monthY2014M01'\n",
" 'PfafIDDomWN_monthY2014M02' 'countDomWN_monthY2014M02'\n",
" 'meanDomWN_monthY2014M02' 'PfafIDDomWN_monthY2014M03'\n",
" 'countDomWN_monthY2014M03' 'meanDomWN_monthY2014M03'\n",
" 'PfafIDDomWN_monthY2014M04' 'countDomWN_monthY2014M04'\n",
" 'meanDomWN_monthY2014M04' 'PfafIDDomWN_monthY2014M05'\n",
" 'countDomWN_monthY2014M05' 'meanDomWN_monthY2014M05'\n",
" 'PfafIDDomWN_monthY2014M06' 'countDomWN_monthY2014M06'\n",
" 'meanDomWN_monthY2014M06' 'PfafIDDomWN_monthY2014M07'\n",
" 'countDomWN_monthY2014M07' 'meanDomWN_monthY2014M07'\n",
" 'PfafIDDomWN_monthY2014M08' 'countDomWN_monthY2014M08'\n",
" 'meanDomWN_monthY2014M08' 'PfafIDDomWN_monthY2014M09'\n",
" 'countDomWN_monthY2014M09' 'meanDomWN_monthY2014M09'\n",
" 'PfafIDDomWN_monthY2014M10' 'countDomWN_monthY2014M10'\n",
" 'meanDomWN_monthY2014M10' 'PfafIDDomWN_monthY2014M11'\n",
" 'countDomWN_monthY2014M11' 'meanDomWN_monthY2014M11'\n",
" 'PfafIDDomWN_monthY2014M12' 'countDomWN_monthY2014M12'\n",
" 'meanDomWN_monthY2014M12' 'PfafIDDomWN_yearY2014M12'\n",
" 'countDomWN_yearY2014M12' 'meanDomWN_yearY2014M12'\n",
" 'PfafIDDomWW_monthY2014M01' 'countDomWW_monthY2014M01'\n",
" 'meanDomWW_monthY2014M01' 'PfafIDDomWW_monthY2014M02'\n",
" 'countDomWW_monthY2014M02' 'meanDomWW_monthY2014M02'\n",
" 'PfafIDDomWW_monthY2014M03' 'countDomWW_monthY2014M03'\n",
" 'meanDomWW_monthY2014M03' 'PfafIDDomWW_monthY2014M04'\n",
" 'countDomWW_monthY2014M04' 'meanDomWW_monthY2014M04'\n",
" 'PfafIDDomWW_monthY2014M05' 'countDomWW_monthY2014M05'\n",
" 'meanDomWW_monthY2014M05' 'PfafIDDomWW_monthY2014M06'\n",
" 'countDomWW_monthY2014M06' 'meanDomWW_monthY2014M06'\n",
" 'PfafIDDomWW_monthY2014M07' 'countDomWW_monthY2014M07'\n",
" 'meanDomWW_monthY2014M07' 'PfafIDDomWW_monthY2014M08'\n",
" 'countDomWW_monthY2014M08' 'meanDomWW_monthY2014M08'\n",
" 'PfafIDDomWW_monthY2014M09' 'countDomWW_monthY2014M09'\n",
" 'meanDomWW_monthY2014M09' 'PfafIDDomWW_monthY2014M10'\n",
" 'countDomWW_monthY2014M10' 'meanDomWW_monthY2014M10'\n",
" 'PfafIDDomWW_monthY2014M11' 'countDomWW_monthY2014M11'\n",
" 'meanDomWW_monthY2014M11' 'PfafIDDomWW_monthY2014M12'\n",
" 'countDomWW_monthY2014M12' 'meanDomWW_monthY2014M12'\n",
" 'PfafIDDomWW_yearY2014M12' 'countDomWW_yearY2014M12'\n",
" 'meanDomWW_yearY2014M12' 'PfafIDIndWN_monthY2014M01'\n",
" 'countIndWN_monthY2014M01' 'meanIndWN_monthY2014M01'\n",
" 'PfafIDIndWN_monthY2014M02' 'countIndWN_monthY2014M02'\n",
" 'meanIndWN_monthY2014M02' 'PfafIDIndWN_monthY2014M03'\n",
" 'countIndWN_monthY2014M03' 'meanIndWN_monthY2014M03'\n",
" 'PfafIDIndWN_monthY2014M04' 'countIndWN_monthY2014M04'\n",
" 'meanIndWN_monthY2014M04' 'PfafIDIndWN_monthY2014M05'\n",
" 'countIndWN_monthY2014M05' 'meanIndWN_monthY2014M05'\n",
" 'PfafIDIndWN_monthY2014M06' 'countIndWN_monthY2014M06'\n",
" 'meanIndWN_monthY2014M06' 'PfafIDIndWN_monthY2014M07'\n",
" 'countIndWN_monthY2014M07' 'meanIndWN_monthY2014M07'\n",
" 'PfafIDIndWN_monthY2014M08' 'countIndWN_monthY2014M08'\n",
" 'meanIndWN_monthY2014M08' 'PfafIDIndWN_monthY2014M09'\n",
" 'countIndWN_monthY2014M09' 'meanIndWN_monthY2014M09'\n",
" 'PfafIDIndWN_monthY2014M10' 'countIndWN_monthY2014M10'\n",
" 'meanIndWN_monthY2014M10' 'PfafIDIndWN_monthY2014M11'\n",
" 'countIndWN_monthY2014M11' 'meanIndWN_monthY2014M11'\n",
" 'PfafIDIndWN_monthY2014M12' 'countIndWN_monthY2014M12'\n",
" 'meanIndWN_monthY2014M12' 'PfafIDIndWN_yearY2014M12'\n",
" 'countIndWN_yearY2014M12' 'meanIndWN_yearY2014M12'\n",
" 'PfafIDIndWW_monthY2014M01' 'countIndWW_monthY2014M01'\n",
" 'meanIndWW_monthY2014M01' 'PfafIDIndWW_monthY2014M02'\n",
" 'countIndWW_monthY2014M02' 'meanIndWW_monthY2014M02'\n",
" 'PfafIDIndWW_monthY2014M03' 'countIndWW_monthY2014M03'\n",
" 'meanIndWW_monthY2014M03' 'PfafIDIndWW_monthY2014M04'\n",
" 'countIndWW_monthY2014M04' 'meanIndWW_monthY2014M04'\n",
" 'PfafIDIndWW_monthY2014M05' 'countIndWW_monthY2014M05'\n",
" 'meanIndWW_monthY2014M05' 'PfafIDIndWW_monthY2014M06'\n",
" 'countIndWW_monthY2014M06' 'meanIndWW_monthY2014M06'\n",
" 'PfafIDIndWW_monthY2014M07' 'countIndWW_monthY2014M07'\n",
" 'meanIndWW_monthY2014M07' 'PfafIDIndWW_monthY2014M08'\n",
" 'countIndWW_monthY2014M08' 'meanIndWW_monthY2014M08'\n",
" 'PfafIDIndWW_monthY2014M09' 'countIndWW_monthY2014M09'\n",
" 'meanIndWW_monthY2014M09' 'PfafIDIndWW_monthY2014M10'\n",
" 'countIndWW_monthY2014M10' 'meanIndWW_monthY2014M10'\n",
" 'PfafIDIndWW_monthY2014M11' 'countIndWW_monthY2014M11'\n",
" 'meanIndWW_monthY2014M11' 'PfafIDIndWW_monthY2014M12'\n",
" 'countIndWW_monthY2014M12' 'meanIndWW_monthY2014M12'\n",
" 'PfafIDIndWW_yearY2014M12' 'countIndWW_yearY2014M12'\n",
" 'meanIndWW_yearY2014M12' 'PfafIDIrrWN_monthY2014M01'\n",
" 'countIrrWN_monthY2014M01' 'meanIrrWN_monthY2014M01'\n",
" 'PfafIDIrrWN_monthY2014M02' 'countIrrWN_monthY2014M02'\n",
" 'meanIrrWN_monthY2014M02' 'PfafIDIrrWN_monthY2014M03'\n",
" 'countIrrWN_monthY2014M03' 'meanIrrWN_monthY2014M03'\n",
" 'PfafIDIrrWN_monthY2014M04' 'countIrrWN_monthY2014M04'\n",
" 'meanIrrWN_monthY2014M04' 'PfafIDIrrWN_monthY2014M05'\n",
" 'countIrrWN_monthY2014M05' 'meanIrrWN_monthY2014M05'\n",
" 'PfafIDIrrWN_monthY2014M06' 'countIrrWN_monthY2014M06'\n",
" 'meanIrrWN_monthY2014M06' 'PfafIDIrrWN_monthY2014M07'\n",
" 'countIrrWN_monthY2014M07' 'meanIrrWN_monthY2014M07'\n",
" 'PfafIDIrrWN_monthY2014M08' 'countIrrWN_monthY2014M08'\n",
" 'meanIrrWN_monthY2014M08' 'PfafIDIrrWN_monthY2014M09'\n",
" 'countIrrWN_monthY2014M09' 'meanIrrWN_monthY2014M09'\n",
" 'PfafIDIrrWN_monthY2014M10' 'countIrrWN_monthY2014M10'\n",
" 'meanIrrWN_monthY2014M10' 'PfafIDIrrWN_monthY2014M11'\n",
" 'countIrrWN_monthY2014M11' 'meanIrrWN_monthY2014M11'\n",
" 'PfafIDIrrWN_monthY2014M12' 'countIrrWN_monthY2014M12'\n",
" 'meanIrrWN_monthY2014M12' 'PfafIDIrrWN_yearY2014M12'\n",
" 'countIrrWN_yearY2014M12' 'meanIrrWN_yearY2014M12'\n",
" 'PfafIDIrrWW_monthY2014M01' 'countIrrWW_monthY2014M01'\n",
" 'meanIrrWW_monthY2014M01' 'PfafIDIrrWW_monthY2014M02'\n",
" 'countIrrWW_monthY2014M02' 'meanIrrWW_monthY2014M02'\n",
" 'PfafIDIrrWW_monthY2014M03' 'countIrrWW_monthY2014M03'\n",
" 'meanIrrWW_monthY2014M03' 'PfafIDIrrWW_monthY2014M04'\n",
" 'countIrrWW_monthY2014M04' 'meanIrrWW_monthY2014M04'\n",
" 'PfafIDIrrWW_monthY2014M05' 'countIrrWW_monthY2014M05'\n",
" 'meanIrrWW_monthY2014M05' 'PfafIDIrrWW_monthY2014M06'\n",
" 'countIrrWW_monthY2014M06' 'meanIrrWW_monthY2014M06'\n",
" 'PfafIDIrrWW_monthY2014M07' 'countIrrWW_monthY2014M07'\n",
" 'meanIrrWW_monthY2014M07' 'PfafIDIrrWW_monthY2014M08'\n",
" 'countIrrWW_monthY2014M08' 'meanIrrWW_monthY2014M08'\n",
" 'PfafIDIrrWW_monthY2014M09' 'countIrrWW_monthY2014M09'\n",
" 'meanIrrWW_monthY2014M09' 'PfafIDIrrWW_monthY2014M10'\n",
" 'countIrrWW_monthY2014M10' 'meanIrrWW_monthY2014M10'\n",
" 'PfafIDIrrWW_monthY2014M11' 'countIrrWW_monthY2014M11'\n",
" 'meanIrrWW_monthY2014M11' 'PfafIDIrrWW_monthY2014M12'\n",
" 'countIrrWW_monthY2014M12' 'meanIrrWW_monthY2014M12'\n",
" 'PfafIDIrrWW_yearY2014M12' 'countIrrWW_yearY2014M12'\n",
" 'meanIrrWW_yearY2014M12' 'PfafIDLivWN_monthY2014M01'\n",
" 'countLivWN_monthY2014M01' 'meanLivWN_monthY2014M01'\n",
" 'PfafIDLivWN_monthY2014M02' 'countLivWN_monthY2014M02'\n",
" 'meanLivWN_monthY2014M02' 'PfafIDLivWN_monthY2014M03'\n",
" 'countLivWN_monthY2014M03' 'meanLivWN_monthY2014M03'\n",
" 'PfafIDLivWN_monthY2014M04' 'countLivWN_monthY2014M04'\n",
" 'meanLivWN_monthY2014M04' 'PfafIDLivWN_monthY2014M05'\n",
" 'countLivWN_monthY2014M05' 'meanLivWN_monthY2014M05'\n",
" 'PfafIDLivWN_monthY2014M06' 'countLivWN_monthY2014M06'\n",
" 'meanLivWN_monthY2014M06' 'PfafIDLivWN_monthY2014M07'\n",
" 'countLivWN_monthY2014M07' 'meanLivWN_monthY2014M07'\n",
" 'PfafIDLivWN_monthY2014M08' 'countLivWN_monthY2014M08'\n",
" 'meanLivWN_monthY2014M08' 'PfafIDLivWN_monthY2014M09'\n",
" 'countLivWN_monthY2014M09' 'meanLivWN_monthY2014M09'\n",
" 'PfafIDLivWN_monthY2014M10' 'countLivWN_monthY2014M10'\n",
" 'meanLivWN_monthY2014M10' 'PfafIDLivWN_monthY2014M11'\n",
" 'countLivWN_monthY2014M11' 'meanLivWN_monthY2014M11'\n",
" 'PfafIDLivWN_monthY2014M12' 'countLivWN_monthY2014M12'\n",
" 'meanLivWN_monthY2014M12' 'PfafIDLivWN_yearY2014M12'\n",
" 'countLivWN_yearY2014M12' 'meanLivWN_yearY2014M12' 'PfafIDrunoff_annua'\n",
" 'countrunoff_annua' 'meanrunoff_annua' 'PfafIDrunoff_month_M01'\n",
" 'countrunoff_month_M01' 'meanrunoff_month_M01' 'PfafIDrunoff_month_M02'\n",
" 'countrunoff_month_M02' 'meanrunoff_month_M02' 'PfafIDrunoff_month_M03'\n",
" 'countrunoff_month_M03' 'meanrunoff_month_M03' 'PfafIDrunoff_month_M04'\n",
" 'countrunoff_month_M04' 'meanrunoff_month_M04' 'PfafIDrunoff_month_M05'\n",
" 'countrunoff_month_M05' 'meanrunoff_month_M05' 'PfafIDrunoff_month_M06'\n",
" 'countrunoff_month_M06' 'meanrunoff_month_M06' 'PfafIDrunoff_month_M07'\n",
" 'countrunoff_month_M07' 'meanrunoff_month_M07' 'PfafIDrunoff_month_M08'\n",
" 'countrunoff_month_M08' 'meanrunoff_month_M08' 'PfafIDrunoff_month_M09'\n",
" 'countrunoff_month_M09' 'meanrunoff_month_M09' 'PfafIDrunoff_month_M10'\n",
" 'countrunoff_month_M10' 'meanrunoff_month_M10' 'PfafIDrunoff_month_M11'\n",
" 'countrunoff_month_M11' 'meanrunoff_month_M11' 'PfafIDrunoff_month_M12'\n",
" 'countrunoff_month_M12' 'meanrunoff_month_M12' 'upstream_sum_aream2'\n",
" 'upstream_sum_countIrrWN_monthY2014M09'\n",
" 'upstream_sum_volumem3IrrWN_monthY2014M09'\n",
" 'upstream_sum_countrunoff_month_M11'\n",
" 'upstream_sum_volumem3runoff_month_M11'\n",
" 'upstream_sum_countrunoff_month_M10'\n",
" 'upstream_sum_volumem3runoff_month_M10'\n",
" 'upstream_sum_countIrrWN_monthY2014M01'\n",
" 'upstream_sum_volumem3IrrWN_monthY2014M01'\n",
" 'upstream_sum_countDomWN_monthY2014M01'\n",
" 'upstream_sum_volumem3DomWN_monthY2014M01'\n",
" 'upstream_sum_countDomWN_monthY2014M07'\n",
" 'upstream_sum_volumem3DomWN_monthY2014M07'\n",
" 'upstream_sum_countIrrWW_monthY2014M11'\n",
" 'upstream_sum_volumem3IrrWW_monthY2014M11'\n",
" 'upstream_sum_countDomWW_monthY2014M02'\n",
" 'upstream_sum_volumem3DomWW_monthY2014M02'\n",
" 'upstream_sum_countDomWW_monthY2014M12'\n",
" 'upstream_sum_volumem3DomWW_monthY2014M12' 'upstream_sum_countarea30sm2'\n",
" 'upstream_sum_volumem3area30sm2' 'upstream_sum_countDomWN_monthY2014M11'\n",
" 'upstream_sum_volumem3DomWN_monthY2014M11'\n",
" 'upstream_sum_countLivWN_monthY2014M08'\n",
" 'upstream_sum_volumem3LivWN_monthY2014M08'\n",
" 'upstream_sum_countIrrWW_monthY2014M08'\n",
" 'upstream_sum_volumem3IrrWW_monthY2014M08'\n",
" 'upstream_sum_countIndWN_monthY2014M03'\n",
" 'upstream_sum_volumem3IndWN_monthY2014M03'\n",
" 'upstream_sum_countIrrWW_monthY2014M02'\n",
" 'upstream_sum_volumem3IrrWW_monthY2014M02'\n",
" 'upstream_sum_countrunoff_month_M05'\n",
" 'upstream_sum_volumem3runoff_month_M05'\n",
" 'upstream_sum_countDomWN_yearY2014M12'\n",
" 'upstream_sum_volumem3DomWN_yearY2014M12'\n",
" 'upstream_sum_countDomWN_monthY2014M05'\n",
" 'upstream_sum_volumem3DomWN_monthY2014M05'\n",
" 'upstream_sum_countIrrWN_monthY2014M03'\n",
" 'upstream_sum_volumem3IrrWN_monthY2014M03'\n",
" 'upstream_sum_countIndWN_monthY2014M07'\n",
" 'upstream_sum_volumem3IndWN_monthY2014M07'\n",
" 'upstream_sum_countIrrWW_monthY2014M12'\n",
" 'upstream_sum_volumem3IrrWW_monthY2014M12'\n",
" 'upstream_sum_countIrrWW_monthY2014M05'\n",
" 'upstream_sum_volumem3IrrWW_monthY2014M05'\n",
" 'upstream_sum_countLivWN_monthY2014M03'\n",
" 'upstream_sum_volumem3LivWN_monthY2014M03'\n",
" 'upstream_sum_countIndWN_monthY2014M08'\n",
" 'upstream_sum_volumem3IndWN_monthY2014M08'\n",
" 'upstream_sum_countIndWN_monthY2014M02'\n",
" 'upstream_sum_volumem3IndWN_monthY2014M02'\n",
" 'upstream_sum_countrunoff_annua' 'upstream_sum_volumem3runoff_annua'\n",
" 'upstream_sum_countIrrWN_monthY2014M12'\n",
" 'upstream_sum_volumem3IrrWN_monthY2014M12'\n",
" 'upstream_sum_countIrrWN_yearY2014M12'\n",
" 'upstream_sum_volumem3IrrWN_yearY2014M12'\n",
" 'upstream_sum_countLivWN_monthY2014M09'\n",
" 'upstream_sum_volumem3LivWN_monthY2014M09'\n",
" 'upstream_sum_countIndWW_monthY2014M12'\n",
" 'upstream_sum_volumem3IndWW_monthY2014M12'\n",
" 'upstream_sum_countIrrWW_monthY2014M01'\n",
" 'upstream_sum_volumem3IrrWW_monthY2014M01'\n",
" 'upstream_sum_countrunoff_month_M02'\n",
" 'upstream_sum_volumem3runoff_month_M02'\n",
" 'upstream_sum_countIrrWW_monthY2014M06'\n",
" 'upstream_sum_volumem3IrrWW_monthY2014M06'\n",
" 'upstream_sum_countDomWN_monthY2014M12'\n",
" 'upstream_sum_volumem3DomWN_monthY2014M12'\n",
" 'upstream_sum_countDomWW_monthY2014M09'\n",
" 'upstream_sum_volumem3DomWW_monthY2014M09'\n",
" 'upstream_sum_countDomWW_monthY2014M04'\n",
" 'upstream_sum_volumem3DomWW_monthY2014M04'\n",
" 'upstream_sum_countrunoff_month_M06'\n",
" 'upstream_sum_volumem3runoff_month_M06'\n",
" 'upstream_sum_countIndWW_monthY2014M09'\n",
" 'upstream_sum_volumem3IndWW_monthY2014M09'\n",
" 'upstream_sum_countrunoff_month_M08'\n",
" 'upstream_sum_volumem3runoff_month_M08'\n",
" 'upstream_sum_countIrrWN_monthY2014M02'\n",
" 'upstream_sum_volumem3IrrWN_monthY2014M02'\n",
" 'upstream_sum_countIndWN_monthY2014M10'\n",
" 'upstream_sum_volumem3IndWN_monthY2014M10'\n",
" 'upstream_sum_countIrrWW_monthY2014M03'\n",
" 'upstream_sum_volumem3IrrWW_monthY2014M03'\n",
" 'upstream_sum_countLivWN_monthY2014M06'\n",
" 'upstream_sum_volumem3LivWN_monthY2014M06'\n",
" 'upstream_sum_countrunoff_month_M07'\n",
" 'upstream_sum_volumem3runoff_month_M07'\n",
" 'upstream_sum_countIndWW_monthY2014M08'\n",
" 'upstream_sum_volumem3IndWW_monthY2014M08'\n",
" 'upstream_sum_countDomWW_monthY2014M11'\n",
" 'upstream_sum_volumem3DomWW_monthY2014M11'\n",
" 'upstream_sum_countIndWW_monthY2014M11'\n",
" 'upstream_sum_volumem3IndWW_monthY2014M11'\n",
" 'upstream_sum_countLivWN_monthY2014M01'\n",
" 'upstream_sum_volumem3LivWN_monthY2014M01'\n",
" 'upstream_sum_countIrrWN_monthY2014M07'\n",
" 'upstream_sum_volumem3IrrWN_monthY2014M07'\n",
" 'upstream_sum_countIndWW_monthY2014M01'\n",
" 'upstream_sum_volumem3IndWW_monthY2014M01'\n",
" 'upstream_sum_countIrrWW_yearY2014M12'\n",
" 'upstream_sum_volumem3IrrWW_yearY2014M12'\n",
" 'upstream_sum_countIrrWN_monthY2014M10'\n",
" 'upstream_sum_volumem3IrrWN_monthY2014M10'\n",
" 'upstream_sum_countDomWW_monthY2014M05'\n",
" 'upstream_sum_volumem3DomWW_monthY2014M05'\n",
" 'upstream_sum_countIndWN_monthY2014M09'\n",
" 'upstream_sum_volumem3IndWN_monthY2014M09'\n",
" 'upstream_sum_countLivWN_monthY2014M12'\n",
" 'upstream_sum_volumem3LivWN_monthY2014M12'\n",
" 'upstream_sum_countIndWN_yearY2014M12'\n",
" 'upstream_sum_volumem3IndWN_yearY2014M12'\n",
" 'upstream_sum_countrunoff_month_M09'\n",
" 'upstream_sum_volumem3runoff_month_M09'\n",
" 'upstream_sum_countDomWN_monthY2014M02'\n",
" 'upstream_sum_volumem3DomWN_monthY2014M02'\n",
" 'upstream_sum_countDomWN_monthY2014M06'\n",
" 'upstream_sum_volumem3DomWN_monthY2014M06'\n",
" 'upstream_sum_countIndWW_monthY2014M02'\n",
" 'upstream_sum_volumem3IndWW_monthY2014M02'\n",
" 'upstream_sum_countIndWW_monthY2014M07'\n",
" 'upstream_sum_volumem3IndWW_monthY2014M07'\n",
" 'upstream_sum_countIrrWN_monthY2014M08'\n",
" 'upstream_sum_volumem3IrrWN_monthY2014M08'\n",
" 'upstream_sum_countIrrWN_monthY2014M11'\n",
" 'upstream_sum_volumem3IrrWN_monthY2014M11'\n",
" 'upstream_sum_countDomWW_monthY2014M06'\n",
" 'upstream_sum_volumem3DomWW_monthY2014M06'\n",
" 'upstream_sum_countDomWW_monthY2014M08'\n",
" 'upstream_sum_volumem3DomWW_monthY2014M08'\n",
" 'upstream_sum_countrunoff_month_M01'\n",
" 'upstream_sum_volumem3runoff_month_M01'\n",
" 'upstream_sum_countLivWN_monthY2014M10'\n",
" 'upstream_sum_volumem3LivWN_monthY2014M10'\n",
" 'upstream_sum_countIrrWN_monthY2014M04'\n",
" 'upstream_sum_volumem3IrrWN_monthY2014M04'\n",
" 'upstream_sum_countDomWN_monthY2014M10'\n",
" 'upstream_sum_volumem3DomWN_monthY2014M10'\n",
" 'upstream_sum_countDomWN_monthY2014M03'\n",
" 'upstream_sum_volumem3DomWN_monthY2014M03'\n",
" 'upstream_sum_countIndWN_monthY2014M05'\n",
" 'upstream_sum_volumem3IndWN_monthY2014M05'\n",
" 'upstream_sum_countIndWW_monthY2014M03'\n",
" 'upstream_sum_volumem3IndWW_monthY2014M03'\n",
" 'upstream_sum_countIrrWW_monthY2014M04'\n",
" 'upstream_sum_volumem3IrrWW_monthY2014M04'\n",
" 'upstream_sum_countIrrWN_monthY2014M05'\n",
" 'upstream_sum_volumem3IrrWN_monthY2014M05'\n",
" 'upstream_sum_countLivWN_monthY2014M02'\n",
" 'upstream_sum_volumem3LivWN_monthY2014M02'\n",
" 'upstream_sum_countLivWN_monthY2014M11'\n",
" 'upstream_sum_volumem3LivWN_monthY2014M11'\n",
" 'upstream_sum_countIndWN_monthY2014M06'\n",
" 'upstream_sum_volumem3IndWN_monthY2014M06'\n",
" 'upstream_sum_countLivWN_monthY2014M04'\n",
" 'upstream_sum_volumem3LivWN_monthY2014M04'\n",
" 'upstream_sum_countIrrWN_monthY2014M06'\n",
" 'upstream_sum_volumem3IrrWN_monthY2014M06'\n",
" 'upstream_sum_countrunoff_month_M12'\n",
" 'upstream_sum_volumem3runoff_month_M12'\n",
" 'upstream_sum_countIndWN_monthY2014M12'\n",
" 'upstream_sum_volumem3IndWN_monthY2014M12'\n",
" 'upstream_sum_countIndWN_monthY2014M04'\n",
" 'upstream_sum_volumem3IndWN_monthY2014M04'\n",
" 'upstream_sum_countIndWN_monthY2014M11'\n",
" 'upstream_sum_volumem3IndWN_monthY2014M11'\n",
" 'upstream_sum_countDomWW_monthY2014M01'\n",
" 'upstream_sum_volumem3DomWW_monthY2014M01'\n",
" 'upstream_sum_countIndWW_yearY2014M12'\n",
" 'upstream_sum_volumem3IndWW_yearY2014M12'\n",
" 'upstream_sum_countIndWW_monthY2014M06'\n",
" 'upstream_sum_volumem3IndWW_monthY2014M06'\n",
" 'upstream_sum_countIrrWW_monthY2014M10'\n",
" 'upstream_sum_volumem3IrrWW_monthY2014M10'\n",
" 'upstream_sum_countrunoff_month_M03'\n",
" 'upstream_sum_volumem3runoff_month_M03'\n",
" 'upstream_sum_countDomWW_yearY2014M12'\n",
" 'upstream_sum_volumem3DomWW_yearY2014M12'\n",
" 'upstream_sum_countDomWW_monthY2014M10'\n",
" 'upstream_sum_volumem3DomWW_monthY2014M10'\n",
" 'upstream_sum_countIndWN_monthY2014M01'\n",
" 'upstream_sum_volumem3IndWN_monthY2014M01'\n",
" 'upstream_sum_countLivWN_monthY2014M05'\n",
" 'upstream_sum_volumem3LivWN_monthY2014M05'\n",
" 'upstream_sum_countDomWW_monthY2014M03'\n",
" 'upstream_sum_volumem3DomWW_monthY2014M03'\n",
" 'upstream_sum_countIndWW_monthY2014M05'\n",
" 'upstream_sum_volumem3IndWW_monthY2014M05'\n",
" 'upstream_sum_countDomWN_monthY2014M04'\n",
" 'upstream_sum_volumem3DomWN_monthY2014M04'\n",
" 'upstream_sum_countLivWN_monthY2014M07'\n",
" 'upstream_sum_volumem3LivWN_monthY2014M07'\n",
" 'upstream_sum_countDomWN_monthY2014M09'\n",
" 'upstream_sum_volumem3DomWN_monthY2014M09'\n",
" 'upstream_sum_countDomWW_monthY2014M07'\n",
" 'upstream_sum_volumem3DomWW_monthY2014M07'\n",
" 'upstream_sum_countIndWW_monthY2014M04'\n",
" 'upstream_sum_volumem3IndWW_monthY2014M04'\n",
" 'upstream_sum_countDomWN_monthY2014M08'\n",
" 'upstream_sum_volumem3DomWN_monthY2014M08'\n",
" 'upstream_sum_countrunoff_month_M04'\n",
" 'upstream_sum_volumem3runoff_month_M04'\n",
" 'upstream_sum_countIndWW_monthY2014M10'\n",
" 'upstream_sum_volumem3IndWW_monthY2014M10'\n",
" 'upstream_sum_countIrrWW_monthY2014M09'\n",
" 'upstream_sum_volumem3IrrWW_monthY2014M09'\n",
" 'upstream_sum_countIrrWW_monthY2014M07'\n",
" 'upstream_sum_volumem3IrrWW_monthY2014M07'\n",
" 'upstream_sum_countLivWN_yearY2014M12'\n",
" 'upstream_sum_volumem3LivWN_yearY2014M12' 'errorCode' 'local_sum_aream2'\n",
" 'local_sum_volumem3_TotWW_yearY2014' 'local_sum_volumem3_TotWN_yearY2014'\n",
" 'upstream_sum_volumem3_TotWW_yearY2014'\n",
" 'upstream_sum_volumem3_TotWN_yearY2014'\n",
" 'local_sum_volumem3_Runoff_yearY2014' 'ws_yearY2014'\n",
" 'local_sum_volumem3_TotWW_monthY2014M01'\n",
" 'local_sum_volumem3_TotWN_monthY2014M01'\n",
" 'upstream_sum_volumem3_TotWW_monthY2014M01'\n",
" 'upstream_sum_volumem3_TotWN_monthY2014M01'\n",
" 'local_sum_volumem3_Runoff_monthY2014M01' 'ws_monthY2014M01'\n",
" 'local_sum_volumem3_TotWW_monthY2014M02'\n",
" 'local_sum_volumem3_TotWN_monthY2014M02'\n",
" 'upstream_sum_volumem3_TotWW_monthY2014M02'\n",
" 'upstream_sum_volumem3_TotWN_monthY2014M02'\n",
" 'local_sum_volumem3_Runoff_monthY2014M02' 'ws_monthY2014M02'\n",
" 'local_sum_volumem3_TotWW_monthY2014M03'\n",
" 'local_sum_volumem3_TotWN_monthY2014M03'\n",
" 'upstream_sum_volumem3_TotWW_monthY2014M03'\n",
" 'upstream_sum_volumem3_TotWN_monthY2014M03'\n",
" 'local_sum_volumem3_Runoff_monthY2014M03' 'ws_monthY2014M03'\n",
" 'local_sum_volumem3_TotWW_monthY2014M04'\n",
" 'local_sum_volumem3_TotWN_monthY2014M04'\n",
" 'upstream_sum_volumem3_TotWW_monthY2014M04'\n",
" 'upstream_sum_volumem3_TotWN_monthY2014M04'\n",
" 'local_sum_volumem3_Runoff_monthY2014M04' 'ws_monthY2014M04'\n",
" 'local_sum_volumem3_TotWW_monthY2014M05'\n",
" 'local_sum_volumem3_TotWN_monthY2014M05'\n",
" 'upstream_sum_volumem3_TotWW_monthY2014M05'\n",
" 'upstream_sum_volumem3_TotWN_monthY2014M05'\n",
" 'local_sum_volumem3_Runoff_monthY2014M05' 'ws_monthY2014M05'\n",
" 'local_sum_volumem3_TotWW_monthY2014M06'\n",
" 'local_sum_volumem3_TotWN_monthY2014M06'\n",
" 'upstream_sum_volumem3_TotWW_monthY2014M06'\n",
" 'upstream_sum_volumem3_TotWN_monthY2014M06'\n",
" 'local_sum_volumem3_Runoff_monthY2014M06' 'ws_monthY2014M06'\n",
" 'local_sum_volumem3_TotWW_monthY2014M07'\n",
" 'local_sum_volumem3_TotWN_monthY2014M07'\n",
" 'upstream_sum_volumem3_TotWW_monthY2014M07'\n",
" 'upstream_sum_volumem3_TotWN_monthY2014M07'\n",
" 'local_sum_volumem3_Runoff_monthY2014M07' 'ws_monthY2014M07'\n",
" 'local_sum_volumem3_TotWW_monthY2014M08'\n",
" 'local_sum_volumem3_TotWN_monthY2014M08'\n",
" 'upstream_sum_volumem3_TotWW_monthY2014M08'\n",
" 'upstream_sum_volumem3_TotWN_monthY2014M08'\n",
" 'local_sum_volumem3_Runoff_monthY2014M08' 'ws_monthY2014M08'\n",
" 'local_sum_volumem3_TotWW_monthY2014M09'\n",
" 'local_sum_volumem3_TotWN_monthY2014M09'\n",
" 'upstream_sum_volumem3_TotWW_monthY2014M09'\n",
" 'upstream_sum_volumem3_TotWN_monthY2014M09'\n",
" 'local_sum_volumem3_Runoff_monthY2014M09' 'ws_monthY2014M09'\n",
" 'local_sum_volumem3_TotWW_monthY2014M10'\n",
" 'local_sum_volumem3_TotWN_monthY2014M10'\n",
" 'upstream_sum_volumem3_TotWW_monthY2014M10'\n",
" 'upstream_sum_volumem3_TotWN_monthY2014M10'\n",
" 'local_sum_volumem3_Runoff_monthY2014M10' 'ws_monthY2014M10'\n",
" 'local_sum_volumem3_TotWW_monthY2014M11'\n",
" 'local_sum_volumem3_TotWN_monthY2014M11'\n",
" 'upstream_sum_volumem3_TotWW_monthY2014M11'\n",
" 'upstream_sum_volumem3_TotWN_monthY2014M11'\n",
" 'local_sum_volumem3_Runoff_monthY2014M11' 'ws_monthY2014M11'\n",
" 'local_sum_volumem3_TotWW_monthY2014M12'\n",
" 'local_sum_volumem3_TotWN_monthY2014M12'\n",
" 'upstream_sum_volumem3_TotWW_monthY2014M12'\n",
" 'upstream_sum_volumem3_TotWN_monthY2014M12'\n",
" 'local_sum_volumem3_Runoff_monthY2014M12' 'ws_monthY2014M12']\n"
]
}
],
"source": [
"print(df.columns.values)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Calculate catchment (local) area in [$m^2$] \n",
"(You could also just use SUB_AREA but I wanted to double check and this is more precise)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"df['area_m2']= df['meanarea30sm2']*df['countarea30sm2']"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Low water use\n",
"\n",
"Low water use: Water Withdrawal (WW) < 0.012 $m/(m^2*year)$\n",
"\n",
"local_sum_volumem3_TotWW_yearY2014 < 0.012 $m/(m^2*year)$"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"df['local_sum_m2_TotWW_yearY2014'] =df['local_sum_volumem3_TotWW_yearY2014']/df['area_m2']"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"df['arid'] = df['local_sum_m2_TotWW_yearY2014'] < 0.012"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Arid\n",
"\n",
"Available Blue Water <0.03 m/(m^2*year) \n",
"\n",
"Available blue water = upstream runoff – upstream consumption (WN) + local runoff"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [],
"source": [
"dftemp = pd.DataFrame()"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
"dftemp['AvailableBlueWatermillionm3'] = df['upstream_sum_volumem3runoff_annua']- \\\n",
"df['upstream_sum_volumem3_TotWN_yearY2014']+ \\\n",
"df['local_sum_volumem3_Runoff_yearY2014']"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Convert Volume to flux "
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"dftemp['AvailableBlueWatermillionm2'] = dftemp['AvailableBlueWatermillionm3'] / df['area_m2']"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"df['lowWaterUse'] = dftemp['AvailableBlueWatermillionm2'] < 0.03"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Arid AND Low water use"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [],
"source": [
"df['aridAndLowWaterUse'] = df['lowWaterUse']&df['arid']"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Baseline Water Stress Categories\n",
"\n",
"Baseline water stress raw value to category: $y = max(0,min \\big(5,\\frac{ln([rawValue])-ln(0.1)}{ln(2)}\\big)+1) $"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"def categorizeBWS(rawValue):\n",
" if rawValue ==0:\n",
" catValue= 0\n",
" elif rawValue < 0:\n",
" catValue= -9999\n",
" else: \n",
" catValue= max(0,min(5,((math.log(rawValue)-math.log(0.1))/(math.log(2)))))\n",
" return catValue"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [],
"source": [
"df['BWS_cat_excl_AridAndLow'] = df['ws_yearY2014'].apply(categorizeBWS)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Arid AND Low Water Use areas are considered category 5"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"df['BWS_cat'] = df['BWS_cat_excl_AridAndLow']"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"df['BWS_cat'] = np.where(df['aridAndLowWaterUse'],5,df['BWS_cat'])"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [],
"source": [
"df.to_csv('aqv3rutger.csv')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python [conda env:python3]",
"language": "python",
"name": "conda-env-python3-py"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.1"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment