Skip to content

[Bug] fix: Fix implicit string concatenation bug in PARAM_RULES['EmissionActivityRatio'] #96

@GaneshPatil7517

Description

@GaneshPatil7517

Summary

In Config.py (approximately line 193), the EmissionActivityRatio entry in PARAM_RULES has a missing comma between two string literals:

'EmissionActivityRatio': ['r', 'e''t', 'y', 'm']

In Python, adjacent string literals are automatically concatenated. So 'e''t' silently becomes 'et' — a single string. The actual list evaluates to ['r', 'et', 'y', 'm'] (4 elements) instead of the intended ['r', 'e', 't', 'y', 'm'] (5 elements).

This means the EmissionActivityRatio parameter is being parsed with the wrong dimension mapping — the 'e' (emission) and 't' (technology) dimensions are merged into one 'et' dimension. This could cause data to be loaded incorrectly, columns to be mislabeled, or silent data corruption in model runs.

Expected behavior

# Correct — 5 separate dimension codes
'EmissionActivityRatio': ['r', 'e', 't', 'y', 'm']

Additionally, all other entries in PARAM_RULES should be audited for the same type of bug (missing commas between adjacent strings).

Reproduction steps

  • Clone the repo: git clone https://github.com/EAPD-DRB/MUIOGO.git
  • Open Config.py
  • Search for EmissionActivityRatio (approximately line 193)
  • Observe: 'EmissionActivityRatio': ['r', 'e''t', 'y', 'm']
  • Verify the bug in a Python shell:
>>> 'e''t'
'et'
>>> ['r', 'e''t', 'y', 'm']
['r', 'et', 'y', 'm']
>>> len(['r', 'e''t', 'y', 'm'])
4  # should be 5
  1. Compare with similar parameters that have 5 dimensions (e.g., InputActivityRatio, OutputActivityRatio) to confirm this should also have 5

Environment

  1. OS: Windows 11 / Ubuntu 22.04 / macOS (all affected — this is a Python logic bug)
  2. Python: 3.10+
  3. Branch: main
  4. File: Config.py

Logs or screenshots

# Current code (BUGGY) — 'e''t' concatenates to 'et'
'EmissionActivityRatio': ['r', 'e''t', 'y', 'm']
# Evaluates to: ['r', 'et', 'y', 'm'] — WRONG (4 elements)

# Fixed code — comma separates 'e' and 't'
'EmissionActivityRatio': ['r', 'e', 't', 'y', 'm']
# Evaluates to: ['r', 'e', 't', 'y', 'm'] — CORRECT (5 elements)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions