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 a7fa22b commit fc91d28
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 @@ -686,13 +686,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 @@ -730,18 +732,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 @@ -779,18 +775,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 fc91d28

Please sign in to comment.