Skip to content

Commit

Permalink
update for compatibility with pyam v0.5 (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhuppmann authored Apr 6, 2020
1 parent 085967f commit 93b922f
Show file tree
Hide file tree
Showing 26 changed files with 141 additions and 150 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ and the [data release notes](DATA_RELEASE_NOTES.md) in this repository.

## Scenario ensemble download

The scenario ensemble used for this assessment is available for download
at [data.ene.iiasa.ac.at/iamc-1.5c-explorer](https://data.ene.iiasa.ac.at/iamc-1.5c-explorer).
The scenario ensemble used for this assessment
and the metadata table of scenario categorisation and quantitative indicators
are available for download via
the [IAMC 1.5°C Scenario Explorer](https://data.ene.iiasa.ac.at/iamc-1.5c-explorer).

The scenario data is released under a custom license.
If appropriate reference is made to the data source, it is permitted to use
Expand Down
13 changes: 6 additions & 7 deletions assessment/spm_sr15_figure_3a_global_emissions_pathways.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"source": [
"import pandas as pd\n",
"import numpy as np\n",
"import warnings\n",
"import io\n",
"import itertools\n",
"import yaml\n",
Expand All @@ -56,8 +55,8 @@
"source": [
"## Import scenario data, categorization and specifications files\n",
"\n",
"The metadata file must be generated from the notebook `sr15_2.0_categories_indicators` included in this repository. \n",
"If the snapshot file has been updated, make sure that you rerun the categorization notebook.\n",
"The metadata file with scenario categorisation and quantitative indicators can be downloaded at [https://data.ene.iiasa.ac.at/iamc-1.5c-explorer](https://data.ene.iiasa.ac.at/iamc-1.5c-explorer). \n",
"Alternatively, it can be re-created using the notebook `sr15_2.0_categories_indicators`.\n",
"\n",
"The last cell of this section loads and assigns a number of auxiliary lists as defined in the categorization notebook."
]
Expand All @@ -68,7 +67,7 @@
"metadata": {},
"outputs": [],
"source": [
"sr1p5 = pyam.IamDataFrame(data='../data/iamc15_scenario_data_world_r1.1.xlsx')"
"sr1p5 = pyam.IamDataFrame(data='../data/iamc15_scenario_data_world_r2.0.xlsx')"
]
},
{
Expand All @@ -77,7 +76,7 @@
"metadata": {},
"outputs": [],
"source": [
"sr1p5.load_metadata('sr15_metadata_indicators.xlsx')"
"sr1p5.load_meta('sr15_metadata_indicators.xlsx')"
]
},
{
Expand Down Expand Up @@ -177,7 +176,7 @@
"source": [
"co2 = (\n",
" df.filter(variable='Emissions|CO2')\n",
" .convert_unit({'Mt CO2/yr': ('Gt CO2/yr', 0.001)})\n",
" .convert_unit('Mt CO2/yr', 'Gt CO2/yr')\n",
")\n",
"data.append(('Net carbon dioxide', co2))"
]
Expand Down Expand Up @@ -270,7 +269,7 @@
"outputs": [],
"source": [
"n2o = df.filter(variable='Emissions|N2O')\n",
"n2o.convert_unit({'kt N2O/yr': ('Mt N2O/yr', 0.001)}, inplace=True)\n",
"n2o.convert_unit('kt N2O/yr', 'Mt N2O/yr', factor=1/1000, inplace=True)\n",
"data.append(('Nitrous oxide', n2o))"
]
},
Expand Down
20 changes: 10 additions & 10 deletions assessment/spm_sr15_figure_3b_illustrative_pathways.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"source": [
"import pandas as pd\n",
"import numpy as np\n",
"import warnings\n",
"import io\n",
"import itertools\n",
"import yaml\n",
Expand All @@ -50,8 +49,8 @@
"source": [
"## Import scenario data, categorization and specifications files\n",
"\n",
"The metadata file must be generated from the notebook `sr15_2.0_categories_indicators` included in this repository. \n",
"If the snapshot file has been updated, make sure that you rerun the categorization notebook.\n",
"The metadata file with scenario categorisation and quantitative indicators can be downloaded at [https://data.ene.iiasa.ac.at/iamc-1.5c-explorer](https://data.ene.iiasa.ac.at/iamc-1.5c-explorer). \n",
"Alternatively, it can be re-created using the notebook `sr15_2.0_categories_indicators`.\n",
"\n",
"The last cell of this section loads and assigns a number of auxiliary lists as defined in the categorization notebook."
]
Expand All @@ -62,7 +61,7 @@
"metadata": {},
"outputs": [],
"source": [
"sr1p5 = pyam.IamDataFrame(data='../data/iamc15_scenario_data_world_r1.1.xlsx')"
"sr1p5 = pyam.IamDataFrame(data='../data/iamc15_scenario_data_world_r2.0.xlsx')"
]
},
{
Expand All @@ -71,7 +70,7 @@
"metadata": {},
"outputs": [],
"source": [
"sr1p5.load_metadata('sr15_metadata_indicators.xlsx')"
"sr1p5.load_meta('sr15_metadata_indicators.xlsx')"
]
},
{
Expand Down Expand Up @@ -163,7 +162,7 @@
"metadata": {},
"outputs": [],
"source": [
"pw.convert_unit({'Mt CO2/yr': ('Gt CO2/yr', 0.001)}, inplace=True)"
"pw.convert_unit('Mt CO2/yr', 'Gt CO2/yr', inplace=True)"
]
},
{
Expand Down Expand Up @@ -390,7 +389,7 @@
"source": [
"co2 = (\n",
" df.filter(kyoto_ghg_2010='in range', variable='Emissions|CO2', year=years)\n",
" .convert_unit({'Mt CO2/yr': ('Gt CO2/yr', 0.001)})\n",
" .convert_unit('Mt CO2/yr', 'Gt CO2/yr')\n",
" .timeseries()\n",
")"
]
Expand All @@ -415,7 +414,8 @@
"source": [
"kyoto_ghg = (\n",
" df.filter(kyoto_ghg_2010='in range', variable='Emissions|Kyoto Gases (SAR-GWP100)', year=years)\n",
" .convert_unit({'Mt CO2-equiv/yr': ('Gt CO2-equiv/yr', 0.001)})\n",
" .rename(unit={'Mt CO2-equiv/yr': 'Mt CO2e/yr'})\n",
" .convert_unit('Mt CO2e/yr','Gt CO2e/yr')\n",
" .timeseries()\n",
")\n",
"for y in compare_years:\n",
Expand Down Expand Up @@ -553,7 +553,7 @@
"\n",
" data = (\n",
" df.filter(variable=variable)\n",
" .convert_unit({'Mt CO2/yr': ('Gt CO2/yr', 0.001)})\n",
" .convert_unit('Mt CO2/yr', 'Gt CO2/yr')\n",
" .timeseries()\n",
" )\n",
" \n",
Expand Down Expand Up @@ -598,7 +598,7 @@
"source": [
"energy_crops = (\n",
" df.filter(variable='Land Cover|Cropland|Energy Crops', year=2050)\n",
" .convert_unit({'million ha': ('million km2', 0.01)})\n",
" .convert_unit('million ha', 'million km2', factor=0.01)\n",
" .timeseries()\n",
")"
]
Expand Down
17 changes: 9 additions & 8 deletions assessment/spm_sr15_statements.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"source": [
"import pandas as pd\n",
"import numpy as np\n",
"import warnings\n",
"import io\n",
"import itertools\n",
"import yaml\n",
Expand All @@ -49,8 +48,8 @@
"source": [
"## Import scenario data, categorization and specifications files\n",
"\n",
"The metadata file must be generated from the notebook `sr15_2.0_categories_indicators` included in this repository. \n",
"If the snapshot file has been updated, make sure that you rerun the categorization notebook.\n",
"The metadata file with scenario categorisation and quantitative indicators can be downloaded at [https://data.ene.iiasa.ac.at/iamc-1.5c-explorer](https://data.ene.iiasa.ac.at/iamc-1.5c-explorer). \n",
"Alternatively, it can be re-created using the notebook `sr15_2.0_categories_indicators`.\n",
"\n",
"The last cell of this section loads and assigns a number of auxiliary lists as defined in the categorization notebook."
]
Expand All @@ -61,7 +60,7 @@
"metadata": {},
"outputs": [],
"source": [
"sr1p5 = pyam.IamDataFrame(data='../data/iamc15_scenario_data_world_r1.1.xlsx')"
"sr1p5 = pyam.IamDataFrame(data='../data/iamc15_scenario_data_world_r2.0.xlsx')"
]
},
{
Expand All @@ -70,7 +69,7 @@
"metadata": {},
"outputs": [],
"source": [
"sr1p5.load_metadata('sr15_metadata_indicators.xlsx')"
"sr1p5.load_meta('sr15_metadata_indicators.xlsx')"
]
},
{
Expand Down Expand Up @@ -186,7 +185,7 @@
"co2 = (\n",
" df.filter(kyoto_ghg_2010='in range', variable='Emissions|CO2')\n",
" .filter(**filter_args_aim)\n",
" .convert_unit({'Mt CO2/yr': ('Gt CO2/yr', 0.001)})\n",
" .convert_unit('Mt CO2/yr', 'Gt CO2/yr')\n",
" .timeseries()\n",
")"
]
Expand Down Expand Up @@ -595,7 +594,8 @@
"source": [
"ghg_ar4_sar = (\n",
" df.filter(kyoto_ghg_2010='in range', variable='Emissions|Kyoto Gases (AR4-GWP100)')\n",
" .convert_unit({'Mt CO2-equiv/yr': ('Gt CO2-equiv/yr', 0.001)})\n",
" .rename(unit={'Mt CO2-equiv/yr': 'Mt CO2e/yr'})\n",
" .convert_unit('Mt CO2e/yr','Gt CO2e/yr')\n",
" .timeseries()\n",
")"
]
Expand Down Expand Up @@ -644,7 +644,8 @@
"source": [
"ghg_ar4 = (\n",
" df.filter(variable='Emissions|Kyoto Gases (AR4-GWP100)')\n",
" .convert_unit({'Mt CO2-equiv/yr': ('Gt CO2-equiv/yr', 0.001)})\n",
" .rename(unit={'Mt CO2-equiv/yr': 'Mt CO2e/yr'})\n",
" .convert_unit('Mt CO2e/yr','Gt CO2e/yr')\n",
" .timeseries()\n",
")"
]
Expand Down
6 changes: 3 additions & 3 deletions assessment/sr15_2.0_categories_indicators.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"outputs": [],
"source": [
"import pyam\n",
"logger = pyam.logger()"
"logger = pyam.logger"
]
},
{
Expand Down Expand Up @@ -127,7 +127,7 @@
"metadata": {},
"outputs": [],
"source": [
"sr1p5 = pyam.IamDataFrame(data='../data/iamc15_scenario_data_world_r1.1.xlsx')"
"sr1p5 = pyam.IamDataFrame(data='../data/iamc15_scenario_data_world_r2.0.xlsx')"
]
},
{
Expand Down Expand Up @@ -1461,7 +1461,7 @@
"def filter_and_convert(variable):\n",
" return (sr1p5\n",
" .filter(variable=variable)\n",
" .convert_unit({'Mt CO2/yr': ('Gt CO2/yr', 0.001)})\n",
" .convert_unit('Mt CO2/yr', 'Gt CO2/yr')\n",
" .timeseries()\n",
" )\n",
"\n",
Expand Down
12 changes: 6 additions & 6 deletions assessment/sr15_2.3.1_range_of_assumptions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
"source": [
"## Import scenario data, categorization and specifications files\n",
"\n",
"The metadata file must have been generated from the notebook `sr15_2.0_categories_indicators` included in this repository. \n",
"If the snapshot file has been updated, make sure that you rerun the categorization notebook.\n",
"The metadata file with scenario categorisation and quantitative indicators can be downloaded at [https://data.ene.iiasa.ac.at/iamc-1.5c-explorer](https://data.ene.iiasa.ac.at/iamc-1.5c-explorer). \n",
"Alternatively, it can be re-created using the notebook `sr15_2.0_categories_indicators`.\n",
"\n",
"The last cell of this section loads and assigns a number of auxiliary lists as defined in the categorization notebook."
]
Expand All @@ -61,7 +61,7 @@
"metadata": {},
"outputs": [],
"source": [
"sr1p5 = pyam.IamDataFrame(data='../data/iamc15_scenario_data_world_r1.1.xlsx')"
"sr1p5 = pyam.IamDataFrame(data='../data/iamc15_scenario_data_world_r2.0.xlsx')"
]
},
{
Expand All @@ -70,7 +70,7 @@
"metadata": {},
"outputs": [],
"source": [
"sr1p5.load_metadata('sr15_metadata_indicators.xlsx')"
"sr1p5.load_meta('sr15_metadata_indicators.xlsx')"
]
},
{
Expand Down Expand Up @@ -191,11 +191,11 @@
"fig, ax = plt.subplots(2, 2, figsize=(8, 6))\n",
"\n",
"pop = df.filter(variable='Population')\n",
"pop.convert_unit({'million': ['billion', 1/1000]}, inplace=True)\n",
"pop.convert_unit('million', 'billion', factor=1/1000, inplace=True)\n",
"line_plot_with_markers(ax[0][0], pop, 'Population', 'a')\n",
"\n",
"gdp = df.filter(variable='GDP|PPP')\n",
"gdp.convert_unit({'billion US$2010/yr': ['trillion US$2010/yr', 1/1000]}, inplace=True)\n",
"gdp.convert_unit('billion US$2010/yr', 'trillion US$2010/yr', factor=1/1000, inplace=True)\n",
"line_plot_with_markers(ax[0][1], gdp, 'Gross World Product', 'b')\n",
"\n",
"final = df.filter(variable='Final Energy')\n",
Expand Down
24 changes: 12 additions & 12 deletions assessment/sr15_2.3.3_global_emissions_characteristics.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"source": [
"import pandas as pd\n",
"import numpy as np\n",
"import warnings\n",
"import io\n",
"import itertools\n",
"import yaml\n",
Expand All @@ -51,8 +50,8 @@
"source": [
"## Import scenario data, categorization and specifications files\n",
"\n",
"The metadata file must be generated from the notebook `sr15_2.0_categories_indicators` included in this repository. \n",
"If the snapshot file has been updated, make sure that you rerun the categorization notebook.\n",
"The metadata file with scenario categorisation and quantitative indicators can be downloaded at [https://data.ene.iiasa.ac.at/iamc-1.5c-explorer](https://data.ene.iiasa.ac.at/iamc-1.5c-explorer). \n",
"Alternatively, it can be re-created using the notebook `sr15_2.0_categories_indicators`.\n",
"\n",
"The last cell of this section loads and assigns a number of auxiliary lists as defined in the categorization notebook."
]
Expand All @@ -63,7 +62,7 @@
"metadata": {},
"outputs": [],
"source": [
"sr1p5 = pyam.IamDataFrame(data='../data/iamc15_scenario_data_world_r1.1.xlsx')"
"sr1p5 = pyam.IamDataFrame(data='../data/iamc15_scenario_data_world_r2.0.xlsx')"
]
},
{
Expand All @@ -72,7 +71,7 @@
"metadata": {},
"outputs": [],
"source": [
"sr1p5.load_metadata('sr15_metadata_indicators.xlsx')"
"sr1p5.load_meta('sr15_metadata_indicators.xlsx')"
]
},
{
Expand Down Expand Up @@ -198,7 +197,8 @@
"source": [
"ghg = (\n",
" df.filter(variable='Emissions|Kyoto Gases (AR4-GWP100)')\n",
" .convert_unit({'Mt CO2-equiv/yr': ('Gt CO2-equiv/yr', 0.001)})\n",
" .rename(unit={'Mt CO2-equiv/yr': 'Mt CO2e/yr'})\n",
" .convert_unit('Mt CO2e/yr','Gt CO2e/yr')\n",
" .timeseries()\n",
")"
]
Expand All @@ -225,7 +225,7 @@
"source": [
"co2 = (\n",
" df.filter(variable='Emissions|CO2')\n",
" .convert_unit({'Mt CO2/yr': ('Gt CO2/yr', 0.001)})\n",
" .convert_unit('Mt CO2/yr', 'Gt CO2/yr')\n",
" .timeseries()\n",
")"
]
Expand All @@ -252,7 +252,7 @@
"source": [
"co2_afolu = (\n",
" df.filter(variable='Emissions|CO2|AFOLU')\n",
" .convert_unit({'Mt CO2/yr': ('Gt CO2/yr', 0.001)})\n",
" .convert_unit('Mt CO2/yr', 'Gt CO2/yr')\n",
" .timeseries()\n",
")"
]
Expand All @@ -279,7 +279,7 @@
"source": [
"n2o = (\n",
" df.filter(variable='Emissions|N2O')\n",
" .convert_unit({'kt N2O/yr': ('Mt N2O/yr', 0.001)}) \n",
" .convert_unit('kt N2O/yr', 'Mt N2O/yr', factor=1/1000)\n",
" .timeseries()\n",
")"
]
Expand Down Expand Up @@ -307,7 +307,7 @@
"source": [
"co2_ene = (\n",
" df.filter(variable='Emissions|CO2|Energy and Industrial Processes')\n",
" .convert_unit({'Mt CO2/yr': ('Gt CO2/yr', 0.001)})\n",
" .convert_unit('Mt CO2/yr', 'Gt CO2/yr')\n",
" .timeseries()\n",
")"
]
Expand All @@ -334,7 +334,7 @@
"source": [
"co2_supply = (\n",
" df.filter(variable='Emissions|CO2|Energy|Supply')\n",
" .convert_unit({'Mt CO2/yr': ('Gt CO2/yr', 0.001)})\n",
" .convert_unit('Mt CO2/yr', 'Gt CO2/yr')\n",
" .timeseries()\n",
")"
]
Expand All @@ -361,7 +361,7 @@
"source": [
"co2_demand = (\n",
" df.filter(variable='Emissions|CO2|Energy|Demand')\n",
" .convert_unit({'Mt CO2/yr': ('Gt CO2/yr', 0.001)})\n",
" .convert_unit('Mt CO2/yr', 'Gt CO2/yr')\n",
" .timeseries()\n",
")"
]
Expand Down
Loading

0 comments on commit 93b922f

Please sign in to comment.