-
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
Aligning PModel and Subdaily PModel #401
base: 383-meta-release-200
Are you sure you want to change the base?
Aligning PModel and Subdaily PModel #401
Conversation
…added a few more attributes
Hi @davidorme. Just taken a look at this. Overall I think it looks really good and is a big improvement on what we had before. Areas for improvement:
|
Yup - I agree that could be packaged more cleanly. I'll have a look at this but might park some of this for later polishing. I think the big picture shape of the new API and keeping the tests working is key on this PR.
On the bounds checking - yes, but not here. Once this is done, PPFD and FAPAR will move into PModelEnvironment, and that adds bounds checks already (no issue yet, but see #394) |
Hi @davidorme , is this ready to go now? |
@j-emberton Nope - this is going to sprawl a lot more, but there are a couple of incoming PRs that will make this switch cleaner. |
ah cool. I thought I saw a refreshed request for review come in so thought I'd double check. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #401 +/- ##
===========================================
- Coverage 96.27% 93.35% -2.92%
===========================================
Files 34 37 +3
Lines 2659 2951 +292
===========================================
+ Hits 2560 2755 +195
- Misses 99 196 +97 ☔ View full report in Codecov by Sentry. |
@j-emberton - Just to refresh on these two questions:
I've done that - it doesn't really save a lot of lines but the structure and the separation of attribute typing and population does look cleaner to me.
All the forcing variables inputs are now via |
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.
Thanks for the updates @davidorme . This looks good
Sorry. I got ahead of myself. Have dismissed my approval |
…com/ImperialCollegeLondon/pyrealm into 386-align-pmodel-and-subdailypmodel
Description
This is a draft of a new structure for the PModel and SubdailyPModel:
PModelABC
, which includes a single abstract class_fit_model
.PModel
andSubdailyPModel
subclasses then:_fit_model
for the class.__init__
method that:super.__init__(...)
to initialise the superclass attributesself._fit_model()
The result aligns the internal attribute names and shares a lot of docstrings and boilerplate. It also dumps the separate
PModel.estimate_productivity
step andfapar
andppfd
are now taken directly from thePModelEnvronment
(see PR #390 - currently still open, but nearly in, I think).Things still to do but probably not in this PR.
Strip out the old implementations - this PR is already bulky, with more changes coming so I would prefer to leave them in place - they are still used in the docs currently, until more of the 2.0.0 API changes have merged and then remove them in one go.
Not all attributes defined on each model are populated. I need to chase down the science on these and update them, but I think for the moment I will just leave them as unpopulated.
It would be nice to use
@cachedproperty
on some of these attributes to keep overheads down. For example,PModel.rd
might only be calculated on request. This seems like a separate PR, and shouldn't break the API, so can be post2.0.0
.Fixes #386
Fixes #385
Type of change
Key checklist
pre-commit
checks:$ pre-commit run -a
$ poetry run pytest
Further checks