Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Zhaoyi Shen <[email protected]>
Co-authored-by: Gabriele Bozzola <[email protected]>
  • Loading branch information
3 people authored Aug 23, 2024
1 parent bce088d commit 4dc77cd
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions src/diagnostics/core_diagnostics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,6 @@ function compute_clwvi!(
time,
moisture_model::T,
) where {T <: Union{EquilMoistModel, NonEquilMoistModel}}
thermo_params = CAP.thermodynamics_params(cache.params)
if isnothing(out)
out = zeros(axes(Fields.level(state.f, half)))
Operators.column_integral_definite!(
Expand Down Expand Up @@ -798,7 +797,6 @@ function compute_lwp!(
time,
moisture_model::T,
) where {T <: Union{EquilMoistModel, NonEquilMoistModel}}
thermo_params = CAP.thermodynamics_params(cache.params)
if isnothing(out)
out = zeros(axes(Fields.level(state.f, half)))
Operators.column_integral_definite!(
Expand Down Expand Up @@ -841,7 +839,6 @@ function compute_clivi!(
time,
moisture_model::T,
) where {T <: Union{EquilMoistModel, NonEquilMoistModel}}
thermo_params = CAP.thermodynamics_params(cache.params)
if isnothing(out)
out = zeros(axes(Fields.level(state.f, half)))
Operators.column_integral_definite!(
Expand Down Expand Up @@ -878,8 +875,6 @@ function compute_dsevi!(out, state, cache, time)
if isnothing(out)
out = zeros(axes(Fields.level(state.f, half)))
cp = CAP.cp_d(cache.params)
z = Fields.coordinate_field(state.c.ρ).z
g = CAP.grav(cache.params)
dse = cache.scratch.ᶜtemp_scalar
@. dse =
state.c.ρ * (
Expand All @@ -890,8 +885,6 @@ function compute_dsevi!(out, state, cache, time)
return out
else
cp = CAP.cp_d(cache.params)
z = Fields.coordinate_field(state.c.ρ).z
g = CAP.grav(cache.params)
dse = cache.scratch.ᶜtemp_scalar
@. dse =
state.c.ρ * (
Expand Down Expand Up @@ -931,10 +924,11 @@ function compute_clvi!(
out = zeros(axes(Fields.level(state.f, half)))
cloud_cover = cache.scratch.ᶜtemp_scalar
cloud_cover .=
FT = Spaces.undertype(axes(cloud_cover))
ifelse.(
cache.precomputed.cloud_diagnostics_tuple.cf .> 0.0f0,
1.0f0,
0.0f0,
cache.precomputed.cloud_diagnostics_tuple.cf .> zero(FT),
one(FT),
zero(FT),
)
Operators.column_integral_definite!(out, cloud_cover)
return out
Expand All @@ -953,7 +947,6 @@ end
add_diagnostic_variable!(
short_name = "clvi",
long_name = "Vertical Cloud Fraction Integral",
standard_name = "vertical_cloud_fraction_integral",
units = "m",
comments = """
The total height of the column occupied at least partially by cloud.
Expand All @@ -963,7 +956,7 @@ add_diagnostic_variable!(


###
# Total Column Integrated Specific Humidity (2d)
# Column integrated total specific humidity (2d)
###
compute_prw!(out, state, cache, time) =
compute_prw!(out, state, cache, time, cache.atmos.moisture_model)
Expand Down Expand Up @@ -1097,7 +1090,6 @@ end
add_diagnostic_variable!(
short_name = "husv",
long_name = "Vapor Specific Humidity",
standard_name = "vapor_specific_humidity",
units = "kg kg^-1",
comments = "Mass of water vapor per mass of air",
compute! = compute_husv!,
Expand Down

0 comments on commit 4dc77cd

Please sign in to comment.