Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Harmonisation #43

Open
wants to merge 3 commits into
base: add-gcages
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,30 @@
# Output plots
*.pdf

# Processed data
data/national/ceds/processed
data/national/gfed/processed
data/national/gfed-bb4cmip/processed
data/global/adam-et-al-2024/processed
data/global/edgar/processed/
data/global/gcb/processed
data/global/velders-et-al-2022/processed/
data/global/wmo-2022/processed
data/combined-processed-output
data/global-composite

# Raw WMO data
data/global/wmo-2022/data_raw

# EDGAR data
data/global/edgar/data_raw/

# RCMIP data
data/global/rcmip/data_raw

# GCB raw data
data/global/gcb/data_raw

# CEDS data
data/national/ceds/data_raw

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Global annual emissions for HFC-23
# Outputs from AGAGE 12-box model
# Time stamps are the centre of the averaging period
# ||90-30N| 30-0N| 0-30S | 30-90S
# ||=============================
# 1000-500hPa|| Box0 | Box1 | Box2 | Box3
# 500-200hPa|| Box4 | Box5 | Box6 | Box7
# 200- hPa|| Box8 | Box9 | Box10 | Box11
# Contact Matt Rigby or Luke Western (University of Bristol)
# [email protected]/[email protected]
# File created 2024-02-12 14:24:10.839835+00:00
# Units: Gg/yr
Year,Month,Decimal_date,Global_annual_emissions,Global_annual_emissions_1-sigma
1975,6,1975.46,3.3082381022962006,0.9783583998800276
1976,6,1976.46,3.412108853553091,1.1920795413621776
1977,6,1977.46,3.6542986657185987,1.1675173798851615
1978,6,1978.46,4.055111559383712,1.0500178334971184
1979,6,1979.46,4.216507724685216,0.9573601350210964
1980,6,1980.46,4.3261330935472495,0.9416762796963863
1981,6,1981.46,4.227156807146147,0.899283826576965
1982,6,1982.46,3.834191418686187,0.9065827719459081
1983,6,1983.46,4.656061392177526,0.9586185322863234
1984,6,1984.46,5.090458271193384,0.8692295602085965
1985,6,1985.46,5.350316483906609,0.8494280517555504
1986,6,1986.46,5.7479251719451545,0.8573542430396427
1987,6,1987.46,5.794054187638121,0.8278671083460137
1988,6,1988.46,6.748611281315206,0.8330146381055876
1989,6,1989.46,7.618529880341374,0.8604183181649075
1990,6,1990.46,7.082930135477382,0.8294217921927168
1991,6,1991.46,6.619382252408158,0.8518339351973709
1992,6,1992.46,7.2788473124675335,0.8207619866400576
1993,6,1993.46,8.188958959406902,0.8020050274215419
1994,6,1994.46,8.177011135188787,0.8085693031591361
1995,6,1995.46,9.088606061045377,0.8109785535012753
1996,6,1996.46,9.520253967726967,0.8314454478187091
1997,6,1997.46,10.100806056679165,0.8314476215021896
1998,6,1998.46,10.42264981740719,0.7671522971499976
1999,6,1999.46,10.348867029978964,0.8064610668983494
2000,6,2000.46,11.064797997100351,0.8884679319803815
2001,6,2001.46,8.939704475878814,0.8574240863213126
2002,6,2002.46,9.46819793866396,0.8554461895471467
2003,6,2003.46,9.637622482754454,0.8606079273538187
2004,6,2004.46,11.866019158721869,0.8757073162380118
2005,6,2005.46,12.652068493728821,0.8672572218560374
2006,6,2006.46,14.336407780532454,0.8865562476484358
2007,6,2007.46,11.611248947209765,0.8359125762498057
2008,6,2008.46,11.45835028503325,0.6308386844128152
2009,6,2009.46,9.59748778636138,0.5630194265141016
2010,6,2010.46,10.52849805758974,0.5964640914139149
2011,6,2011.46,11.728609157340069,0.6115274290185482
2012,6,2012.46,12.919691799546976,0.6340449827646341
2013,6,2013.46,13.923964302794822,0.652588179698151
2014,6,2014.46,14.435299277869296,0.6905524908523142
2015,6,2015.46,12.873910864335862,0.6370848043270962
2016,6,2016.46,12.786738245751446,0.6562897041216607
2017,6,2017.46,15.123098674685131,0.7198020100101903
2018,6,2018.46,16.832849727946375,0.73345354496374
2019,6,2019.46,17.311924936295306,0.7584004353710423
2020,6,2020.46,16.50514026193276,0.755355605623176
2021,6,2021.46,15.533804205481097,0.7596433598791492
2022,6,2022.46,13.954471607853897,0.7664611734140768
2023,6,2023.46,14.051843086776302,0.9477747363753392
4 changes: 4 additions & 0 deletions data/global/adam-et-al-2024/data_raw/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Adam et al. 2024 data

Paper: https://doi.org/10.1038/s43247-024-01946-y
Data supplied by the authors directly.

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions data/global/velders-et-al-2022/data_raw/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Data provided by Guus Velders ([email protected]), Nov. 29, 2024.

This is a temporary solution.
We will use the Zenodo record when it is updated.
13 changes: 13 additions & 0 deletions data/global/velders-et-al-2022/data_raw/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Data accompanying the article

"Projections of hydrofluorocarbon (HFC) emissions and the resulting global warming based on recent trends in observed
abundances and current policies" by

Guus J.M. Velders, John S. Daniel, Stephen A. Montzka, Isaac Vimont, Matthew Rigby, Paul B. Krummel, Jens Muhle,
Simon O'Doherty, Ronald G. Prinn, Ray F. Weiss, and Dickon Young

Output files of the scenario model for the Kigali Amendment (data in t/yr or tCO2-eq/yr)
- KGL2021_constrProdEmis_ObsAgage_2500_OECD-SSP5.dat: upper range
- Data extended to 2500 by keeping the GDP and population constant past 2100

Guus Velders ([email protected]), Nov. 29, 2024
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Global annual emissions for C2F6
# Outputs from AGAGE 12-box model
# Time stamps are the centre of the averaging period
# ||90-30N| 30-0N| 0-30S | 30-90S
# ||=============================
# 1000-500hPa|| Box0 | Box1 | Box2 | Box3
# 500-200hPa|| Box4 | Box5 | Box6 | Box7
# 200- hPa|| Box8 | Box9 | Box10 | Box11
# Contact Matt Rigby or Luke Western (University of Bristol)
# [email protected]/[email protected]
# File created 2022-05-06 13:57:04.510860+00:00
# Units: Gg/yr
Year,Month,Decimal_date,Global_annual_emissions,Global_annual_emissions_1-sigma
1973,6,1973.46,2.0079454531542074,0.2147636836757873
1974,6,1974.46,2.06195325203483,0.19472037347828922
1975,6,1975.46,1.8979078807368006,0.19273444474993745
1976,6,1976.46,1.830444820630274,0.21858787053373865
1977,6,1977.46,1.8940150735651813,0.19414344068139341
1978,6,1978.46,1.966874770236488,0.21248342896081746
1979,6,1979.46,2.0349533887230007,0.2384128693778127
1980,6,1980.46,2.0622560700147337,0.22132260411116855
1981,6,1981.46,1.893829099749067,0.20994528786198624
1982,6,1982.46,1.6349034648043952,0.2160120448766821
1983,6,1983.46,1.7313384089547503,0.21373119782491354
1984,6,1984.46,2.266643877579255,0.23323396594863205
1985,6,1985.46,2.3111345601743167,0.2158281246236931
1986,6,1986.46,2.2426380348194566,0.2155943101115059
1987,6,1987.46,2.0917832822617446,0.21895079391810188
1988,6,1988.46,2.151259271466081,0.2183837396888249
1989,6,1989.46,2.2700923147831875,0.22506645514557735
1990,6,1990.46,2.299541445538168,0.2181625908067751
1991,6,1991.46,2.3098490267598204,0.21752875840309469
1992,6,1992.46,2.106891382558718,0.21364803947403047
1993,6,1993.46,2.102876606977528,0.21187460641188385
1994,6,1994.46,2.079866865940978,0.21355630635518702
1995,6,1995.46,2.2865638574440306,0.2129887297351558
1996,6,1996.46,2.591237829378663,0.2148005861256201
1997,6,1997.46,2.925239322380899,0.20407486612791897
1998,6,1998.46,2.957889384961916,0.2090814019899756
1999,6,1999.46,3.0514272588947553,0.20871109143734046
2000,6,2000.46,3.102689945987825,0.2216620972703224
2001,6,2001.46,2.8690536138370724,0.2029512779952538
2002,6,2002.46,2.8517185759003127,0.20310131020208028
2003,6,2003.46,2.6629576036186786,0.1863288068314249
2004,6,2004.46,2.3989333845876217,0.16440684838385813
2005,6,2005.46,2.238795891971414,0.15934356197453414
2006,6,2006.46,2.3015381449268517,0.1502794064899895
2007,6,2007.46,2.318492396593854,0.14326019744336865
2008,6,2008.46,2.0762184843864833,0.14720374294607805
2009,6,2009.46,1.8570969198323544,0.1451074874458068
2010,6,2010.46,1.9757946555097197,0.14419604442605832
2011,6,2011.46,1.94415200227046,0.14523805704535342
2012,6,2012.46,1.9079333239879899,0.13308757378407907
2013,6,2013.46,1.9373561059909539,0.13238380172411768
2014,6,2014.46,1.9465674803031694,0.1278600018676643
2015,6,2015.46,1.9677858836596582,0.13299912112743487
2016,6,2016.46,2.1389154431359017,0.13622997189197536
2017,6,2017.46,2.2674909334704263,0.14162107433942348
2018,6,2018.46,2.2119538875579834,0.13869458997583145
2019,6,2019.46,2.2036141167563446,0.13613941082841757
2020,6,2020.46,2.1686617929881904,0.13875398679766335
2021,6,2021.46,2.2563987648752435,0.1924415060909131
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Global annual emissions for CF4
# Outputs from AGAGE 12-box model
# Time stamps are the centre of the averaging period
# ||90-30N| 30-0N| 0-30S | 30-90S
# ||=============================
# 1000-500hPa|| Box0 | Box1 | Box2 | Box3
# 500-200hPa|| Box4 | Box5 | Box6 | Box7
# 200- hPa|| Box8 | Box9 | Box10 | Box11
# Contact Matt Rigby or Luke Western (University of Bristol)
# [email protected]/[email protected]
# File created 2022-05-06 13:57:02.711846+00:00
# Units: Gg/yr
Year,Month,Decimal_date,Global_annual_emissions,Global_annual_emissions_1-sigma
1973,6,1973.46,17.92716025637551,1.3066894867349428
1974,6,1974.46,18.653299439212248,1.3232037098693277
1975,6,1975.46,17.18894418769766,1.261566932898014
1976,6,1976.46,16.87643898417258,1.3201816864548468
1977,6,1977.46,17.72383592630971,1.278778476522782
1978,6,1978.46,18.163972717206263,1.3243146129503862
1979,6,1979.46,18.762477044600306,1.2889222242124694
1980,6,1980.46,18.262045708069788,1.3630679595929562
1981,6,1981.46,17.515370015672943,1.2699010657152385
1982,6,1982.46,15.921252459825107,1.2602857810057837
1983,6,1983.46,16.001548136731085,1.3134593263224519
1984,6,1984.46,17.118331830614785,1.355401643945485
1985,6,1985.46,16.41348270000749,1.2714070976356713
1986,6,1986.46,15.593639697452891,1.2522506186701279
1987,6,1987.46,15.960189522649218,1.3018384753625203
1988,6,1988.46,16.11119723111036,1.2242669578796552
1989,6,1989.46,16.386421786472216,1.2695082639969362
1990,6,1990.46,15.5480897171484,1.2359964278252153
1991,6,1991.46,15.53706864579676,1.2258813890989837
1992,6,1992.46,13.226407159206437,1.1912038919241847
1993,6,1993.46,12.45592769420326,1.1844928586805183
1994,6,1994.46,11.445083718663897,1.1866800396981767
1995,6,1995.46,11.498757947441016,1.1448568300789324
1996,6,1996.46,11.4355742090501,1.1952200144825766
1997,6,1997.46,11.316001369740775,1.113781232533771
1998,6,1998.46,11.125525874544266,1.2000834341482407
1999,6,1999.46,11.070059449618213,1.165116720974689
2000,6,2000.46,10.982572045119708,1.1725861397320938
2001,6,2001.46,10.373885287856213,1.1321219648835332
2002,6,2002.46,10.43503109249973,1.1123411459166683
2003,6,2003.46,10.997460116931789,1.0314430440642788
2004,6,2004.46,10.989421585356716,0.988448047437027
2005,6,2005.46,10.746792821111343,0.9014935116566809
2006,6,2006.46,10.950571202478505,0.8297420079751083
2007,6,2007.46,10.912631867280977,0.8136918973778051
2008,6,2008.46,10.240715819685489,0.7883416207045977
2009,6,2009.46,9.6453176650851,0.8226950962575802
2010,6,2010.46,10.219736763929701,0.8074741200112729
2011,6,2011.46,10.964861573084887,0.8295164052346766
2012,6,2012.46,11.174480376199154,0.8381134894239762
2013,6,2013.46,11.124941193445876,0.8020950058381047
2014,6,2014.46,11.250069575206522,0.8412603125730236
2015,6,2015.46,11.975292599558498,0.8859332290027491
2016,6,2016.46,12.947901930554805,0.8945874709797956
2017,6,2017.46,13.910992392142996,0.8649547529305697
2018,6,2018.46,14.339609082955414,0.8990556244649821
2019,6,2019.46,14.443486311623142,0.9334746935741339
2020,6,2020.46,14.541187658098986,1.0549431621710736
2021,6,2021.46,14.733364481344163,1.37469073930619
3 changes: 3 additions & 0 deletions data/global/wmo-2022/data_raw/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Data from [the 2022 WMO Ozone Assessment](https://csl.noaa.gov/assessments/ozone/2022/).

Provided by the authors.
2 changes: 2 additions & 0 deletions data/scenarios/data_raw/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Ignore the download scenarios, they should be grabbed from the database
*__scenarios-scenariomip__*.csv
27 changes: 27 additions & 0 deletions data/scenarios/data_raw/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Scenario data can be downloaded from IIASA's resources here:
https://data.ece.iiasa.ac.at/ssp-submission.

Downloading the data can be done with the following commands.
(if you're not on a unix-based system,
create a virtual environment using whatever environment manager you like
then remove `venv/bin/` from all the commands below).

```sh
# Install pyam-iamc
python3 -m venv venv
venv/bin/pip install --upgrade pip wheel
venv/bin/pip install pyam-iamc tqdm
```

Login with ixmp4

```sh
# Note that this saves your login on your machine in plain text, be careful.
venv/bin/ixmp4 login <your-username>
```

Then, download the data

```sh
venv/bin/python download-database.py
```
31 changes: 31 additions & 0 deletions data/scenarios/data_raw/download-database.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import datetime as dt
from pathlib import Path

import pyam
import tqdm

OUT_DIR = Path(__file__).parents[0]

time_id = dt.datetime.now().strftime("%Y%m%d-%H%M%S")

# Establish connection to the legacy pyam platform 'ssp-submission'
pyam.iiasa.Connection("ssp_submission")
conn_ssp = pyam.iiasa.Connection("ssp_submission")
props = conn_ssp.properties().reset_index()

# Retrieve the desired scenarios' emissions
# (download everything; loop over model-scenario combinations to not blow up RAM)
for model, scenario in tqdm.tqdm(
zip(props["model"], props["scenario"]), total=len(props["model"]), desc="Model-scenario combinations"
):
print(f"Grabbing {model=} {scenario=}")
df = pyam.read_iiasa("ssp_submission", model=model, scenario=scenario, variable="Emissions|*")
if df.empty:
print(f"No data for {model=} {scenario=}")
continue

# Write out the scenario data
output_filename = f"{time_id}__scenarios-scenariomip__{model}__{scenario}.csv".replace("/", "_").replace(" ", "-")
output_file = OUT_DIR / output_filename
df.to_csv(output_file)
print(f"Data for {model} {scenario} has been written to {output_file}")
7 changes: 7 additions & 0 deletions gcages/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@ authors = [
license = { text = "placeholder" }
requires-python = ">=3.9"
dependencies = [
# TODO: add min pins here
"aneris-iamc>=0.3.0",
"loguru",
"openscm-units",
"pandas",
"scipy",
"tqdm",
"typer",
]
readme = "README.md"
classifiers = [
Expand Down
7 changes: 6 additions & 1 deletion notebooks/0101_CEDS-prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
CEDS_EXPECTED_NUMBER_OF_REGION_VARIABLE_PAIRS_IN_GLOBAL_HARMONIZATION,
CEDS_PROCESSING_ID,
DATA_ROOT,
HISTORY_SCENARIO_NAME,
)
from emissions_harmonization_historical.units import assert_units_match_wishes

Expand Down Expand Up @@ -157,6 +158,10 @@
# add global
ceds = add_global(ceds)

# %%
# Rename NMVOC
ceds = ceds.rename(index=lambda v: v.replace("NMVOC", "VOC"))

# %%
ceds_reformatted = ceds.rename_axis(index={"em": "variable", "country": "region"})
ceds_reformatted
Expand All @@ -165,7 +170,7 @@
# rename to IAMC-style variable names including standard index order
ceds_reformatted_iamc = (
ceds_reformatted.pix.format(variable="Emissions|{variable}|{sector}", drop=True)
.pix.assign(model="History", scenario=f"CEDSv{ceds_release}")
.pix.assign(scenario=HISTORY_SCENARIO_NAME, model=f"CEDSv{ceds_release}")
.reorder_levels(["model", "scenario", "region", "variable", "unit"])
).sort_values(by=["region", "variable"])
ceds_reformatted_iamc
Expand Down
Loading