Skip to content

Add optional CH4 effects#19

Open
irm-codebase wants to merge 2 commits into
brightway-lca:mainfrom
irm-codebase:feature-ch4-effects
Open

Add optional CH4 effects#19
irm-codebase wants to merge 2 commits into
brightway-lca:mainfrom
irm-codebase:feature-ch4-effects

Conversation

@irm-codebase
Copy link
Copy Markdown

@irm-codebase irm-codebase commented Mar 13, 2026

Fixes #18 and #5

This is my attempt to add more flexibility in how CH4 is treated.
Namely:

  • Options on how to treat indirect and direct CH4 effects
    • "none": only direct
    • "all": everything (CO2 decay, indirect). Default, matches Watanabe's paper.
    • "no_carbon_cycle": useful for biogenic processes.

Other extra goodies:

  • Safer imports (only for source code files I touched).
  • Stronger tests.
  • Small helper for 'fixed' RE (to reduce redundant code)

For disclosure:

  • I am not an expert in atmospheric chemistry! I just did my best to adapt the code in Watanabe's SI.
  • The code in the SI was a bit obtuse in some parts, so I did rely on an AI agent to help me parse / debug the code for some functions (namely while writing _agwp_ch4_cumulative). I've triple checked things, so it should be clean. However, the SI Code n.4 section full of 'magic values'. I'm trusting Watanabe's implementation, but it'd be ideal if these were converted to global constants with more useful names.
  • NO2 code was left untouched (i.e., no indirect effect support). I tried to ensure the naming and approach would support this in the long run, if it is ever included.

@irm-codebase
Copy link
Copy Markdown
Author

Some results for 2050, based on this figure from the paper:

image

Cum RF for SSP2 2.6 - MESSAGE (upper bound of GWP100 increase in Watanabe's results).

image

Cumulative RF for SSP4 8.5 - GCAM4 (almost the same as IPCC AR6)

image

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds configurability for methane (CH4) prospective characterization by introducing selectable indirect-effects treatments, and updates validation tests to compare against Watanabe SI reference tables more directly.

Changes:

  • Introduce indirect_effects modes for CH4 AGWP (e.g., "none", "no_carbon_cycle", "all") and thread the option through prospective CH4 RF + top-level characterize(...) for relevant metrics.
  • Refactor prospective characterize_ch4 to reuse a centralized cumulative AGWP helper (_agwp_ch4_cumulative).
  • Strengthen/expand pGWP100 tests for CH4 across years and scenarios, and add a monotonicity check across modes.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
dynamic_characterization/prospective/agwp.py Adds CH4 indirect-effects modes and a shared cumulative AGWP implementation used by CH4.
dynamic_characterization/prospective/radiative_forcing.py Exposes indirect_effects in prospective CH4 forcing and delegates to AGWP helper.
dynamic_characterization/dynamic_characterization.py Adds indirect_effects parameter to the public API and forwards it where supported.
tests/test_prospective.py Updates CH4 pGWP100 tests to match SI tables across scenarios/years; adds monotonicity test for CH4 modes.
Comments suppressed due to low confidence (1)

dynamic_characterization/prospective/radiative_forcing.py:25

  • load_irf_ch4 and load_re_ch4 are imported but no longer used after switching characterize_ch4 to _agwp_ch4_cumulative. With flake8 enabled, this will raise an unused-import error; remove these imports (and any other now-unused CH4-specific constants/imports in this module).
from dynamic_characterization.prospective.agwp import _agwp_ch4_cumulative
from dynamic_characterization.prospective.config import get_scenario
from dynamic_characterization.prospective.data_loader import (
    load_irf_ch4,
    load_irf_co2,
    load_irf_n2o,
    load_re_ch4,
    load_re_co2,
    load_re_n2o,
)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +91 to 96
indirect_effects : str
Indirect effect treatment. One of:
- all: all indirect effects. Matches Watanabe et al. Default.
- no_carbon_cyle: all indirect effects except carbon cycle feedbacks.
- none: only direct effects of the gasae.

Comment thread tests/test_prospective.py
CH4_INDIRECT_EFFECTS_FACTOR = 1.43

# Our AGWP implementation of CH4 can calculate both DIRECT and INDIRECT radiative forcing.
# Our AGWP implementation of NO2 calculates DIRECT radiative forcing only.
indirect_effects : str
Treatment of indirect CH4 effects. One of:
- all: all indirect effects. Matches Watanabe et al. (2026). Default.
- no_carbon_cyle: all indirect effects except carbon cycle feedbacks.
Comment on lines +161 to +163
c1[t] = temp_s[t] * 11.06 * 0.6368 + c1_prev * np.exp(-1 / 2.376)
c2[t] = temp_s[t] * 11.06 * 0.3322 + c1_prev * np.exp(-1 / 30.14)
c3[t] = temp_s[t] * 11.06 * 0.031 + c1_prev * np.exp(-1 / 490.1)
step: int,
time_varying_re: bool,
) -> float:
"""Configuration-aware radiate efficiency getter."""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prospective functions contradict Watanabe et al results?

3 participants