Update crop residue biomass calculation and adjust related test cases#207
Conversation
🦋 Changeset detectedLatest commit: a088e0d The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
WalkthroughThe changes update the calculation of crop residue biomass in nitrogen balance and volatilization functions by dividing the yield by the harvest index before applying residue and nitrogen content factors. Corresponding test cases were updated to include explicit cultivation date ranges and adjusted expected values to match the revised calculation. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant NitrogenRemoval
participant NitrogenVolatilization
participant CultivationData
User->>NitrogenRemoval: Request nitrogen removal calculation
NitrogenRemoval->>CultivationData: Fetch yield, harvest index, residue factors
NitrogenRemoval->>NitrogenRemoval: Compute (yield / harvest index) * residue * N-content
NitrogenRemoval-->>User: Return updated nitrogen removal
User->>NitrogenVolatilization: Request volatilization calculation
NitrogenVolatilization->>CultivationData: Fetch yield, harvest index, residue factors, emission factor
NitrogenVolatilization->>NitrogenVolatilization: Compute (yield / harvest index) * residue * N-content * emission
NitrogenVolatilization-->>User: Return updated volatilization value
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Assessment against linked issues
Assessment against linked issues: Out-of-scope changesNo out-of-scope changes found. Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (6)
🧰 Additional context used🧠 Learnings (7)📓 Common learningsfdm-calculator/src/balance/nitrogen/volatization/residues.test.ts (8)Learnt from: SvenVw Learnt from: SvenVw Learnt from: SvenVw Learnt from: SvenVw Learnt from: SvenVw Learnt from: SvenVw Learnt from: SvenVw Learnt from: SvenVw fdm-calculator/src/balance/nitrogen/volatization/residues.ts (4)Learnt from: SvenVw Learnt from: SvenVw Learnt from: SvenVw Learnt from: SvenVw .changeset/sour-kings-drive.md (7)Learnt from: SvenVw Learnt from: SvenVw Learnt from: SvenVw Learnt from: SvenVw Learnt from: SvenVw Learnt from: SvenVw Learnt from: SvenVw fdm-calculator/src/balance/nitrogen/removal/residue.ts (4)Learnt from: SvenVw Learnt from: SvenVw Learnt from: SvenVw Learnt from: SvenVw fdm-calculator/src/balance/nitrogen/removal/residue.test.ts (9)Learnt from: SvenVw Learnt from: SvenVw Learnt from: SvenVw Learnt from: SvenVw Learnt from: SvenVw Learnt from: SvenVw Learnt from: SvenVw Learnt from: SvenVw Learnt from: SvenVw fdm-calculator/src/balance/nitrogen/removal/index.test.ts (8)Learnt from: SvenVw Learnt from: SvenVw Learnt from: SvenVw Learnt from: SvenVw Learnt from: SvenVw Learnt from: SvenVw Learnt from: SvenVw Learnt from: SvenVw 🔇 Additional comments (8)
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## development #207 +/- ##
============================================
Coverage 94.04% 94.04%
============================================
Files 85 85
Lines 12632 12634 +2
Branches 1291 1291
============================================
+ Hits 11880 11882 +2
Misses 750 750
Partials 2 2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary by CodeRabbit
Bug Fixes
Tests
Closes #203