Bilambertian Canopy Scattering

Using packages:

using Plots, Distributions
using CanopyOptics
theme(:ggplot2)

Compute quadrature points:

μ,w = CanopyOptics.gauleg(20,0.0,1.0)
([0.003435700407452502, 0.018014036361043095, 0.04388278587433708, 0.08044151408889061, 0.1268340467699246, 0.1819731596367425, 0.24456649902458644, 0.3131469556422902, 0.38610707442917747, 0.46173673943325133, 0.5382632605667487, 0.6138929255708225, 0.6868530443577098, 0.7554335009754136, 0.8180268403632576, 0.8731659532300754, 0.9195584859111094, 0.9561172141256629, 0.981985963638957, 0.9965642995925474], [0.008807003569576225, 0.020300714900193383, 0.03133602416705451, 0.041638370788352363, 0.0509650599086202, 0.0590972659807592, 0.06584431922458828, 0.071048054659191, 0.07458649323630188, 0.07637669356536293, 0.07637669356536293, 0.07458649323630188, 0.071048054659191, 0.06584431922458828, 0.0590972659807592, 0.0509650599086202, 0.041638370788352363, 0.03133602416705451, 0.020300714900193383, 0.008807003569576225])

Use standard planophile leaf distribution:

LD = CanopyOptics.planophile_leaves2()
CanopyOptics.LeafDistribution{Float64}(Beta{Float64}(α=1.0, β=2.768), 0.6366197723675814)

Use a Bilambertian model and specify Reflectance R and Transmission T

BiLambMod = CanopyOptics.BiLambertianCanopyScattering(R=0.4,T=0.2)
BiLambertianCanopyScattering{Float64}(0.4, 0.2, 10)

Compute Scattering Matrices 𝐙⁺⁺, 𝐙⁻⁺ for 0th Fourier moment:

𝐙⁺⁺, 𝐙⁻⁺ = CanopyOptics.compute_Z_matrices(BiLambMod, μ, LD, 0)
([0.7160710114886282 0.7162666569988319 … 1.49938055731684 1.5213028185974362; 0.7137819892576044 0.7135422886247612 … 1.4694393451101517 1.49091832777004; … ; 0.42542305422489674 0.4183790792540787 … 1.180834549981552 1.1983441527903835; 0.42535518233544295 0.41831078470204064 … 1.1808873584120223 1.1984031885801492], [0.7161219547481174 0.7165337622815859 … 1.5139410718634612 1.536079495167322; 0.7140481679749893 0.7149379147052847 … 1.545518086936502 1.5681265169595289; … ; 0.42955434600354603 0.44004023462060465 … 2.3616332393930755 2.3966727057897836; 0.42948673055836045 0.439973284655063 … 2.361759344281922 2.3968061261801537])

Plots matrices (shows single scattering contributions for incoming and outgoing directions)

l = @layout [a  b]
p1 = contourf(μ, μ, 𝐙⁻⁺, title="Z⁻⁺ (Reflection)", xlabel="μꜜ", ylabel="μꜛ")
p2 = contourf(μ, μ, 𝐙⁺⁺, title="Z⁺⁺ (Transmission)", xlabel="μꜛ", ylabel="μꜛ")
plot(p1, p2,  layout = l, margin=5Plots.mm)
plot!(size=(900,350))

Animation over different Beta leaf distributions

steps = 0.1:0.1:5
α = [collect(steps); 5*ones(length(steps))]
β = [ 5*ones(length(steps)); reverse(collect(steps));]
x = 0:0.01:1

anim = @animate for i ∈ eachindex(α)
    LD = CanopyOptics.LeafDistribution(Beta(α[i],β[i]), 2/π)
    Z⁺⁺, Z⁻⁺ = CanopyOptics.compute_Z_matrices(BiLambMod, μ, LD, 0)
    l = @layout [a  b  c]
    p0 = plot(rad2deg.(π * x/2), pdf.(LD.LD,x), legend=false, ylim=(0,3), title="Leaf angle distribution", xlabel="Θ (degrees)")
    p1 = contourf(μ, μ, Z⁻⁺, title="Z⁻⁺ (Reflection)", xlabel="μꜜ", ylabel="μꜛ",clims=(0.5,2))
    p2 = contourf(μ, μ, Z⁺⁺, title="Z⁺⁺ (Transmission)", xlabel="μꜛ", ylabel="μꜛ",clims=(0.5,2))
    plot(p0, p1, p2,  layout = l, margin=5Plots.mm)
    plot!(size=(1100,300))
end

gif(anim, "anim_fps10.gif", fps = 10)

This page was generated using Literate.jl.