diff --git a/src/optics/LookUpTables.jl b/src/optics/LookUpTables.jl index 3202adfad..6fd4c2f4b 100644 --- a/src/optics/LookUpTables.jl +++ b/src/optics/LookUpTables.jl @@ -876,17 +876,22 @@ function LookUpAerosolMerra(ds, ::Type{FT}, ::Type{DA}) where {FT <: AbstractFlo bnd_lims_wn = DA{FT}(Array(ds["bnd_limits_wavenumber"])) # map aerosol name to aerosol idx idx_aerosol = Dict( - "dust" => 1, - "sea_salt" => 2, + "dust1" => 1, + "sea_salt1" => 2, "sulfate" => 3, "black_carbon_rh" => 4, "black_carbon" => 5, "organic_carbon_rh" => 6, "organic_carbon" => 7, + map(i -> Pair("dust$i", i + 6), 2:5)..., + map(i -> Pair("sea_salt$i", i + 10), 2:5)..., ) # map aerosol idx to its aeromass idx # please note that only "dust" and "sea salt" need aerosol sizes - idx_aerosize = Dict(1 => 1, 2 => 2) + idx_aerosol_keys = filter(collect(keys(idx_aerosol))) do k + occursin("dust", k) || occursin("sea_salt", k) + end + idx_aerosize = Dict(map(k -> Pair(idx_aerosol[k], idx_aerosol[k]), idx_aerosol_keys)) return LookUpAerosolMerra( dims, size_bin_limits, diff --git a/src/optics/aerosol_optics.jl b/src/optics/aerosol_optics.jl index febe13258..6f0945d98 100644 --- a/src/optics/aerosol_optics.jl +++ b/src/optics/aerosol_optics.jl @@ -84,18 +84,29 @@ band number (`ibnd`), aerosol mass (`aeromass`), aerosol size (`aerosize`), and function compute_lookup_aerosol(lkp_aero, ibnd::Int, aero_mass, aero_size, rh::FT, glay) where {FT} τ_cum, τ_ssa_cum, τ_ssag_cum = FT(0), FT(0), FT(0) - if aero_mass[1, glay] > FT(0) - τ, τ_ssa, τ_ssag = compute_lookup_dust_props(lkp_aero, ibnd, aero_mass[1, glay], aero_size[1, glay]) - τ_cum += τ - τ_ssa_cum += τ_ssa - τ_ssag_cum += τ_ssag + for i_aero_size in (1, 8, 9, 10, 11) + if aero_mass[i_aero_size, glay] > FT(0) + τ, τ_ssa, τ_ssag = + compute_lookup_dust_props(lkp_aero, ibnd, aero_mass[i_aero_size, glay], aero_size[i_aero_size, glay]) + τ_cum += τ + τ_ssa_cum += τ_ssa + τ_ssag_cum += τ_ssag + end end - if aero_mass[2, glay] > FT(0) - τ, τ_ssa, τ_ssag = compute_lookup_sea_salt_props(lkp_aero, ibnd, aero_mass[2, glay], aero_size[2, glay], rh) - τ_cum += τ - τ_ssa_cum += τ_ssa - τ_ssag_cum += τ_ssag + for i_aero_size in (2, 12, 13, 14, 15) + if aero_mass[i_aero_size, glay] > FT(0) + τ, τ_ssa, τ_ssag = compute_lookup_sea_salt_props( + lkp_aero, + ibnd, + aero_mass[i_aero_size, glay], + aero_size[i_aero_size, glay], + rh, + ) + τ_cum += τ + τ_ssa_cum += τ_ssa + τ_ssag_cum += τ_ssag + end end if aero_mass[3, glay] > FT(0)