From 1382c6fe19315efb1c59dc5b8844658e682decea Mon Sep 17 00:00:00 2001 From: Zhaoyi Shen <11598433+szy21@users.noreply.github.com> Date: Tue, 9 Jul 2024 14:37:47 -0700 Subject: [PATCH] change back to argmax --- src/callbacks/callbacks.jl | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/callbacks/callbacks.jl b/src/callbacks/callbacks.jl index 74b197aca43..77f3d558e98 100644 --- a/src/callbacks/callbacks.jl +++ b/src/callbacks/callbacks.jl @@ -252,21 +252,22 @@ function set_insolation_variables!(Y, p, t, ::TimeVaryingInsolation) end end -function set_aerosol_type(::Type{FT}; - DST01 = FT(0), - SSLT01 = FT(0), - SO4 = FT(0), - CB1 = FT(0), - CB2 = FT(0), - OC1 = FT(0), - OC2 = FT(0), +function set_aerosol_type(; + DST01 = 0, + SSLT01 = 0, + SO4 = 0, + CB1 = 0, + CB2 = 0, + OC1 = 0, + OC2 = 0, _..., -) where{FT} - _, index = findmax((DST01, SSLT01, SO4, CB1, CB2, OC1, OC2))::Tuple{FT, Int} - #index = argmax(Base.Fix1(getindex, (DST01, SSLT01, SO4, CB1, CB2, OC1, OC2)), 1:7) - return index +) + return argmax( + Base.Fix1(getindex, (DST01, SSLT01, SO4, CB1, CB2, OC1, OC2)), + 1:7, + ) end -set_aerosol_type(nt) = set_aerosol_type(eltype(nt); nt...) +set_aerosol_type(nt) = set_aerosol_type(; nt...) NVTX.@annotate function save_state_to_disk_func(integrator, output_dir) (; t, u, p) = integrator