Skip to content

Commit

Permalink
add more near surface diagnostics
Browse files Browse the repository at this point in the history
  • Loading branch information
szy21 committed Aug 22, 2024
1 parent e68378b commit e28a1ed
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 2 deletions.
76 changes: 76 additions & 0 deletions src/diagnostics/core_diagnostics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,82 @@ add_diagnostic_variable!(
end,
)

###
# Near-surface air temperature (2d)
###
add_diagnostic_variable!(
short_name = "tas",
long_name = "Near-Surface Air Temperature",
standard_name = "air_temperature",
units = "K",
comments = "Temperature at the bottom cell center of the atmosphere",
compute! = (out, state, cache, time) -> begin
thermo_params = CAP.thermodynamics_params(cache.params)
if isnothing(out)
return TD.air_temperature.(
thermo_params,
Fields.level(cache.precomputed.ᶜts, 1),
)
else
out .=
TD.air_temperature.(
thermo_params,
Fields.level(cache.precomputed.ᶜts, 1),
)
end
end,
)

###
# Near-surface U velocity (2d)
###
add_diagnostic_variable!(
short_name = "uas",
long_name = "Eastward Near-Surface Wind",
standard_name = "eastward_wind",
units = "m s^-1",
comments = "Eastward component of the wind at the bottom cell center of the atmosphere",
compute! = (out, state, cache, time) -> begin
if isnothing(out)
return copy(
u_component.(
Geometry.UVector.(Fields.level(cache.precomputed.ᶜu, 1))
),
)
else
out .=
u_component.(
Geometry.UVector.(Fields.level(cache.precomputed.ᶜu, 1))
)
end
end,
)

###
# Near-surface V velocity (2d)
###
add_diagnostic_variable!(
short_name = "vas",
long_name = "Northward Near-Surface Wind",
standard_name = "northward_wind",
units = "m s^-1",
comments = "Northward (meridional) wind component at the bottom cell center of the atmosphere",
compute! = (out, state, cache, time) -> begin
if isnothing(out)
return copy(
v_component.(
Geometry.VVector.(Fields.level(cache.precomputed.ᶜu, 1))
),
)
else
out .=
v_component.(
Geometry.VVector.(Fields.level(cache.precomputed.ᶜu, 1))
)
end
end,
)

###
# Eastward and northward surface drag component (2d)
###
Expand Down
17 changes: 15 additions & 2 deletions src/diagnostics/default_diagnostics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,21 @@ end
# Core #
########
function core_default_diagnostics(output_writer, t_start, t_end, reference_date)
core_diagnostics =
["ts", "ta", "thetaa", "ha", "pfull", "rhoa", "ua", "va", "wa", "hfes"]
core_diagnostics = [
"ts",
"ta",
"tas",
"uas",
"vas",
"thetaa",
"ha",
"pfull",
"rhoa",
"ua",
"va",
"wa",
"hfes",
]

average_func = frequency_averages(t_start, t_end)

Expand Down

0 comments on commit e28a1ed

Please sign in to comment.