ImperialCollegeLondon / pyrealm

Development of the pyrealm package, providing an integrated toolbox for modelling plant productivity, growth and demography using Python.
https://pyrealm.readthedocs.io/
MIT License
19 stars 8 forks source link

Handle NaNs when calculating max difference in `Splash.estimate_initial_soil_moisture` #193

Closed tztsai closed 5 months ago

tztsai commented 5 months ago

Description

I replaced np.max with np.nanmax when calculating the maximum difference between the start of year soil moisture and the final day of the year and then update the start point to the end of year in the estimate_initial_soil_moisture method of the Splash model, to output more meaningful error messages when running this method.

Fixes #192

Type of change

Key checklist

Further checks

tztsai commented 5 months ago

Shouldn't the function inform whether the iteration has reached equilibrium before returning the array?

davidorme commented 5 months ago

Yeah - that would be useful - we should add a warning to flag that the returned sequence doesn't meet the convergence criteria.

davidorme commented 5 months ago

Caught that bug that was causing the tests to fail.

codecov-commenter commented 5 months ago

Codecov Report

Attention: Patch coverage is 74.07407% with 7 lines in your changes are missing coverage. Please review.

Project coverage is 94.58%. Comparing base (8f7d032) to head (7626476).

Files Patch % Lines
pyrealm/splash/splash.py 74.07% 7 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #193 +/- ## =========================================== - Coverage 94.86% 94.58% -0.28% =========================================== Files 28 28 Lines 1499 1514 +15 =========================================== + Hits 1422 1432 +10 - Misses 77 82 +5 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.