{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "ExecuteTime": { "end_time": "2017-10-06T19:44:45.387902Z", "start_time": "2017-10-06T19:44:43.358391Z" }, "collapsed": true }, "outputs": [], "source": [ "%matplotlib inline\n", "import matplotlib.pyplot as plt\n", "import seaborn as sns\n", "import pandas as pd\n", "import numpy as np\n", "import os\n", "from os.path import join\n", "import sys\n", "import json" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "ExecuteTime": { "end_time": "2017-10-06T19:45:01.337538Z", "start_time": "2017-10-06T19:45:01.266594Z" }, "collapsed": true }, "outputs": [], "source": [ "# Load the \"autoreload\" extension\n", "%load_ext autoreload\n", "\n", "# always reload modules marked with \"%aimport\"\n", "%autoreload 1" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "ExecuteTime": { "end_time": "2017-10-06T19:46:04.101537Z", "start_time": "2017-10-06T19:46:04.097009Z" }, "collapsed": true }, "outputs": [], "source": [ "# add the 'src' directory as one where we can import modules\n", "cwd = os.getcwd()\n", "src_dir = join(cwd, os.pardir, 'src')\n", "sys.path.append(src_dir)" ] }, { "cell_type": "code", "execution_count": 26, "metadata": { "ExecuteTime": { "end_time": "2017-10-06T20:02:59.353425Z", "start_time": "2017-10-06T20:02:59.347122Z" }, "collapsed": true }, "outputs": [], "source": [ "from util.utils import rename_cols" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Load data" ] }, { "cell_type": "code", "execution_count": 31, "metadata": { "ExecuteTime": { "end_time": "2017-10-06T20:04:40.401619Z", "start_time": "2017-10-06T20:04:39.800061Z" } }, "outputs": [], "source": [ "#EPA CEMS data\n", "path = join(cwd, '..', 'Data storage', 'Derived data',\n", " 'Monthly EPA emissions 2017-08-31.csv')\n", "epa = pd.read_csv(path)\n", "rename_cols(epa)\n", "epa = epa.groupby(['year', 'month', 'plant id']).sum()" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "ExecuteTime": { "end_time": "2017-10-06T19:46:56.181114Z", "start_time": "2017-10-06T19:46:48.458776Z" }, "collapsed": true }, "outputs": [], "source": [ "#EIA facility data\n", "path = join(cwd, '..', 'Data storage',\n", " 'Facility gen fuels and CO2 2017-08-31.zip')\n", "eia_fac = pd.read_csv(path)\n", "rename_cols(eia_fac)\n", "eia_fac = eia_fac.groupby(['year', 'month', 'plant id', 'fuel']).sum()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Find a facility with biomass and CHP" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "ExecuteTime": { "end_time": "2017-10-06T19:53:28.304368Z", "start_time": "2017-10-06T19:53:28.300718Z" }, "collapsed": true }, "outputs": [], "source": [ "idx = pd.IndexSlice" ] }, { "cell_type": "code", "execution_count": 37, "metadata": { "ExecuteTime": { "end_time": "2017-10-06T20:18:00.871851Z", "start_time": "2017-10-06T20:18:00.767560Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", " | \n", " | \n", " | \n", " | total fuel (mmbtu) | \n", "generation (mwh) | \n", "elec fuel (mmbtu) | \n", "lat | \n", "lon | \n", "quarter | \n", "all fuel fossil co2 (kg) | \n", "elec fuel fossil co2 (kg) | \n", "all fuel total co2 (kg) | \n", "elec fuel total co2 (kg) | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
year | \n", "month | \n", "plant id | \n", "fuel | \n", "\n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " |
2016 | \n", "6 | \n", "1897 | \n", "NG | \n", "909.0 | \n", "3.547 | \n", "56.0 | \n", "46.735331 | \n", "-92.151711 | \n", "2 | \n", "48240.63 | \n", "2971.92 | \n", "48240.63 | \n", "2971.92 | \n", "
SUB | \n", "19577.0 | \n", "76.387 | \n", "1199.0 | \n", "46.735331 | \n", "-92.151711 | \n", "2 | \n", "1902884.40 | \n", "116542.80 | \n", "1902884.40 | \n", "116542.80 | \n", "|||
WDS | \n", "218373.0 | \n", "852.066 | \n", "13372.0 | \n", "46.735331 | \n", "-92.151711 | \n", "2 | \n", "0.00 | \n", "0.00 | \n", "20483387.40 | \n", "1254293.60 | \n", "