Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 22 additions & 8 deletions SWEET_python/city_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -8345,14 +8345,28 @@ def _apply_open_close_window(
if oxidation_override["baseline"]:
ox_value_series_baseline.loc[:] = float(oxidation_override["baseline"])

# Check if flaring is defined as a variable
try:
flaring_series_baseline = pd.Series(flaring["baseline"], index=years)
flaring_series_scenario = flaring_series_baseline.copy()
flaring_series_scenario.loc[implement_year:] = flaring["scenario"]
except:
flaring_series_baseline = pd.Series(0.98, index=years)
flaring_series_scenario = flaring_series_baseline.copy()
# Flaring destruction efficiency of captured methane. The endpoint forwards a
# Variant, {"baseline": [...], "scenario": [...]}, with one value per landfill;
# sdst models a single landfill (index 0). This block previously referenced an
# undefined name `flaring`; the resulting NameError was swallowed by a bare
# `except`, so the user-supplied efficiency was silently ignored and flaring was
# always forced to the default. Read `new_landfill_flaring`, falling back to the
# canonical default only when no value is supplied.
from SWEET_python.dst_common import DEFAULT_FLARE_EFFICIENCY

flaring = {}
for scenario_key in ("baseline", "scenario"):
value = (
None
if new_landfill_flaring is None
else new_landfill_flaring[scenario_key][0]
)
flaring[scenario_key] = (
DEFAULT_FLARE_EFFICIENCY if value is None else value
)
flaring_series_baseline = pd.Series(flaring["baseline"], index=years)
flaring_series_scenario = flaring_series_baseline.copy()
flaring_series_scenario.loc[implement_year:] = flaring["scenario"]

if biocover["baseline"] > 0:
baseline_biocover = float(biocover["baseline"])
Expand Down
6 changes: 6 additions & 0 deletions changelog/2026-08.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# SWEET_python Changelog — August 2026

**Highlights:** A variable-name bug in `City.sdst_v1_5` was silently discarding the `/sdst` flaring efficiency and forcing flare destruction to the 0.98 default on every run. Sites that set a non-default flaring efficiency now model the value the user supplied. This is a model-output change for any sdst run with a non-0.98 flaring efficiency.

## Fixed
- `City.sdst_v1_5` now reads the caller-supplied flaring efficiency again. The flaring block referenced an undefined bare name `flaring` (the endpoint parameter is `new_landfill_flaring`); the resulting `NameError` was swallowed by a bare `except`, so flare destruction was always forced to the 0.98 default and the user's input was ignored. The block now reads `new_landfill_flaring[...][0]` per landfill (sdst models a single landfill, index 0), falling back to `DEFAULT_FLARE_EFFICIENCY` only when no value is supplied. **Model-output change:** any sdst run that set a non-0.98 flaring efficiency will now produce different (correct) results. ([#41](https://github.com/RMI/SWEET_python/pull/41))
1 change: 1 addition & 0 deletions changelog/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ The project does not publish semantic version tags, so releases are tracked by

Newest first:

- [2026-08](2026-08.md) — `/sdst` flaring efficiency reached the model again: fixed a variable-name bug in `City.sdst_v1_5` that silently forced flare destruction to 0.98 and ignored the user's input (model-output change)
- [2026-07](2026-07.md) — All ten waste types eligible for combustion (metal/glass/other added); methane-only model treats combustion as landfill diversion (model-output change)
- [2026-06](2026-06.md) — New single-site and city-level ADST modeling modules, min-cost max-flow rewrite of the city DST diversion allocator, physical-k fix for cold/dry sites, no more spurious negative food-waste mass
- [2026-05](2026-05.md) — SDST models from a landfill's actual open year (1950–2050), Central Asia/Afghanistan disposal-default fix, auto-Jira issue tooling, professional-comment cleanup
Expand Down