Skip to content

FFC project future#106

Merged
jucordero merged 6 commits into
FixOurFood:ffc_modelfrom
jucordero:ffc_project_future
Jun 30, 2026
Merged

FFC project future#106
jucordero merged 6 commits into
FixOurFood:ffc_modelfrom
jucordero:ffc_project_future

Conversation

@jucordero

@jucordero jucordero commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Description

This PR introduces a model to project the food balance sheet according to population and yield changes.

The project_by_population function scales domestic use elements proportional to population changes.
It scales imports and production according to an elasticity parameter to keep the food balance sheet balanced.
Depending on the selected items and given instructions, it also scales seed, feed, and processing quantities.

The increase_production_yield function scales production of certain items according to a scaling function.
It also adjusts trade elements to keep the food balance sheet balanced.

Checklist

@jucordero jucordero changed the base branch from main to ffc_model June 11, 2026 17:39
@jucordero jucordero marked this pull request as draft June 11, 2026 17:39
@jucordero jucordero requested a review from Copilot June 29, 2026 15:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds forward-projection capabilities for Food Balance Sheet (FBS) datasets, introducing new intervention models for projecting domestic use via population changes and increasing production via yield scaling, while also extending the Year-coordinate utilities (including an optional pivot year) and strengthening test coverage for add_years.

Changes:

  • Added project_by_population and increase_production_yield pipeline nodes to agrifoodpy.food.model.
  • Extended add_years to support pivot_year, handle duplicate year inputs, and add a Year dimension when missing.
  • Updated/expanded tests around add_years, and cleaned minor docs/formatting.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
agrifoodpy/utils/tests/test_add_years.py Renames the test function to correctly reflect add_years coverage.
agrifoodpy/utils/nodes.py Extends the add_years node API to pass through pivot_year.
agrifoodpy/tests/test_base_class.py Expands unit tests for XarrayAccessorBase.add_years across multiple scenarios.
agrifoodpy/food/tests/test_model.py Minor whitespace cleanup.
agrifoodpy/food/model.py Introduces new FBS projection models driven by population and yield scaling.
agrifoodpy/food/food.py Updates scale_element docstring parameter naming.
agrifoodpy/array_accessor.py Extends add_years accessor with pivot_year and additional year-handling logic.
agrifoodpy/__init__.py Exposes key public classes (FoodBalanceSheet, LandDataArray, XarrayAccessorBase) at the package root.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread agrifoodpy/array_accessor.py Outdated
Comment thread agrifoodpy/utils/nodes.py Outdated
Comment thread agrifoodpy/utils/nodes.py
Comment thread agrifoodpy/food/model.py
Comment thread agrifoodpy/food/model.py
Comment thread agrifoodpy/food/model.py
Comment thread agrifoodpy/food/model.py
Comment thread agrifoodpy/food/model.py Outdated
Comment thread agrifoodpy/food/model.py
Comment thread agrifoodpy/array_accessor.py
@jucordero jucordero marked this pull request as ready for review June 30, 2026 15:26
@jucordero jucordero merged commit 0d86e19 into FixOurFood:ffc_model Jun 30, 2026
4 checks passed
@jucordero jucordero mentioned this pull request Jun 30, 2026
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