Skip to content

Fixing LUE and units in pmodel#1362

Merged
davidorme merged 7 commits intodevelopfrom
1354-lue-and-units-in-pmodel
Feb 25, 2026
Merged

Fixing LUE and units in pmodel#1362
davidorme merged 7 commits intodevelopfrom
1354-lue-and-units-in-pmodel

Conversation

@davidorme
Copy link
Copy Markdown
Collaborator

@davidorme davidorme commented Feb 23, 2026

Description

  • The light use efficiency reported by the P Model can be undefined in some extreme conditions. This results in np.nan values that propagate down to the soil model integration, which crashes the simulation (Maliau simulation fails #1314). This is now fixed by using np.nan_to_num to force zero LUE under those conditions.
  • The PModel fitting was using VPD and PATM straight out of the data in kPa and pyrealm.PModel requires Pascals. Essentially the plants were growing in an incredibly humid near vacuum.
  • The PR also restructures the estimate_gpp - it was doing a lot of subsetting the vertical layers down to the canopy layers and it seems much more straightforward to pad the canopy layers out to the full vertical layers.

Fixes #1354

Type of change

  • New feature (non-breaking change which adds functionality)
  • Optimization (back-end change that speeds up the code)
  • Bug fix (non-breaking change which fixes an issue)

Key checklist

  • Make sure you've run the pre-commit checks: $ pre-commit run -a
  • All tests pass: $ poetry run pytest

Further checks

  • Code is commented, particularly in hard-to-understand areas
  • Tests added that prove fix is effective or that feature works
  • Relevant documentation reviewed and updated

@davidorme davidorme linked an issue Feb 23, 2026 that may be closed by this pull request
@davidorme davidorme requested a review from vgro February 23, 2026 11:14
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Feb 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.87%. Comparing base (8a26398) to head (e29a057).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1362      +/-   ##
===========================================
+ Coverage    94.85%   94.87%   +0.01%     
===========================================
  Files           71       71              
  Lines         7387     7388       +1     
===========================================
+ Hits          7007     7009       +2     
+ Misses         380      379       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Collaborator

@vgro vgro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a sensible fix to me, I just have a few minor comments, most important one that the output to data needs to have the nan values back.

@davidorme davidorme requested a review from vgro February 24, 2026 14:34
Copy link
Copy Markdown
Collaborator

@vgro vgro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@davidorme davidorme merged commit 801955d into develop Feb 25, 2026
13 checks passed
@davidorme davidorme deleted the 1354-lue-and-units-in-pmodel branch February 25, 2026 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handle light use efficiency predictions when P Model is undefined

3 participants