{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "Sources:\n", "- Data: https://agupubs.onlinelibrary.wiley.com/doi/full/10.1029/2019RG000691\n", "- The original code for the evaluation of GWP/GTP from AR6 Table 7.SM.7 is available here: https://github.com/chrisroadmap/ar6/blob/main/notebooks/335_chapter7_generate_metrics.ipynb\n", "- The actual metrics calculations is here: https://github.com/chrisroadmap/ar6/tree/main/src/ar6/metrics" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "import numpy as np" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "data = pd.read_csv('/Users/timodiepers/Documents/Coding/timex/bw_timex/data/hodnebrog20.csv', usecols=[\"CASRN\", \"Molar mass\", \"Lifetime (yr)\", \"RE (W m-2 ppb-1)\"]).dropna()" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
CASRNMolar massLifetime (yr)RE (W m-2 ppb-1)
175-69-40.1373652.00000.25941
275-71-80.12091102.00000.31998
375-72-90.10446640.00000.27752
476-12-00.2038263.60000.28192
576-11-90.2038252.00000.24564
...............
610141-63-90.384890.01100.06400
611541-05-90.222480.03840.10000
612556-67-20.296640.02740.12000
613541-02-60.370800.01640.09800
614540-97-60.444960.01100.08600
\n", "

243 rows × 4 columns

\n", "
" ], "text/plain": [ " CASRN Molar mass Lifetime (yr) RE (W m-2 ppb-1)\n", "1 75-69-4 0.13736 52.0000 0.25941\n", "2 75-71-8 0.12091 102.0000 0.31998\n", "3 75-72-9 0.10446 640.0000 0.27752\n", "4 76-12-0 0.20382 63.6000 0.28192\n", "5 76-11-9 0.20382 52.0000 0.24564\n", ".. ... ... ... ...\n", "610 141-63-9 0.38489 0.0110 0.06400\n", "611 541-05-9 0.22248 0.0384 0.10000\n", "612 556-67-2 0.29664 0.0274 0.12000\n", "613 541-02-6 0.37080 0.0164 0.09800\n", "614 540-97-6 0.44496 0.0110 0.08600\n", "\n", "[243 rows x 4 columns]" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "def format_cas(cas):\n", " # Split the CAS number by the dash\n", " parts = cas.split('-')\n", " # Format the first part to ensure it has 6 digits\n", " parts[0] = parts[0].zfill(6)\n", " # Join the parts back together and return\n", " return '-'.join(parts)\n", "\n", "M_air = 28.97e-3 # kg/mol, dry air\n", "m_atmosphere = 5.135e18 # kg [Trenberth and Smith, 2005]\n", "\n", "decay_multipliers_dict = {}\n", " \n", "for cas, tau, M, radiative_efficiency_ppb in zip(data['CASRN'], data['Lifetime (yr)'], data['Molar mass'], data['RE (W m-2 ppb-1)']):\n", " \n", " if cas == \"2551-62-4\":\n", " tau = 1000 # Decreased lifetime of SF6 from 3200 to 1000 years. See IPCC AR6, Ch. 2.2.4.3. doi: 10.1017/9781009157896.004\n", " \n", " # for conversion from ppb to kg-CH4\n", " radiative_efficiency_kg = (\n", " radiative_efficiency_ppb * M_air / M * 1e9 / m_atmosphere\n", " ) # W/m2/kg-CH4;\n", "\n", " decay_multipliers: list = np.array(\n", " [\n", " radiative_efficiency_kg * tau * (1 - np.exp(-year / tau))\n", " for year in range(2000)\n", " ]\n", " ).tolist()\n", " \n", " decay_multipliers_dict[format_cas(cas)] = decay_multipliers" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "import json" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "with open('decay_multipliers.json', 'w') as f:\n", " json.dump(decay_multipliers_dict, f)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "timex", "language": "python", "name": "python3" }, "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.11.9" } }, "nbformat": 4, "nbformat_minor": 2 }