Skip to content

Commit

Permalink
Merge pull request #3 from chrisroadmap/forcing-out
Browse files Browse the repository at this point in the history
include methane ERF as an output
  • Loading branch information
chrisroadmap authored Nov 3, 2021
2 parents f3e327f + fd824e5 commit 65d027e
Show file tree
Hide file tree
Showing 6 changed files with 548 additions and 11 deletions.
107 changes: 107 additions & 0 deletions data_output/fair_ch4_effective_radiative_forcing/ch4_30.csv

Large diffs are not rendered by default.

107 changes: 107 additions & 0 deletions data_output/fair_ch4_effective_radiative_forcing/ch4_40.csv

Large diffs are not rendered by default.

107 changes: 107 additions & 0 deletions data_output/fair_ch4_effective_radiative_forcing/ch4_50.csv

Large diffs are not rendered by default.

107 changes: 107 additions & 0 deletions data_output/fair_ch4_effective_radiative_forcing/coal-phase-out.csv

Large diffs are not rendered by default.

Large diffs are not rendered by default.

24 changes: 13 additions & 11 deletions notebooks/3_run-emissions-scenarios.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
"source": [
"def run_fair(args):\n",
" thisC, thisF, thisT, _, thisOHU, _, thisAF = fair.forward.fair_scm(**args)\n",
" return (thisC[:,0], thisC[:,1], thisT, np.sum(thisF, axis=1))\n",
" return (thisC[:,0], thisC[:,1], thisT, thisF[:,1], np.sum(thisF, axis=1))\n",
"\n",
"def fair_process(emissions):\n",
" updated_config = []\n",
Expand All @@ -117,20 +117,21 @@
" c_co2 = np.ones(shape) * np.nan\n",
" c_ch4 = np.ones(shape) * np.nan\n",
" t = np.ones(shape) * np.nan\n",
" f_ch4 = np.ones(shape) * np.nan\n",
" f_tot = np.ones(shape) * np.nan\n",
" for i, cfg in tqdm(enumerate(updated_config), total=len(updated_config), position=0, leave=True):\n",
" c_co2[:,i], c_ch4[:,i], t[:,i], f_tot[:,i] = run_fair(updated_config[i])\n",
" c_co2[:,i], c_ch4[:,i], t[:,i], f_ch4[:,i], f_tot[:,i] = run_fair(updated_config[i])\n",
" \n",
" else:\n",
" if __name__ == '__main__':\n",
" with Pool(WORKERS) as pool:\n",
" result = list(tqdm(pool.imap(run_fair, updated_config), total=len(updated_config), position=0, leave=True))\n",
"\n",
" result_t = np.array(result).transpose(1,2,0)\n",
" c_co2, c_ch4, t, f_tot = result_t\n",
" c_co2, c_ch4, t, f_ch4, f_tot = result_t\n",
" temp_rebase = t - t[100:151,:].mean(axis=0)\n",
" \n",
" return c_co2, c_ch4, temp_rebase, f_tot"
" return c_co2, c_ch4, temp_rebase, f_ch4, f_tot"
]
},
{
Expand All @@ -151,12 +152,12 @@
"name": "stderr",
"output_type": "stream",
"text": [
"100%|███████████████████████████████████████| 2237/2237 [02:44<00:00, 13.57it/s]\n",
"100%|███████████████████████████████████████| 2237/2237 [02:29<00:00, 14.93it/s]\n",
"100%|███████████████████████████████████████| 2237/2237 [02:35<00:00, 14.37it/s]\n",
"100%|███████████████████████████████████████| 2237/2237 [03:38<00:00, 10.23it/s]\n",
"100%|███████████████████████████████████████| 2237/2237 [02:50<00:00, 13.16it/s]\n",
"100%|████████████████████████████████████████████| 5/5 [14:26<00:00, 173.25s/it]\n"
"100%|███████████████████████████████████████| 2237/2237 [03:22<00:00, 11.05it/s]\n",
"100%|███████████████████████████████████████| 2237/2237 [02:55<00:00, 12.77it/s]\n",
"100%|███████████████████████████████████████| 2237/2237 [02:59<00:00, 12.46it/s]\n",
"100%|███████████████████████████████████████| 2237/2237 [03:07<00:00, 11.91it/s]\n",
"100%|███████████████████████████████████████| 2237/2237 [02:58<00:00, 12.50it/s]\n",
"100%|████████████████████████████████████████████| 5/5 [15:29<00:00, 185.91s/it]\n"
]
}
],
Expand All @@ -167,6 +168,7 @@
" results_out[scenario]['co2_concentrations'],\n",
" results_out[scenario]['ch4_concentrations'],\n",
" results_out[scenario]['temperatures'],\n",
" results_out[scenario]['ch4_effective_radiative_forcing'],\n",
" results_out[scenario]['effective_radiative_forcing']\n",
" ) = fair_process(emissions_in[scenario])"
]
Expand All @@ -187,7 +189,7 @@
"outputs": [],
"source": [
"for scenario in scenarios:\n",
" for var in ['co2_concentrations', 'ch4_concentrations', 'temperatures', 'effective_radiative_forcing']:\n",
" for var in ['co2_concentrations', 'ch4_concentrations', 'temperatures', 'ch4_effective_radiative_forcing', 'effective_radiative_forcing']:\n",
" mkdir_p('../data_output/fair_{}/'.format(var))\n",
" df_out = pd.DataFrame(results_out[scenario][var][245:351,:])\n",
" df_out['year'] = np.arange(1995.5, 2101)\n",
Expand Down

0 comments on commit 65d027e

Please sign in to comment.