-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update traits data structures #300
Conversation
|
||
@dataclass() | ||
class StemTraits: | ||
"""A dataclass for stem traits. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to make Flora
inherit StemTraits
, or have both inherit from an ABC, so that this list of traits is only defined in one place?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha. I did look at all sorts of things here - Protocols and ABC and inheritance, but these classes are basically intended to deal with two different constructor signatures, even if they share nearly all the attributes. That seems to make any kind of inheritance more finicky than just duplicating stuff. I may have missed it - I'd love a way to share that set of attributes cleanly across the two PFT traits, Flora and Stem Traits.
Right now though, I'd like to define that common API on the attributes and get the next PR in to close out the functionality hanging in #296 - and if the API looks good, I'm all for circling back to improve the implementation later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to approve to keep the demography work stream moving. I'm wary of accumulating technical debt (i.e. not coming up with an improved implementation of the stem traits that avoids duplication) but appreciate we need to get the remaining stuff in as well.
Description
This PR implements the updated trait data structures requested in #298. It update tests and things using the trait data structures.
It forms part of a sequence re-implementing the functionality set implemented in #296 but on less shaky structural grounds and in smaller more easily reviewed sections.
Fixes #298 (issue)
Type of change
Key checklist
pre-commit
checks:$ pre-commit run -a
$ poetry run pytest
Further checks