Skip to content

Commit

Permalink
a bit more readable
Browse files Browse the repository at this point in the history
  • Loading branch information
nefrathenrici committed Feb 1, 2024
1 parent f4769d0 commit a4d5728
Showing 1 changed file with 15 additions and 21 deletions.
36 changes: 15 additions & 21 deletions post_processing/ci_plots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -702,13 +702,15 @@ function pair_edmf_names(short_names)

for name in short_names
up_index = findfirst(x -> x == name * "up", short_names)
dn_index =
findfirst(x -> x == replace(name, "up" => ""), short_names)
# Only updraft name
if endswith(name, "up")
dn_index =
findfirst(x -> x == replace(name, "up" => ""), short_names)
# Check for updraft vars with no gridmean pair
isnothing(dn_index) && push!(grouped_vars, tuple(name))
# Only gridmean name
elseif isnothing(up_index)
push!(grouped_vars, tuple(name))
# Pair gridmean/updraft name
else
push!(grouped_vars, tuple(name, short_names[up_index]))
end
Expand Down Expand Up @@ -746,18 +748,12 @@ function make_plots(::EDMFBoxPlots, simulation_path)

short_name_tuples = pair_edmf_names(short_names)
var_groups_zt = [
tuple(
collect(
slice(
get(simdir; short_name, reduction, period),
x = 0.0,
y = 0.0,
) for short_name in var_names
)...,
(
slice(get(simdir; short_name, reduction, period), x = 0.0, y = 0.0) for short_name in var_names
) for var_names in short_name_tuples
]
var_groups_z = [
tuple(collect(slice(v, time = LAST_SNAP) for v in group)...) for
(collect(slice(v, time = LAST_SNAP) for v in group)...,) for
group in var_groups_zt
]

Expand Down Expand Up @@ -795,18 +791,16 @@ function make_plots(::EDMFSpherePlots, simulation_path)

short_name_tuples = pair_edmf_names(short_names)
var_groups_zt = [
tuple(
collect(
slice(
get(simdir; short_name, reduction, period),
lon = 0.0,
lat = lat,
) for short_name in var_names
)...,
(
slice(
get(simdir; short_name, reduction, period),
lon = 0.0,
lat = lat,
) for short_name in var_names
) for lat in latitudes, var_names in short_name_tuples
]
var_groups_z = [
tuple(collect(slice(v, time = LAST_SNAP) for v in group)...) for
(collect(slice(v, time = LAST_SNAP) for v in group)...,) for
group in var_groups_zt
]

Expand Down

0 comments on commit a4d5728

Please sign in to comment.