Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
charleskawczynski committed Feb 13, 2025
1 parent c26112b commit 2ce75b0
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 5 deletions.
11 changes: 9 additions & 2 deletions src/optics/LookUpTables.jl
Original file line number Diff line number Diff line change
Expand Up @@ -876,8 +876,15 @@ function LookUpAerosolMerra(ds, ::Type{FT}, ::Type{DA}) where {FT <: AbstractFlo
organic_carbon_rh = DA{FT}(Array(ds["aero_ocar_rh_tbl"]))
organic_carbon = DA{FT}(Array(ds["aero_ocar_tbl"]))
bnd_lims_wn = Array(ds["bnd_limits_wavenumber"]) # 1/bnd_lims_wn[i] ≈ (550 nm-x, 550 nm+x)
iband_550nm = findfirst(LR-> 1/LR[2] 550*1e-9 1/LR[1], zip(bnd_lims_wn[1, :], bnd_lims_wn[2, :]))
iband_550nm = isnothing(iband_550nm) ? 0 : iband_550nm

iband_550nm = 0
for i in 1:size(bnd_lims_wn, 2)
if 1 / bnd_lims_wn[2, i] 550 * 1e-9 1 / bnd_lims_wn[1, i]
iband_550nm = i
break
end
end

# map aerosol name to aerosol idx
idx_aerosol = Dict(
"dust1" => 1,
Expand Down
27 changes: 25 additions & 2 deletions src/optics/Optics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,17 @@ Computes optical properties for the longwave problem.
aero_mass = view(as.aerosol_state.aero_mass, :, :, gcol)
rel_hum = AtmosphericStates.getview_rel_hum(as, gcol)

add_aerosol_optics_1scalar!(τ, aod_sw, aero_mask, aero_size, aero_mass, rel_hum, lkp_aero, ibnd, iband_550nm)
add_aerosol_optics_1scalar!(
τ,
aod_sw,
aero_mask,
aero_size,
aero_mass,
rel_hum,
lkp_aero,
ibnd,
iband_550nm,
)
end
end
return nothing
Expand Down Expand Up @@ -335,7 +345,20 @@ end
aero_mass = view(as.aerosol_state.aero_mass, :, :, gcol)
rel_hum = AtmosphericStates.getview_rel_hum(as, gcol)

add_aerosol_optics_2stream!(τ, ssa, g, aod_sw_ext,aod_sw_sca, aero_mask, aero_size, aero_mass, rel_hum, lkp_aero, ibnd, iband_550nm)
add_aerosol_optics_2stream!(
τ,
ssa,
g,
aod_sw_ext,
aod_sw_sca,
aero_mask,
aero_size,
aero_mass,
rel_hum,
lkp_aero,
ibnd,
iband_550nm,
)
end
return nothing
end
Expand Down
13 changes: 12 additions & 1 deletion src/optics/aerosol_optics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,18 @@
This function computes the `OneScalar` aerosol optics properties and adds them
to the exising `OneScalar` optics properties.
"""
@inline function add_aerosol_optics_1scalar!(τ, aod_ext, aod_sca, aero_mask, aero_size, aero_mass, rel_hum, lkp_aero, ibnd, iband_550nm)
@inline function add_aerosol_optics_1scalar!(
τ,
aod_ext,
aod_sca,
aero_mask,
aero_size,
aero_mass,
rel_hum,
lkp_aero,
ibnd,
iband_550nm,
)
FT = eltype(τ)
@inbounds begin
collect_aod = !isnothing(aod_ext) && (ibnd == iband_550nm)
Expand Down

0 comments on commit 2ce75b0

Please sign in to comment.