energy_methods.mix_rounding#

Reconcile rounded energy-consumption shares across nested reporting periods.

Shares are percentages of consumption, not of domestic generation. Reported-precision envelopes are not probabilistic confidence intervals.

class energy_methods.mix_rounding.MonthlyShareInterval(central_pct, minimum_pct, maximum_pct)[source]#

Bases: object

Incremental-month percentage and conservative rounding envelope.

Parameters:
  • central_pct (float)

  • minimum_pct (float)

  • maximum_pct (float)

central_pct: float#
minimum_pct: float#
maximum_pct: float#
contains_reported(reported_pct, *, rounding_pp=0.5)[source]#

Check compatibility with a separately rounded monthly percentage.

Parameters:
  • reported_pct (float)

  • rounding_pp (float)

Return type:

bool

energy_methods.mix_rounding.infer_incremental_month_share(*, preceding_demand_twh, new_month_demand_twh, preceding_share_pct, cumulative_share_pct, share_rounding_pp=0.5, preceding_demand_rounding_twh=0.0)[source]#

Infer monthly share from preceding and updated cumulative shares.

For preceding demand P, month demand M, preceding share p and cumulative share c, the incremental month’s percentage is c + (P/M) * (c-p). All corner combinations of reported rounding intervals are evaluated. Results are marginal bounds, not jointly attainable category balances.

Parameters:
  • preceding_demand_twh (float)

  • new_month_demand_twh (float)

  • preceding_share_pct (float)

  • cumulative_share_pct (float)

  • share_rounding_pp (float)

  • preceding_demand_rounding_twh (float)

Return type:

MonthlyShareInterval