added land conversion methods#100
Open
jucordero wants to merge 3 commits intoFixOurFood:ffc_modelfrom
Open
Conversation
Contributor
There was a problem hiding this comment.
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()andland_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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces new model functions and
LandDataArrayaccessor functions to facilitate models where land is converted between different categories.scale_landis 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_foodperforms land scaling based on the relative shifts between food quantities on selected Food Balance Sheet array elements and items. It usesscale_land.LandDataArray.add_categoryis 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