Skip to content

fix: align allocations across the two statistical algorithms - #46

Merged
jeffseif merged 5 commits into
jeffseif/bugfixes-for-statisticalfrom
jeffseif/align-logic-for-crops-pasture-split
Nov 20, 2026
Merged

jeffseif merged 5 commits into
jeffseif/bugfixes-for-statisticalfrom
jeffseif/align-logic-for-crops-pasture-split

Conversation

@jeffseif

@jeffseif jeffseif commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Background

This is another issue Claude spotted

This issue

Conceptually, we want statistical allocation to take place in two stages. First, land conversions are split into those whose destination is cropland and those whose destination is pastureland; second within each destination emissions are all allocated among crops or livestock. JURISDICTIONAL_DIRECT_PROXY was doing this correctly, but STATISTICAL was pooling crop and pasture expansions across cropland- and pastureland-destined emissions. The peatland conversion pulse was already split this way, with its own functions.

The fix is to take peatland conversion handling and apply it across all three emissions components (forest, grassland, and peatland conversion). This is one of those rare bugfixes which results in a net deletion of code, because logic that was conditional is now general. It moves ~80 Mt of forest and grassland emissions from crops to grazing worldwide, including ~100 Mt in Brazil.

The necessary bumps for statistical and trace workflows are applied within this PR and cover the parent branches in the stack.

I also took the opportunity to refresh the Matopiba figure in the readme.

Manual testing

Compared the Matopiba tiles (00N_050W, 10S_050W) against the v202611 snapshot and verified:

  1. per-component (i.e., forest, grassland, peatland conversion, dropped, unattributed) and per-province totals are unchanged for production, hectars, herds, peatland occupation, and DROPPED ... except for the one-cell-wide province which became nonzero due to the fix in the fix: two more edge cases in the expansion-share statistical allocation #44
  2. BEEF_CATTLE + PASTURE now match the proxy numbers
  3. Emissions shift from crops to livestock

@jeffseif
jeffseif requested a review from blallen November 19, 2026 20:56
@jeffseif
jeffseif added this pull request to stack #45 November 19, 2026 20:56
@jeffseif
jeffseif force-pushed the jeffseif/align-logic-for-crops-pasture-split branch from c4111fc to 5ff8f23 Compare November 19, 2026 21:58

@blallen blallen left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🐑 🌶️

@jeffseif
jeffseif merged commit 54e3bad into main Nov 20, 2026
2 checks passed
@jeffseif
jeffseif deleted the jeffseif/align-logic-for-crops-pasture-split branch November 20, 2026 19:02
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.

2 participants