{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# EDGAR Inventory Processing\n", "\n", "This tutorial demonstrates how to process EDGAR inventory data.\n", "\n", "We will perform the following steps:\n", "\n", "* Load the data\n", "* Create a grid for the output\n", "* Remap the inventory to the grid\n", "* Process the data\n", "* Save the output\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## EDGAR Files\n", "\n", "In this section, we will examine the EDGAR NetCDF files.\n", "\n", "These files can be downloaded directly from the [EDGAR website](https://edgar.jrc.ec.europa.eu/emissions_data_and_maps). However, the most convenient method is to use the `download_edgar_files` function provided by emiproc, as demonstrated below.\n" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from pathlib import Path\n", "from emiproc.inventories.edgar import download_edgar_files\n", "\n", "year = 2022\n", "\n", "local_dir = Path(\"./edgar\") / str(year)\n", "local_dir.mkdir(exist_ok=True, parents=True)" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Downloaded 53 files.\n" ] } ], "source": [ "\n", "download_edgar_files(local_dir, year=year, substances=[\"CH4\", \"CO2\", \"CO2bio\"])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's examine one of the downloaded files.\n" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
<xarray.Dataset> Size: 26MB\n",
"Dimensions: (lat: 1800, lon: 3600)\n",
"Coordinates:\n",
" * lat (lat) float64 14kB -89.95 -89.85 -89.75 ... 89.75 89.85 89.95\n",
" * lon (lon) float64 29kB -179.9 -179.8 -179.8 ... 179.8 179.8 179.9\n",
"Data variables:\n",
" emissions (lat, lon) float32 26MB ...\n",
"Attributes:\n",
" institution: European Commission, Joint Research Centre\n",
" source: https://edgar.jrc.ec.europa.eu/dataset_ghg2024\n",
" how_to_cite: https://edgar.jrc.ec.europa.eu/dataset_ghg2024#howtocite\n",
" copyright_notice: https://edgar.jrc.ec.europa.eu/dataset_ghg2024#conditions\n",
" contacts: https://edgar.jrc.ec.europa.eu/dataset_ghg2024#info JR...| \n", " | CH4 | \n", "CO2 | \n", "CO2bio | \n", "
|---|---|---|---|
| Agricultural soils | \n", "3.678327e+10 | \n", "1.430920e+11 | \n", "NaN | \n", "
| Agricultural waste burning | \n", "2.359133e+09 | \n", "NaN | \n", "1.323736e+12 | \n", "
| Chemical processes | \n", "3.591839e+08 | \n", "7.536434e+11 | \n", "NaN | \n", "
| Power Industry | \n", "5.637066e+08 | \n", "1.469337e+13 | \n", "8.824078e+11 | \n", "
| Enteric fermentation | \n", "1.127170e+11 | \n", "NaN | \n", "NaN | \n", "
| Combustion for manufacturing | \n", "6.869048e+08 | \n", "6.223605e+12 | \n", "1.980250e+12 | \n", "
| Iron and steel production | \n", "1.648024e+08 | \n", "2.898203e+11 | \n", "2.250683e+08 | \n", "
| Manure management | \n", "1.237949e+10 | \n", "NaN | \n", "NaN | \n", "
| Fuel exploitation | \n", "9.676207e+10 | \n", "3.818153e+11 | \n", "2.763252e+11 | \n", "
| Energy for buildings | \n", "9.904553e+09 | \n", "3.385634e+12 | \n", "2.975195e+12 | \n", "
| Oil refineries and Transformation industry | \n", "6.970340e+09 | \n", "2.220603e+12 | \n", "4.190084e+11 | \n", "
| Solid waste incineration | \n", "1.634158e+09 | \n", "1.786001e+10 | \n", "7.102761e+09 | \n", "
| Solid waste landfills | \n", "3.855265e+10 | \n", "NaN | \n", "NaN | \n", "
| Aviation climbing_and_descent | \n", "1.967106e+06 | \n", "2.808891e+11 | \n", "1.820282e+06 | \n", "
| Aviation cruise | \n", "2.653998e+06 | \n", "3.789719e+11 | \n", "2.455900e+06 | \n", "
| Aviation landing_and_takeoff | \n", "6.291362e+05 | \n", "8.983632e+10 | \n", "5.821781e+05 | \n", "
| Railways, pipelines, off-road transport | \n", "9.078780e+06 | \n", "2.732929e+11 | \n", "2.795448e+09 | \n", "
| Shipping | \n", "8.084582e+07 | \n", "8.810432e+11 | \n", "1.611196e+09 | \n", "
| Road transportation | \n", "9.797972e+08 | \n", "6.039474e+12 | \n", "2.933062e+11 | \n", "
| Waste water handling | \n", "2.412476e+10 | \n", "NaN | \n", "NaN | \n", "
| __total__ | \n", "3.450370e+11 | \n", "3.824663e+13 | \n", "8.161967e+12 | \n", "
| Non energy use of fuels | \n", "NaN | \n", "2.767136e+10 | \n", "NaN | \n", "
| Non-ferrous metals production | \n", "NaN | \n", "1.228438e+11 | \n", "NaN | \n", "
| Non-metallic minerals production | \n", "NaN | \n", "1.980856e+12 | \n", "NaN | \n", "
| Solvents and products use | \n", "NaN | \n", "6.231152e+10 | \n", "NaN | \n", "
| \n", " | CO2bio | \n", "CH4 | \n", "CO2 | \n", "
|---|---|---|---|
| agriculture | \n", "1.436499e+10 | \n", "2.274178e+08 | \n", "3.350383e+09 | \n", "
| industry | \n", "4.741786e+10 | \n", "1.683938e+09 | \n", "2.830813e+11 | \n", "
| transportation | \n", "5.580335e+08 | \n", "8.589536e+06 | \n", "1.137983e+11 | \n", "
| __total__ | \n", "6.234089e+10 | \n", "4.749143e+09 | \n", "4.002463e+11 | \n", "
| livestock | \n", "NaN | \n", "2.403860e+09 | \n", "NaN | \n", "
| waste | \n", "NaN | \n", "4.253374e+08 | \n", "1.629228e+07 | \n", "
| \n", " | CH4 | \n", "CO2 | \n", "
|---|---|---|
| agriculture | \n", "2.274178e+08 | \n", "1.771538e+10 | \n", "
| industry | \n", "1.683938e+09 | \n", "3.304992e+11 | \n", "
| livestock | \n", "2.403860e+09 | \n", "NaN | \n", "
| waste | \n", "4.253374e+08 | \n", "1.629228e+07 | \n", "
| transportation | \n", "8.589536e+06 | \n", "1.143563e+11 | \n", "
| __total__ | \n", "4.749143e+09 | \n", "4.625872e+11 | \n", "
<xarray.Dataset> Size: 3MB\n",
"Dimensions: (lat: 160, lon: 200, substance: 2, category: 5,\n",
" lon_bnds: 201, lat_bnds: 161)\n",
"Coordinates:\n",
" * substance (substance) <U3 24B 'CH4' 'CO2'\n",
" * category (category) <U14 280B 'transportation' ... 'livestock'\n",
" * lon (lon) float64 2kB 110.1 110.4 110.6 ... 159.6 159.9\n",
" * lat (lat) float64 1kB -44.89 -44.67 ... -10.33 -10.11\n",
" * lon_bnds (lon_bnds) float64 2kB 110.0 110.2 ... 159.8 160.0\n",
" * lat_bnds (lat_bnds) float64 1kB -45.0 -44.78 ... -10.22 -10.0\n",
"Data variables: (12/14)\n",
" CH4_transportation (lat, lon) float64 256kB 0.3098 0.08621 ... 10.21 18.04\n",
" CH4_industry (lat, lon) float64 256kB 5.083 2.611 ... 11.31 4.261\n",
" CH4_waste (lat, lon) float64 256kB 0.0 0.0 0.0 ... 0.0 0.0 0.0\n",
" CH4_agriculture (lat, lon) float64 256kB 0.0 0.0 0.0 ... 0.0 0.0 0.0\n",
" CH4_livestock (lat, lon) float64 256kB 0.0 0.0 0.0 ... 0.0 0.0 0.0\n",
" CO2_transportation (lat, lon) float64 256kB 3.4e+03 946.1 ... 2.113e+06\n",
" ... ...\n",
" CO2_agriculture (lat, lon) float64 256kB 0.0 0.0 0.0 ... 0.0 0.0 0.0\n",
" emi_CH4_all_sectors (lat, lon) float64 256kB 5.393 2.697 ... 21.51 22.3\n",
" emi_CH4_total (category) float64 40B 8.59e+06 1.684e+09 ... 2.404e+09\n",
" emi_CO2_all_sectors (lat, lon) float64 256kB 3.4e+03 946.1 ... 2.113e+06\n",
" emi_CO2_total (category) float64 40B 1.144e+11 3.305e+11 ... 0.0\n",
" cell_area (lat, lon) float64 256kB 4.801e+08 ... 6.63e+08\n",
"Attributes:\n",
" Conventions: CF-1.10\n",
" title: emiproc generated file\n",
" comment: \n",
" source: \n",
" history: 2025-04-30 15:13:02: created by emiproc ;\\n\n",
" references: Produced by emiproc.\n",
" institution: Empa, Swiss Federal Laboratories for Materials Science ...\n",
" author: emiproc\n",
" contact: https://emiproc.readthedocs.io/en/master/support.html#c...\n",
" creation_time: 2025-04-30 15:13:02\n",
" emiproc_history: ["Inventory(EDGARv8) created as type:'EDGARv8'", 'Copie...\n",
" year: not specified in inventory.year