diff --git a/Fund/Data/Base/cbox10.csv b/Fund/Data/Base/cbox10.csv index c645f457..b5b382f6 100644 --- a/Fund/Data/Base/cbox10.csv +++ b/Fund/Data/Base/cbox10.csv @@ -1,2 +1,2 @@ # FUND scenario -283.53 +296.002949511 diff --git a/Fund/Data/Base/cbox20.csv b/Fund/Data/Base/cbox20.csv index bf379129..2080247f 100644 --- a/Fund/Data/Base/cbox20.csv +++ b/Fund/Data/Base/cbox20.csv @@ -1,2 +1,2 @@ # FUND scenario -5.62 +5.52417779186 diff --git a/Fund/Data/Base/cbox30.csv b/Fund/Data/Base/cbox30.csv index b8ded7d1..9553ccf8 100644 --- a/Fund/Data/Base/cbox30.csv +++ b/Fund/Data/Base/cbox30.csv @@ -1,2 +1,2 @@ # FUND scenario -6.29 +6.65150094285 diff --git a/Fund/Data/Base/cbox40.csv b/Fund/Data/Base/cbox40.csv index 6f92c54f..080f369c 100644 --- a/Fund/Data/Base/cbox40.csv +++ b/Fund/Data/Base/cbox40.csv @@ -1,2 +1,2 @@ # FUND scenario -2.19 +2.39635475726 diff --git a/Fund/Data/Base/cbox50.csv b/Fund/Data/Base/cbox50.csv index ddcbec5f..5b34ed78 100644 --- a/Fund/Data/Base/cbox50.csv +++ b/Fund/Data/Base/cbox50.csv @@ -1,2 +1,2 @@ # FUND scenario -0.15 +0.17501699667 diff --git a/calibration/co2cycle/RCP85_EMISSIONS.xls b/calibration/co2cycle/RCP85_EMISSIONS.xls new file mode 100644 index 00000000..8459e2e4 Binary files /dev/null and b/calibration/co2cycle/RCP85_EMISSIONS.xls differ diff --git a/calibration/co2cycle/RCP85_MIDYEAR_CONCENTRATIONS.xls b/calibration/co2cycle/RCP85_MIDYEAR_CONCENTRATIONS.xls new file mode 100644 index 00000000..6f9df3fa Binary files /dev/null and b/calibration/co2cycle/RCP85_MIDYEAR_CONCENTRATIONS.xls differ diff --git a/calibration/co2cycle/fund_co2_cycle.ipynb b/calibration/co2cycle/fund_co2_cycle.ipynb new file mode 100644 index 00000000..11e0ee95 --- /dev/null +++ b/calibration/co2cycle/fund_co2_cycle.ipynb @@ -0,0 +1,214 @@ +{ + "metadata": { + "name": "" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import pandas" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "FUND carbon cycle" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "I. Introduction" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "This file calibrates the initial values for the five boxes of the carbon cycle component. The FUND carbon cycle is run with historical emissions from the RCP data set up to 1950 to compute the CO2 content of each of the five boxes in 1950. An additional calibration factor is computed to force the 1950 concentrations to match observed concentrations in that year." + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "II. Data sources" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Data obtained from http://www.pik-potsdam.de/~mmalte/rcps/ on 11/15/2013 by Anthoff." + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "rcp_emissions = pandas.read_excel('RCP85_EMISSIONS.xls', 'RCP85_EMISSIONS', skiprows=37, index_col=0)\n", + "rcp_emissions.index.name='year'" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 2 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "rcp_concentrations = pandas.read_excel('RCP85_MIDYEAR_CONCENTRATIONS.xls', 'RCP85_MIDYEAR_CONCENTRATIONS', skiprows=38, index_col=0)\n", + "rcp_concentrations.index.name='year'" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "III. Computation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Run the FUND carbon cycle with RCP historical emissions data." + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "# Convert to FUND units\n", + "emissions = rcp_emissions['FossilCO2'].values * 1000.0\n", + "\n", + "# Parameters\n", + "co2decay = numpy.array([1.0, exp(-1.0/363.0), exp(-1.0/74.0),exp(-1.0/17.0),exp(-1.0/2.0)])\n", + "co2frac = numpy.array([0.13,0.2,0.32,0.25,0.1])\n", + "\n", + "# State variables\n", + "cbox = numpy.zeros((len(emissions),5))\n", + "acco2 = numpy.zeros(len(emissions))\n", + "\n", + "# Initial values\n", + "cbox[0,0]=rcp_concentrations['CO2'][0]\n", + "acco2[0] = cbox[0,:].sum()\n", + "\n", + "# Transition function\n", + "for t in range(0,len(emissions)-1):\n", + " cbox[t+1,:] = cbox[t,:] * co2decay[:] + 0.000471 * co2frac[:] * emissions[t]\n", + " acco2[t+1] = cbox[t+1,:].sum()\n", + " \n", + "fund_concentrations = pandas.DataFrame(acco2,index=rcp_emissions.index)\n", + "fund_boxes = pandas.DataFrame(cbox,index=rcp_emissions.index)" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 4 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Compute a calibration factor that forces CO2 concentrations as computed by the FUND component to match observed concentrations in 1950." + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "calibration_factor = rcp_concentrations['CO2'].loc[1950]/fund_concentrations.loc[1950][0]" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 5 + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Display initial CO2 concentrations per box in 1950 for FUND with the calibration factor applied. Those are the initial values used in FUND." + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "numpy.round(fund_boxes.loc[1950]*calibration_factor,2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "metadata": {}, + "output_type": "pyout", + "prompt_number": 6, + "text": [ + "0 296.00\n", + "1 5.52\n", + "2 6.65\n", + "3 2.40\n", + "4 0.18\n", + "Name: 1950.0, dtype: float64" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "IV. Output" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Write the input files for the model." + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "for i in range(5):\n", + " with open('../../Fund/Data/Base/cbox%s0.csv'%(i+1),'w') as f:\n", + " f.write('# FUND scenario\\n')\n", + " f.write(str(fund_boxes.loc[1950][i]*calibration_factor))\n", + " f.write('\\n')" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 7 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file