Skip to content

[EEE] Migrate farmgrown feed emissions fix from PR 3202 to dev - #3288

Open
matthew7838 wants to merge 17 commits into
devfrom
fgf-from-test
Open

matthew7838 wants to merge 17 commits into
devfrom
fgf-from-test

Conversation

@matthew7838

@matthew7838 matthew7838 commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

Migrates the farmgrown feed emissions fix from PR #3202 (test, v1.0.4) to dev.

Context

Issue(s) closed by this pull request: closes #3265. Supersedes draft PR #3230.

What

  • _calculate_daily_farmgrown_feed_emissions_and_resources() processes harvests chronologically across all fields with a separate accumulation window per field, keeps a window open across kill_only harvests, and takes a feed's next harvest date from any field, so a feed grown in several fields is allocated correctly.
  • Field emissions, harvest yields, and fertilizer and manure applications are handled in kg instead of kg/ha, using the field size collected from the harvest records.
  • Removes the storage-inventory reset from PR [Emissions] FGF Emissions Reset #2720, which test never had, together with _gather_farmgrown_feed_inventory_data(), its filter, and its tests.

Why

Aligns dev with the test patch tracked in #3231.

How

Same logic as #3202, written on top of the helpers introduced in #3237. The allocation function returns the same results as the test implementation on the unit-test fixtures and on 300 randomized multi-field harvest schedules.

Test plan

  • Existing EEE fixtures converted to kg.
  • Full test suite passes.
  • Freestall example: outputs match an independent re-computation from the raw field, harvest, and feeding outputs.

Input Changes

  • N/A

Output Changes

  • EmissionsEstimator._report_daily_farmgrown_feed_fed_emissions_and_resources.*: values change where a feed is grown in more than one field, where a cover crop is killed without a harvest, or where the [Emissions] FGF Emissions Reset #2720 reset previously fired.

Filter

{
    "name": "farmgrown_feed_emissions",
    "filters": ["EmissionsEstimator._report_daily_farmgrown_feed_fed_emissions_and_resources.*"]
}

matthew7838 and others added 7 commits September 16, 2026 15:47
Processes harvests chronologically across all fields with per-field
accumulation windows and kg units, matching the test branch, and removes
the PR 2720 feed inventory reset that test never had.
@github-actions

Copy link
Copy Markdown
Contributor

Current Coverage: 99%

Mypy errors on fgf-from-test branch: 1164
Mypy errors on dev branch: 1164
No difference in error counts

@github-actions

Copy link
Copy Markdown
Contributor

Current Coverage: 99%

Mypy errors on fgf-from-test branch: 1164
Mypy errors on dev branch: 1164
No difference in error counts

@matthew7838 matthew7838 self-assigned this Sep 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Current Coverage: 99%

Mypy errors on fgf-from-test branch: 1164
Mypy errors on dev branch: 1164
No difference in error counts

@github-actions

Copy link
Copy Markdown
Contributor

Current Coverage: 99%

Mypy errors on fgf-from-test branch: 1164
Mypy errors on dev branch: 1164
No difference in error counts

@github-actions

Copy link
Copy Markdown
Contributor

Current Coverage: 99%

Mypy errors on fgf-from-test branch: 1164
Mypy errors on dev branch: 1164
No difference in error counts

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.

[dev] Migrate changes in #3202 to the dev branch

1 participant