Added handling of herbivory waste products to the litter model#583
Conversation
…ore it gets divided between litter pools
… rather than reading them from the data object
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #583 +/- ##
===========================================
+ Coverage 95.09% 95.18% +0.08%
===========================================
Files 74 74
Lines 4302 4380 +78
===========================================
+ Hits 4091 4169 +78
Misses 211 211 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
davidorme
left a comment
There was a problem hiding this comment.
I don't love the name InputDetails - it's a bit generic. LitterInputs? Asides from that I think the science all looks fine, but as I've noted in comments, the InputPartition/InputDetails implementation feels like a single class thats fallen in half.
…ethod for the LitterInputs class
|
@davidorme thanks for the feedback fully agree that the two separate classes were clunky so I have now merged them into one |
davidorme
left a comment
There was a problem hiding this comment.
Yeah - that seems cleaner. I'd be tempted to rename the module though, since that class is now gone. Probably fine with models/litter/inputs.py?
dalonsoa
left a comment
There was a problem hiding this comment.
This looks good, and pretty clean to put all related stuff in its own class. My only comment is that you change the name of the class to LitterInputs, but let the variables as input_details. I'd change this to litter_inputs to be more explicit about what inputs we are talking about.
| from virtual_ecosystem.models.litter.constants import LitterConsts | ||
|
|
||
|
|
||
| @dataclass |
There was a problem hiding this comment.
If the LitterInputs objects are not to be modified after creation, make it frozen with @dataclass(frozen=True) to avoid mistakes.
Description
A previous PR (#577) added a flow from the animal model representing waste products from herbivory (e.g. an elephant pulls off a branch but doesn't eat it all and drops the remainder). This PR changes the litter model so that it actually does something with this type of flow (which at present only exists for leaves).
Getting this to work required restructuring of the litter model. Primarily by adding an
InputPartitionclass, which collects all the steps needed to calculate the total input of each plant matter type as well as to calculate the split of each plant matter type between litter pools. This class returns anInputDetailsdataclass which gets used by the rest of thelittermodel. Feedback on this restructure would be very helpful!Fixes #510
Type of change
Key checklist
pre-commitchecks:$ pre-commit run -a$ poetry run pytestFurther checks