Skip to content

Commit

Permalink
Use the cylc job run date as the label on graphs for the 'previous' a…
Browse files Browse the repository at this point in the history
…nd 'current' runs.
  • Loading branch information
jim-p-w committed Dec 5, 2024
1 parent 2c49714 commit b968a2e
Showing 1 changed file with 23 additions and 16 deletions.
39 changes: 23 additions & 16 deletions env-setup/run_cylc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -290,43 +290,50 @@ make_graphs()
fi

base_run=$(cat ${baseline_files[0]} | sed 's/MPAS-Workflow//' | sed 's/\///g')
local base_label=${base_run#*.}
base_label=${base_label//"_cron"/}
new_run=$(cat ${pass_dir}/${success_file} | sed 's/MPAS-Workflow//' | sed 's/\///g')
log "newest run: $new_run in file:${pass_dir}/${success_file}"
log "previous run: $prev_run in file ${graphed_files[0]} "
log "base run: $base_run in file ${baseline_files[0]}"
local new_label=${new_run#*.}
new_label=${new_label//"_cron"/}
local prev_label=${prev_run#*.}
prev_label=${prev_label//"_cron"/}
log "newest run: $new_run label ${new_label} in file:${pass_dir}/${success_file}"
log "previous run: $prev_run label ${prev_label} in file ${graphed_files[0]} "
log "base run: $base_run label ${base_label} in file ${baseline_files[0]}"

local readonly base_args=" -s $graphics_dir $last_cycle $queue $account -n 1 $memory"

# make forecast comparison graphs against the baseline
gen_graphs "baseline" $base_run $new_run $model_out_dir $graphics_dir "$base_args $model_spaces"
gen_graphs $base_label $base_run $new_label $new_run $model_out_dir $graphics_dir "$base_args $model_spaces"

# make omb/oma comparison graphs against the baseline
gen_graphs "baseline" $base_run $new_run $obs_out_dir $graphics_dir "$base_args $obs_spaces"
gen_graphs $base_label $base_run $new_label $new_run $obs_out_dir $graphics_dir "$base_args $obs_spaces"

if [ "$prev_run" != "" ]; then
# make forecast comparison graphs against the previous run
gen_graphs "previous" $prev_run $new_run $model_out_dir $graphics_dir "$base_args $model_spaces"
gen_graphs $prev_label $prev_run $new_label $new_run $model_out_dir $graphics_dir "$base_args $model_spaces"

# make omb/oma comparison graphs against the previous run
gen_graphs "previous" $prev_run $new_run $obs_out_dir $graphics_dir "$base_args $obs_spaces"
gen_graphs $prev_label $prev_run $new_label $new_run $obs_out_dir $graphics_dir "$base_args $obs_spaces"
fi

# move the graphed file to the "graphed" directory
mkdir -p $graph_dir || (log "failed to create $graph_dir" && exit 1)
log "mv ${pass_dir}/${success_file} $graph_dir"
mv ${pass_dir}/${success_file} $graph_dir
#mv ${pass_dir}/${success_file} $graph_dir
}

gen_graphs()
{
local base_name=$1
local base_run=$2
local new_run=$3
local out_dir=$4
local script_dir=$5
local script_args=$6

script_args="$script_args -c $base_name -e $base_name:$base_run,current:$new_run"
local readonly base_name=$1
local readonly base_run=$2
local readonly new_name=$3
local readonly new_run=$4
local readonly out_dir=$5
local readonly script_dir=$6
local readonly script_args=$7

script_args="$script_args -c $base_name -e $base_name:$base_run,$new_name:$new_run"
mkdir -p $out_dir/$base_name || (log "failed to create $out_dir/$base_name" && exit 1)
cd $out_dir/$base_name
log "making graphs in $out_dir/$base_name"
Expand Down

0 comments on commit b968a2e

Please sign in to comment.