National scale Methane emissions calculation with Sentinel-5P

Products used: s5p_tropomi_l2_ch4 s5p_tropomi_l2_cloud ERA5

Keywords data used; sentinel-5P,:index:datasets; sentinel-5P

Background

Sentinel-5 Precursor Level 2 Methane - Copernicus is a European Earth observation satellite launched in 2017 under the Copernicus Programme to monitor atmospheric composition and air quality. It carries the TROPOspheric Monitoring Instrument (TROPOMI), a hyperspectral sensor that measures trace gases such as methane (CH₄), nitrogen dioxide (NO₂), ozone (O₃), sulfur dioxide (SO₂), and carbon monoxide (CO). Methane retrievals are primarily derived from shortwave infrared (SWIR) spectral absorption measurements, enabling global observations of atmospheric methane concentrations with daily revisit capability.

Methane is the second most important anthropogenic greenhouse gas after carbon dioxide and has a significantly higher warming potential over short time scales. Sentinel-5P methane products provide column-averaged dry-air mole fractions of methane (XCH₄), allowing researchers to monitor methane sources, sinks, and atmospheric transport processes at regional to global scales. The high spatial and temporal resolution of TROPOMI enables the identification of methane hotspots associated with oil and gas production, coal mining, landfills, wetlands, agriculture, and biomass burning.

The Sentinel-5P methane dataset has become an important resource for climate science, greenhouse gas inventories, and environmental policy assessment. Its near-daily global coverage supports the detection of large methane leaks and “super-emitters,” improving the understanding of emission dynamics and supporting mitigation strategies. The dataset is also widely integrated with higher-resolution satellite observations, atmospheric models, and ground-based measurements to enhance emission quantification and validation. This capability has significantly advanced operational methane monitoring for climate change research and international climate reporting frameworks e.g. Sentinel-5P data used in new methane detection system.

Sentinel-5P TROPOMI Level-2 Methane

Methane (CH₄) Column-Averaged Mixing Ratio measures the vertically integrated concentration of methane in the atmosphere and is used to identify major greenhouse gas emission sources and support climate change research. ***

Description

This notebook will cover following topics:

  1. Loading the Sentinel-5P Methane Layer

  2. Converting methane concentration units with ERA5 surface pressure

  3. Plotting the results


Getting started

To run this analysis, run all the cells in the notebook, starting with the “Load packages” cell.

Load packages

Import Python packages that are used for the analysis.

[1]:
%matplotlib inline

import numpy as np
import xarray as xr
import pandas as pd
import datacube
import geopandas as gpd
import matplotlib.pyplot as plt
from odc.geo.geom import Geometry
from scipy.stats import gaussian_kde
from IPython.display import Markdown, display

from deafrica_tools.spatial import xr_rasterize
from deafrica_tools.plotting import display_map
from deafrica_tools.areaofinterest import define_area
from deafrica_tools.load_era5 import load_era5
from deafrica_tools.methane_convention import rename_latlon, convert_ch4, gridcell_area_m2

Connect to the datacube

Connect to the datacube so we can access DE Africa data.

[2]:
dc = datacube.Datacube(app="Sentinel_5P_methane")

List measurements

Run the cell below to inspect he measurments of s5p_tropomi_l2_ch4, using the datacube’s list_measurements functionality.

[3]:
product = "s5p_tropomi_l2_ch4"
measurements = dc.list_measurements()
display(Markdown("**The table below lists the measurements available for the data**"))
measurements.loc[product]

The table below lists the measurements available for the data

[3]:
name dtype units nodata aliases flags_definition add_offset scale_factor
measurement
CH4 CH4 float32 ppb -9999.0 NaN NaN 0.0 1.0
dataMask dataMask uint8 1 255.0 NaN NaN 0.0 1.0

Analysis parameters

The following cell sets the parameters, which define the area of interest to conduct the analysis over. #### Select location To define the area of interest, there are two methods available:

  1. By specifying the latitude, longitude, and buffer, or separate latitude and longitude buffers, this method allows you to define an area of interest around a central point. You can input the central latitude, central longitude, and a buffer value in degrees to create a square area around the center point. For example, lat = 10.338, lon = -1.055, and buffer = 0.1 will select an area with a radius of 0.1 square degrees around the point with coordinates (10.338, -1.055).

    Alternatively, you can provide separate buffer values for latitude and longitude for a rectangular area. For example, lat = 10.338, lon = -1.055, and lat_buffer = 0.1 andlon_buffer = 0.08 will select a rectangular area extending 0.1 degrees north and south, and 0.08 degrees east and west from the point (10.338, -1.055).

    For reasonable loading times, set the buffer as 0.1 or lower.

  2. By uploading a polygon as a GeoJSON or Esri Shapefile. If you choose this option, you will need to upload the geojson or ESRI shapefile into the Sandbox using Upload Files button 70362659a02b4fbeb3c54f5575c75f8b in the top left corner of the Jupyter Notebook interface. ESRI shapefiles must be uploaded with all the related files (.cpg, .dbf, .shp, .shx). Once uploaded, you can use the shapefile or geojson to define the area of interest. Remember to update the code to call the file you have uploaded.

To use one of these methods, you can uncomment the relevant line of code and comment out the other one. To comment out a line, add the "#" symbol before the code you want to comment out.

If running the notebook for the first time, keep the default settings below. This will demonstrate how the analysis works and provide meaningful results.

To run the notebook for a different area, make sure Sentinel-5 Precursor’s TROPOMI data is available for the chosen area using the DEAfrica Explorer.

[4]:
# Method 1: Specify the latitude, longitude, and buffer)
# aoi = define_area(lat=5.5, lon=6.5, buffer=1)

# Method 2: Use a polygon as a GeoJSON or Esri Shapefile.
# select the country of interest, default is Ghana
country = "Ghana"
african_countries = gpd.read_file('../Supplementary_data/Rainfall_anomaly_CHIRPS/african_countries.geojson')
idx = african_countries[african_countries['COUNTRY'] == country].index[0]

#Create a geopolygon and geodataframe of the area of interest
geopolygon = Geometry(geom=african_countries.iloc[idx].geometry, crs=african_countries.crs)
geopolygon_gdf = gpd.GeoDataFrame(geometry=[geopolygon], crs=geopolygon.crs)

# Get the latitude and longitude range of the geopolygon
lat_range = (geopolygon_gdf.total_bounds[1], geopolygon_gdf.total_bounds[3])
lon_range = (geopolygon_gdf.total_bounds[0], geopolygon_gdf.total_bounds[2])
[5]:
display_map(x=lon_range, y=lat_range)
[5]:
Make this Notebook Trusted to load map: File -> Trust Notebook

Accessing Sentinel 5P data through DE Africa

Now that we know what products and measurements are available for the product, we can load data from the datacube using dc.load. We will load data from spectral satellite bands. By specifying output_crs='EPSG:4326' and resolution=(-0.01, 0.01), we are loading data in its native projection and resolution. Finally, group_by='solar_day' ensures that overlapping images taken within seconds of each other as the satellite passes over are combined into a single time step in the data. The query defined below will be used for all the other products.

[6]:
time_start = "2025-01-01"
time_end = "2025-01-31"
query = {
    'x': (lon_range),
    'y': (lat_range),
    'time':(time_start, time_end),
    'output_crs': 'EPSG:4326',
    'resolution': (-0.01, 0.01)}
[7]:
query
[7]:
{'x': (np.float64(-3.255420000001322), np.float64(1.191779999999198)),
 'y': (np.float64(4.736720000000787), np.float64(11.173299999994924)),
 'time': ('2025-01-01', '2025-01-31'),
 'output_crs': 'EPSG:4326',
 'resolution': (-0.01, 0.01)}

Sentinel-5P TROPOMI Level-2 Methane (CH₄) Column-Averaged Mixing Ratio

Sentinel-5P TROPOMI Level-2 Methane (CH₄) Column-Averaged Mixing Ratio is a satellite product from Sentinel-5 Precursor’s TROPOMI that measures the vertically integrated amount of methane in the atmosphere by analyzing reflected shortwave-infrared sunlight. It is used to detect and map methane emission hotspots, quantify regional sources from oil and gas operations, agriculture and wetlands, monitor trends in a major greenhouse gas, and support climate policy and mitigation efforts.

[8]:
ds_l2_ch4 = dc.load(product='s5p_tropomi_l2_ch4',
                    group_by="solar_day",
                    **query)

ds_l2_ch4
[8]:
<xarray.Dataset> Size: 45MB
Dimensions:      (time: 31, latitude: 645, longitude: 446)
Coordinates:
  * time         (time) datetime64[ns] 248B 2025-01-01T05:53:15 ... 2025-01-3...
  * latitude     (latitude) float64 5kB 11.17 11.16 11.15 ... 4.755 4.745 4.735
  * longitude    (longitude) float64 4kB -3.255 -3.245 -3.235 ... 1.185 1.195
    spatial_ref  int32 4B 4326
Data variables:
    CH4          (time, latitude, longitude) float32 36MB nan nan ... nan nan
    dataMask     (time, latitude, longitude) uint8 9MB 0 0 0 0 0 0 ... 0 0 0 0 0
Attributes:
    crs:           EPSG:4326
    grid_mapping:  spatial_ref

Masking#

Before visualisation, we use the dataMask band to mask values affected by cloud or other issues. The code below keeps data for pixels where the data mask value is 1.

[9]:
ds_l2_ch4 = ds_l2_ch4.where(ds_l2_ch4.dataMask == 1)

Convert Daily Methane Data to Monthly Statistics

Statistic

When to use

Meaning

mean

Best for general monthly average methane concentration

Average CH₄ value for the month

median

Best when there are outliers or extreme plume values

Typical CH₄ condition for the month

maximum

Best for hotspot or plume detection

Highest CH₄ value observed in the month

count

Good for quality checking

Number of valid observations in the month

For this example,the maximum value max for the monthly aggregation will be used. However, depending on the purpose of the analysis, users can also use other statistics such as mean, median, or count.

[10]:
ds_l2_ch4 = ds_l2_ch4.resample(time="1MS").max(skipna=True)
[11]:
#Mask the rainfall dataset using the country boundary
mask = xr_rasterize(geopolygon_gdf, ds_l2_ch4)

#mask  dataset
ds_l2_ch4 = ds_l2_ch4.where(mask)

Visualising the band

The Sentinel-5P product expresses methane concentration in parts per billion (ppb).

[12]:
ds_l2_ch4['CH4'].plot(robust=True, col="time", size=6, cmap='RdYlGn_r')
[12]:
<xarray.plot.facetgrid.FacetGrid at 0x7fc78c568d10>
../../../_images/sandbox_notebooks_Real_world_examples_National_scale_methane_emissions_calculation_with_Sentinel5P_39_1.png

Load ERA5 Climate Gridded Data

ERA5 surface pressure is required in Sentinel-5P methane analysis because methane retrievals are provided as column-averaged dry-air mole fractions (XCH₄) in parts per billion (ppb). Surface pressure data enables the conversion of methane concentrations from ppb into physical quantities such as molar concentration, mass density, and total methane mass in tonnes using atmospheric relationships such as the ideal gas law, while also improving consistency and reducing uncertainties associated with elevation and meteorological variability.

The cell below loads the surface pressure variable for the study area.

[13]:
# Loading surface pressure from ERA 1
surface_pressure = load_era5('surface_pressure', lat_range, lon_range, query['time'], chunks=None, resample='1ME')
surface_pressure = surface_pressure.rename({"lat":"latitude","lon":"longitude"})
mask= xr_rasterize(geopolygon_gdf, surface_pressure)
surface_pressure = surface_pressure.where(mask)
Opening ERA5 Zarr dataset...
Variable: surface_pressure
Mapped ERA5 name: surface_pressure
Time: 2025-01-01 to 2025-01-31
Latitude: 4.736720000000787 to 11.173299999994924
Longitude: -3.2554200000013225 to 1.1917799999991985
Selecting time range...
Normalising longitude coordinates...
Selecting AOI...
Subset size: {'time': 744, 'latitude': 27, 'longitude': 19}
Resampling to 1ME using mean...
ERA5 loading complete.

Converting Sentinel-5P Methane from ppb to Atmospheric Methane Mass

Sentinel-5P methane products provide XCH₄ as vertical column-averaged dry-air mole fractions in parts per billion (ppb), representing the average methane concentration within the atmospheric column above each satellite pixel. To support mass and emission analysis, these ppb values can be converted into methane mass per unit area and total methane mass by combining the methane concentration with surface pressure, atmospheric constants, and pixel area.

Why Convert Methane from ppb to Mass-Based Units?

  • They support climate reporting and greenhouse gas inventories.

  • They are useful for comparing dates, regions, and events.

  • With wind speed and plume length, total tonnes can support emission-rate estimates.


Molecular Weights Used in the Conversion

The molecular weight determines how many grams one mole of a gas weighs:

Gas

Molecular Weight (g/mol)

CH₄ (Methane)

16.04

The value is provided to the conversion function so that any Sentinel-5P gas product can be processed consistently.


The function below performs the full conversion from Sentinel-5P TROPOMI Level-2 methane observations provided as XCH₄ in parts per billion (ppb) into mass-based methane products for your area of interest (AOI).

To run the calculation, you need to supply:

  1. The methane variable from your dataset

    • ch4_ppb should be in ppb and represents the column-averaged dry-air mole fraction of methane.

  2. Surface pressure data

    • surface_pressure should be in Pascals (Pa) and is used to estimate the dry-air column needed for the mass conversion.

  3. Pixel area

    • area_m2 should be in square metres and is used to convert methane mass per unit area into tonnes per pixel.

This allows Sentinel-5P methane observations to be transformed into physically meaningful mass-based units for methane hotspot analysis, emission assessment, climate studies, and environmental reporting.

[14]:
# Make sure the dataset have the same lat and lon name
ds_l2_ch4 = rename_latlon(ds_l2_ch4)
surface_pressure = rename_latlon(surface_pressure)

ds_l2_ch4 = ds_l2_ch4['CH4']

The code below interpolates ERA5 surface pressure data to match the spatial coordinates (latitude and longitude) and observation times of the Sentinel-5P methane dataset using the nearest available values. This ensures that the surface pressure information is aligned with each methane observation for accurate atmospheric and methane mass calculations.

[15]:
sp_pressure = surface_pressure["surface_pressure"].interp(
    time=ds_l2_ch4.time,
    lat=ds_l2_ch4.lat,
    lon=ds_l2_ch4.lon,
    method="nearest",
    kwargs={"fill_value": "extrapolate"}
)

The code calculates the surface area of each Sentinel-5P methane grid cell in square metres based on the dataset’s latitude and longitude coordinates. These grid-cell areas are required for converting methane concentrations into total methane mass or emission estimates in physical units such as tonnes.

[16]:
area = gridcell_area_m2(ds_l2_ch4.lat, ds_l2_ch4.lon)

The convert_ch4 function in the cell below accepts three main inputs: methane xarray data, surface pressure, and pixel area. The function returns two xarray datasets: one with the conversion results and another with the map-based outputs for plotting.

[17]:
ch4_mass, ch4_map = convert_ch4(
    ch4_ppb=ds_l2_ch4,
    surface_pressure=sp_pressure,
    area_m2=area
)

Display Results in Table Format

The cell below displays the main methane conversion results in table format. This makes it easier to review and compare values such as total tonnes for each timestep.

[18]:
df_results = (
    ch4_mass[["total_tonnes", "total_kg"]]
    .to_dataframe()
    .reset_index()
    .rename(columns={"time": "timestep"})
    .drop(columns=["spatial_ref"], errors="ignore")
)

df_results["total_tonnes"] = df_results["total_tonnes"].round(2)
df_results["total_kg"] = df_results["total_kg"].round(2)

df_results
[18]:
timestep total_tonnes total_kg
0 2025-01-01 2293785.81 2.293786e+09

Definiton of the variables:

Variable

Unit

Meaning

total_tonnes

tonnes CH₄

Total methane mass over the study area for each timestep.

total_kg

kilograms CH₄

Same as total_tonnes, but expressed in kilograms. Since 1 tonne = 1,000 kg, total_kg = total_tonnes × 1000.

Visualising Methane

The graph below compares Sentinel-5P methane concentration in ppb, converted methane mass in g/m², and ERA5 surface pressure over the study area.

[19]:
fig, axes = plt.subplots(1, 3, figsize=(14, 6), sharey=True)

# CH4 ppb map
ds_l2_ch4.plot(ax=axes[0],robust=True, cmap="RdYlGn_r", cbar_kwargs={"label": "CH4 [ppb]"})
axes[0].set_title("Methane Concentration [ppb]")

# Tonnes per pixel map
ch4_map["ch4_g_m2"].where(ch4_map["ch4_g_m2"] > 0).plot(ax=axes[1], robust=True, cmap="RdYlGn_r", cbar_kwargs={"label": "CH4[g_m2]"})
axes[1].set_title("Methane Concentration [g_m2]")

# Surface Pressure
sp_pressure.plot(ax=axes[2], robust=True, cmap="RdYlGn_r")
axes[2].set_title("Surface Pressure [Pa]")

plt.tight_layout()
plt.show()
../../../_images/sandbox_notebooks_Real_world_examples_National_scale_methane_emissions_calculation_with_Sentinel5P_57_0.png

Conclusion

Through Digital Earth Africa, methane data from the Sentinel-5P TROPOMI instrument are transforming access to atmospheric greenhouse gas information across Africa by providing analysis-ready observations of atmospheric methane concentrations. DE Africa reduces technical barriers to satellite data access through open data services, cloud-based processing, and scalable analytical tools, enabling researchers, institutions, and governments to monitor methane emissions from sources such as oil and gas activities, wetlands, landfills, agriculture, and biomass burning without requiring advanced computational infrastructure. Converting methane concentrations from parts per billion (ppb) into physical quantities such as tonnes is important because it enables estimation of the actual methane mass released into the atmosphere, supports greenhouse gas inventories and emission reporting, and improves climate mitigation planning, environmental governance, and policy decision-making aligned with the United Nations Sustainable Development Goals and the African Union Agenda 2063.

References

The methane mass conversion and emission-estimation approach used in this notebook is based on the dry-air column relationship for methane column-averaged dry-air mole fraction (XCH₄), together with common practices for quantifying methane plume mass and emissions from remote sensing observations.

  1. Worden, J., Green, P., Eldering, A., & Sherwin, E. (2025). Common Practices for Quantifying Methane Emissions from Plumes Detected by Remote Sensing. NIST Interagency Report NIST IR 8575. National Institute of Standards and Technology. https://doi.org/10.6028/NIST.IR.8575

  2. Poursanidis, K., Sharanik, J., & Hadjistassou, C. (2024). World’s largest natural gas leak from Nord Stream pipeline estimated at 478,000 tonnes. iScience, 27(1), Article 108772. https://doi.org/10.1016/j.isci.2023.108772

  3. Apituley, A., Pedergnana, M., Sneep, M., Veefkind, J. P., Loyola, D., Hasekamp, O., Lorente Delgado, A., & Borsdorff, T. (2022). Sentinel-5 precursor/TROPOMI Level 2 Product User Manual: Methane. SRON-S5P-LEV2-MA-001, Issue 2.4.0. ESA/Copernicus. https://sentinels.copernicus.eu/documents/247904/2474726/Sentinel-5P-Level-2-Product-User-Manual-Methane.pdf

  4. Varon, D. J., Jacob, D. J., McKeever, J., Jervis, D., Durak, B. O. A., Xia, Y., & Huang, Y. (2018). Quantifying methane point sources from fine-scale satellite observations of atmospheric methane plumes. Atmospheric Measurement Techniques, 11, 5673–5686. https://doi.org/10.5194/amt-11-5673-2018


Additional information

License The code in this notebook is licensed under the Apache License, Version 2.0.

Digital Earth Africa data is licensed under the Creative Commons by Attribution 4.0 license.

Contact If you need assistance, please post a question on the DE Africa Slack channel or on the GIS Stack Exchange using the open-data-cube tag (you can view previously asked questions here).

If you would like to report an issue with this notebook, you can file one on Github.

Compatible datacube version

[20]:
print(datacube.__version__)
1.9.13

Last Tested:

[21]:
from datetime import datetime
datetime.today().strftime('%Y-%m-%d')
[21]:
'2026-09-30'