-
Notifications
You must be signed in to change notification settings - Fork 1
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
Change SoilModel to use the data object #187
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #187 +/- ##
===========================================
+ Coverage 95.20% 95.90% +0.69%
===========================================
Files 23 25 +2
Lines 1106 1220 +114
===========================================
+ Hits 1053 1170 +117
+ Misses 53 50 -3
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Oh yeah it's probably worth mentioning that the way that the |
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.
It looks good from a cursory glance, but I'm not sure whether you said you were still having the problem of clobbering existing values in Data
? If so, I guess you'll need to solve that before merging.
In terms of the Down the line I might move this function into the |
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.
LGTM :-)
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.
LGTM - one minor question.
The only other thing is that I'd imagined lower level functions mostly passing around numpy arrays and with Dataset and DataArray only really being used when adding to the data object. There's probably a minor speed advantage, but I don't think we should change this here - they're functionally arrays - but we might want at some point to align where (or indeed if) we change from DataArray to NDArray inputs.
* data["low_molecular_weight_c"] | ||
* (equib_maom - data["mineral_associated_om"]) | ||
/ Q_max |
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.
It seems a little odd to have each variable passed in as a dataarray , except for maom
and lwmc
, which are wrapped up within data
still? Is there any reason not to pass those arrays in?
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.
This is basically an artefact of maom
and lmwc
previously being attributes of SoilCarbonPools
. When they stopped being attributes I changed how they were accessed without making them consistent with what had gone before.
However, I am tempted to leave them as is, as the way this data is accessed has already been changed on my integration branch. So, it might be more productive to have the DataArray vs NDArray discussion when the pull request for that is in?
Description
This pull request alters the
SoilModel
so that it uses thedata
object to initialise itself and updates the data object as it goes. As part of this, the soil carbon pools are no longer attributes of theSoilCarbonPools
class, instead these soil carbon pools are only stored as part of the data object. This is mainly for the sake of code clarity, as changes to the attributes (initialised fromdata
) would change thedata
object for everyone. This still happens now but the code is explicit about it happening.This PR also sets the logger level used by
pytest
has been toDEBUG
globally, in order to ensure that debug messages are always seen bypytest
. Previously, they were seen ifpytest
was run on the entire repo, but not if it was run on individual testing files. This option can be overridden in individual test functions or files, but if it proves to be problematic we can set it to another level.Type of change
Key checklist
pre-commit
checks:$ pre-commit run -a
$ poetry run pytest
Further checks