{ "cells": [ { "cell_type": "markdown", "id": "meaning-heading", "metadata": {}, "source": [ "**This code is based on the example2 (see example2 in the documentation [here](https://diw-evu.gitlab.io/dieter_public/dieterpy))**" ] }, { "cell_type": "code", "execution_count": 1, "id": "explicit-noise", "metadata": {}, "outputs": [], "source": [ "import pickle\n", "import gzip\n", "import glob" ] }, { "cell_type": "code", "execution_count": 2, "id": "sophisticated-facing", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['project_files/data_output/Run_000_20210315221115_b00_r000/Run_000_20210315221115_b00_r000.pkl.gz',\n", " 'project_files/data_output/Run_002_20210315221115_b00_r002/Run_002_20210315221115_b00_r002.pkl.gz',\n", " 'project_files/data_output/Run_003_20210315221115_b00_r003/Run_003_20210315221115_b00_r003.pkl.gz',\n", " 'project_files/data_output/Run_001_20210315221115_b00_r001/Run_001_20210315221115_b00_r001.pkl.gz']" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Our notebook is located in the main project folder\n", "scenfiles = glob.glob('project_files/data_output/**/*.pkl.gz', recursive=True)\n", "scenfiles" ] }, { "cell_type": "code", "execution_count": 3, "id": "modern-purse", "metadata": {}, "outputs": [], "source": [ "# we will open the first one: scenfiles[0]\n", "with gzip.open(scenfiles[0]) as f:\n", " dc = pickle.load(f)" ] }, { "cell_type": "code", "execution_count": 4, "id": "recent-keeping", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "dict_keys(['scenario', 'loop', 'scen_desc', 'CU', 'G_DO', 'G_UP', 'G_L', 'G_RES', 'STO_IN', 'STO_OUT', 'STO_L', 'con1a_bal', 'G_INFES', 'phi_res', 'RSVR_L', 'RSVR_OUT', 'd', 'N_TECH', 'F', 'rsvr_in', 'N_STO_E', 'c_m', 'N_STO_P', 'eta', 'eta_sto', 'N_RSVR_E', 'N_RSVR_P', 'con5c_max_node_CO2', 'etop_max', 'phi_sto_ini', 'c_m_sto', 'NTC', 'Z', 'phi_min_res', 'con5c_max_overall_CO2', 'inc', 'co2_cap_exog', 'c_infes', 'co2_cap'])" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dc.keys()" ] }, { "cell_type": "code", "execution_count": 5, "id": "sorted-indiana", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'Run_000_20210315221115_b00_r000'" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dc['scenario']" ] }, { "cell_type": "code", "execution_count": 6, "id": "explicit-commissioner", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'country_set': 'DE,FR',\n", " 'constraint_minRES': 'rescon_0a',\n", " 'constraint_carbon': 'max_node_CO2',\n", " \"phi_min_res('FR')\": 0.4,\n", " \"phi_min_res('DE')\": 0.5,\n", " 'solver_msg': 'LP status(1): optimal',\n", " 'long_id': 'Run_000_20210315221115_b00_r000'}" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dc['loop']" ] }, { "cell_type": "code", "execution_count": 7, "id": "minute-pharmacology", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "\"DE-FR_rescon_0a-max_node_CO2_NA_phi_min_res('FR')_0.4_phi_min_res('DE')_0.5\"" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dc['scen_desc']" ] }, { "cell_type": "code", "execution_count": 8, "id": "behavioral-target", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "dict_keys(['data', 'dims', 'type', 'symb_desc', 'symbol'])" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# The other keys are symbols. Symbols are contained in dictionaries. we pick one: STO_IN\n", "dc['STO_IN'].keys()" ] }, { "cell_type": "code", "execution_count": 9, "id": "developmental-concern", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'STO_IN'" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dc['STO_IN']['symbol']" ] }, { "cell_type": "code", "execution_count": 10, "id": "representative-strength", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'Storage inflow technology sto hour h [MWh]'" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dc['STO_IN']['symb_desc']" ] }, { "cell_type": "code", "execution_count": 11, "id": "similar-annual", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'variable'" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dc['STO_IN']['type']" ] }, { "cell_type": "code", "execution_count": 12, "id": "further-iraqi", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['n', 'sto', 'h']" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dc['STO_IN']['dims']" ] }, { "cell_type": "code", "execution_count": 13, "id": "optimum-hungarian", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | n | \n", "sto | \n", "h | \n", "Val | \n", "Marginal | \n", "Lower | \n", "Upper | \n", "
---|---|---|---|---|---|---|---|
0 | \n", "DE | \n", "Li-ion | \n", "h1 | \n", "0.000059 | \n", "38.333367 | \n", "0 | \n", "inf | \n", "
1 | \n", "DE | \n", "Li-ion | \n", "h2 | \n", "220.634419 | \n", "0.000012 | \n", "0 | \n", "inf | \n", "
2 | \n", "DE | \n", "Li-ion | \n", "h3 | \n", "260.351891 | \n", "0.000011 | \n", "0 | \n", "inf | \n", "
3 | \n", "DE | \n", "Li-ion | \n", "h4 | \n", "340.198929 | \n", "0.000008 | \n", "0 | \n", "inf | \n", "
4 | \n", "DE | \n", "Li-ion | \n", "h5 | \n", "679.208690 | \n", "0.000004 | \n", "0 | \n", "inf | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
52555 | \n", "FR | \n", "PHS | \n", "h8756 | \n", "0.001021 | \n", "2.199122 | \n", "0 | \n", "inf | \n", "
52556 | \n", "FR | \n", "PHS | \n", "h8757 | \n", "0.003061 | \n", "0.719486 | \n", "0 | \n", "inf | \n", "
52557 | \n", "FR | \n", "PHS | \n", "h8758 | \n", "0.003109 | \n", "0.719473 | \n", "0 | \n", "inf | \n", "
52558 | \n", "FR | \n", "PHS | \n", "h8759 | \n", "0.001019 | \n", "2.199125 | \n", "0 | \n", "inf | \n", "
52559 | \n", "FR | \n", "PHS | \n", "h8760 | \n", "0.001016 | \n", "2.199127 | \n", "0 | \n", "inf | \n", "
52560 rows × 7 columns
\n", "