Skip to content

Fix inconsistent leaf quadrature in canopy projection and scattering - #63

Merged
cfranken merged 1 commit into
mainfrom
fix/shared-leaf-quadrature
Nov 7, 2026
Merged

cfranken merged 1 commit into
mainfrom
fix/shared-leaf-quadrature

Conversation

@cfranken

@cfranken cfranken commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Canopy projection and scattering can currently integrate different discrete leaf populations: G uses an independent 40-node default and normalizes the sampled PDF, while the analytic scattering kernel uses quadrature.n_leaf without normalizing its measure. With beta(0.4, 0.7), eight inclination nodes and conservative leaves, the m=0 scattering-column normalization error is 0.103257. This produces artificial absorption/scattering even though leaf reflectance plus transmittance is one.

Use a shared normalized leaf-area quadrature for projection, bi-Lambertian scattering and 4SAIL. Add quadrature to G, component_G and bulk_G, and propagate the selected resolution through phase normalization and mixed-component weights. G now defaults to CanopyQuadrature().n_leaf; the explicit nLeg override remains available. No outgoing-flux or APAR renormalization is applied. The patch version is bumped to 0.2.1 for downstream compatibility gating.

Validation on Julia 1.12.6:

  • Full CanopyOptics suite: 85,541 passed.
  • New FP32/FP64 regressions: 76 passed, covering PDF normalization, conservative scattering, non-default quadratures and 4SAIL projection agreement.
  • The reproducer above fails on current main and passes with this change; its residual becomes 1.13e-7 with 128 outgoing streams. Finite outgoing-angle quadrature error remains.

Run: julia --project=. test/runtests.jl.

Companion PR: RemoteSensingTools/vSmartMOM.jl#243 (draft until CanopyOptics 0.2.1 is available). It passes canopy.canopy_quadrature into extinction preparation and requires CanopyOptics 0.2.1. This fixes the geometry/accounting inconsistency; it does not remove the physical approximation error of a two-stream closure.

Copilot AI balanced review requested due to automatic review settings November 7, 2026 02:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@cfranken
cfranken merged commit be944ad into main Nov 7, 2026
1 check passed
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.

2 participants