Skip to content

Fix remaining calculation and reproducibility issues in reportIndicators #146

Description

@SongminYu

Background

PR #143 introduced the expanded reportIndicators() function, and PR #144 corrected an important transport bug where passenger final energy was divided by freight activity.

The passenger activity reference is now correct:

v01ActivPassTrnsp <- variablesACTVTransport$V01ActivPassTrnsp

However, several calculation and reproducibility issues remain.

Issues

1. Passenger transport intensities use incompatible activity units

The five passenger modes are all reported with the unit Mtoe/ACTV, although their activity variables have different meanings and units:

  • Cars (PC): km/vehicle
  • Buses (PB): billion passenger-km/year
  • Rail (PT): Gpkm
  • Inland navigation (PN): billion passenger-km/year
  • Aviation (PA): million passengers carried

Consequently, these indicators are not directly comparable. In particular, energy divided by car mileage or passenger count is not equivalent to energy per passenger-kilometre.

The denominators and units should be defined separately for each mode. If comparable passenger transport intensities are required, the indicators should use a consistent passenger-kilometre activity measure.

2. Undefined ratios are converted to zero

The function currently ends with:

magpie_object[is.na(magpie_object) | is.infinite(magpie_object)] <- 0

This converts ratios with zero or missing denominators into apparently valid zero intensities.

A replay using a complete 2 degrees C run found many region-year observations with zero transport activity, including:

  • Cars: 205
  • Buses: 205
  • Passenger rail: 377
  • Aviation: 408
  • Trucks: 291
  • Freight rail: 377
  • Freight inland navigation: 1,065

These observations should remain NA unless zero is substantively meaningful. A genuine 0 / positive activity result will already remain zero without this replacement.

3. Activity data are recalculated from the current mrprom environment

Non-transport activity denominators are obtained through:

calcOutput(
  "IFullACTV",
  aggregate = TRUE,
  regionmapping = "regionmappingOPDEV5.csv"
)

This makes reporting dependent on the currently installed mrprom version, its cache, and a hard-coded regional mapping. Reprocessing the same historical GDX after an input-data update may therefore produce different indicators.

Activity data should preferably be read from the run GDX or another input snapshot stored with that run.

4. The total energy supply intensity definition needs clarification

The function produces both:

Primary Energy / GDP

and:

(Primary Energy + imports - exports - bunkers) / GDP

However, reportPE() constructs Primary Energy from gross inland consumption rather than directly from domestic primary production. Adding net imports may therefore count trade twice.

The intended definition of total energy supply should be clarified, and only one consistently defined indicator should be retained.

5. reportIndicators() cannot run independently

The function calls tribble() without importing it or using a namespace qualifier. Calling the exported function without first attaching dplyr fails with:

could not find function "tribble"

Use tibble::tribble() or add the appropriate import. The documentation should also describe all required arguments, and basic tests should cover the indicator calculations and zero-denominator behaviour.

Expected outcome

  • Define valid denominators and units for each passenger transport mode.
  • Preserve NA for undefined ratios.
  • Use activity data stored with the run.
  • Adopt one unambiguous total-energy-supply intensity definition.
  • Make reportIndicators() work as a standalone exported package function.
  • Add tests for transport mappings, units, regional aggregation, and zero denominators.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions