Skip to content

added land conversion methods#100

Open
jucordero wants to merge 3 commits intoFixOurFood:ffc_modelfrom
jucordero:ffc_convert_land
Open

added land conversion methods#100
jucordero wants to merge 3 commits intoFixOurFood:ffc_modelfrom
jucordero:ffc_convert_land

Conversation

@jucordero
Copy link
Copy Markdown
Collaborator

@jucordero jucordero commented Apr 30, 2026

Description

This PR introduces new model functions and LandDataArray accessor functions to facilitate models where land is converted between different categories.

  • scale_land is a basic multitool to scale and shift land quantities between existing a new categories. It optionally allows total land to be conserved by scaling selected target categories.
  • land_scaling_from_food performs land scaling based on the relative shifts between food quantities on selected Food Balance Sheet array elements and items. It uses scale_land.
  • LandDataArray.add_category is an accessor method which allows the addition of new categories to LandDataArray, optionally providing fill values in the form of scalars or spatial and/or temporal arrays.

It also standardises the terminology by referring to the different land uses as "categories", avoiding the use of "type" and "class" which can be confused with standard Python terminology. Several functions using old terminology have been assigned deprecation warning and will be removed in the future releases of the package.

This PR fixes #91 and #92

Checklist

@jucordero jucordero changed the base branch from main to ffc_model April 30, 2026 15:05
@jucordero jucordero requested a review from Copilot May 1, 2026 08:15
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 introduces new land conversion/scaling utilities (including pipeline-compatible model nodes) and expands the LandDataArray accessor API to support adding land categories, while standardizing terminology from “type/class” to “category” with deprecation paths for older names.

Changes:

  • Add new land intervention model functions: scale_land() and land_scaling_from_food().
  • Add LandDataArray.add_category() and rename/accessor API terminology to “category” (with deprecation warnings for older method/kwarg names).
  • Update and extend land accessor tests to use the new naming and to cover add_category() behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 13 comments.

File Description
agrifoodpy/land/land.py Adds category-based APIs, deprecation shims, plotting kwarg rename, and new add_category() accessor.
agrifoodpy/land/model.py Adds pipeline-node model functions for land conversion and FBS-driven land scaling; updates sequestration to use new category naming.
agrifoodpy/land/tests/test_land.py Renames tests to “category” terminology and adds test coverage for add_category().

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

Comment thread agrifoodpy/land/land.py Outdated
Comment thread agrifoodpy/land/land.py Outdated
Comment thread agrifoodpy/land/land.py Outdated
Comment thread agrifoodpy/land/land.py Outdated
Comment thread agrifoodpy/land/land.py
Comment thread agrifoodpy/land/land.py Outdated
Comment thread agrifoodpy/land/model.py
Comment thread agrifoodpy/land/model.py
Comment thread agrifoodpy/land/land.py Outdated
Comment thread agrifoodpy/land/model.py
@jucordero jucordero requested a review from Copilot May 6, 2026 16:35
@jucordero jucordero marked this pull request as ready for review May 6, 2026 17:21
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.

[FFC] Land shift functions

2 participants