From a4d57282765148c4c4e122020abd1b6a71f2ac56 Mon Sep 17 00:00:00 2001 From: nefrathenrici Date: Thu, 1 Feb 2024 15:40:18 -0800 Subject: [PATCH] a bit more readable --- post_processing/ci_plots.jl | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/post_processing/ci_plots.jl b/post_processing/ci_plots.jl index cb721a5f3ff..67e010fdd20 100644 --- a/post_processing/ci_plots.jl +++ b/post_processing/ci_plots.jl @@ -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 @@ -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 ] @@ -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 ]