Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue on multiple log files with same prefix in plot_stats #168

Merged
merged 3 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions parm/detect_platform.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,25 @@
#
# Detect HPC platforms
#
if [[ -d /scratch1 ]] ; then
if [[ -d /scratch2/NAGAPE ]] ; then
PLATFORM="hera"
elif [[ -d /jetmon ]] ; then
PLATFORM="jet"
elif [[ -d /work ]]; then
elif [[ -d /work/noaa ]]; then
hoststr=$(hostname)
if [[ "$hoststr" == "hercules"* ]]; then
PLATFORM="hercules"
else
PLATFORM="orion"
fi
elif [[ -d /ncrc ]]; then
PLATFORM="gaea"
elif [[ -d /glade ]]; then
PLATFORM="derecho"
elif [[ -d /lfs4/HFIP ]] ; then
PLATFORM="jet"
elif [[ -d /lfs/h2 ]] ; then
PLATFORM="wcoss2"
else
PLATFORM="unknown"
fi
MACHINE="${PLATFORM}"

48 changes: 39 additions & 9 deletions ush/plot_analysis_timehistory.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
## History ===============================
## V000: 2024/10/14: Chan-Hoo Jeon : Preliminary version
## V001: 2024/10/15: Chan-Hoo Jeon : Add wall-clock time plot
## V002: 2024/10/31: Chan-Hoo Jeon : Fix input log file name issue
###################################################################### CHJ #####

import os, sys
Expand Down Expand Up @@ -64,11 +65,13 @@ def get_data_analysis(path_data,fn_data_anal_prefix,fn_data_anal_suffix,nprocs_a
fp_data_anal_prefix = os.path.join(path_data,fn_data_anal_prefix)
files = []
for entry in os.scandir(path_data):
if entry.is_file() and entry.name.startswith(fn_data_anal_prefix):
if entry.is_file() and \
entry.name.startswith(fn_data_anal_prefix) and \
entry.name.endswith(fn_data_anal_suffix):
files.append(entry.path)

files.sort()
#print("Files=",files)
print("Files=",files)

nobs_qc_prefix = "QC SnowDepthGHCN totalSnowDepth"
wtime_oops_prefix = "OOPS_STATS util::Timers::Total"
Expand Down Expand Up @@ -134,12 +137,36 @@ def get_data_analysis(path_data,fn_data_anal_prefix,fn_data_anal_suffix,nprocs_a
wtime_oops_file = float(line_split[2])
#print("WTIME OOPS AVG=",wtime_oops_file)

min_val_final.append(min_val_file[-1])
max_val_final.append(max_val_file[-1])
rms_val_final.append(rms_val_file[-1])
nobs_qc_final.append(nobs_qc_file[-1])
nobs_in_final.append(nobs_in_file[-1])
wtime_oops.append(wtime_oops_file)
if not min_val_file:
min_val_final.append(None)
else:
min_val_final.append(min_val_file[-1])

if not max_val_file:
max_val_final.append(None)
else:
max_val_final.append(max_val_file[-1])

if not rms_val_file:
rms_val_final.append(None)
else:
rms_val_final.append(rms_val_file[-1])

if not nobs_qc_file:
nobs_qc_final.append(None)
else:
nobs_qc_final.append(nobs_qc_file[-1])

if not nobs_in_file:
nobs_in_final.append(None)
else:
nobs_in_final.append(nobs_in_file[-1])

if not wtime_oops_file:
wtime_oops.append(None)
else:
wtime_oops.append(wtime_oops_file)

# ms to sec
wtime_oops = [x * 0.001 for x in wtime_oops]
tcpu_oops = [x * nprocs_anal for x in wtime_oops]
Expand Down Expand Up @@ -193,7 +220,10 @@ def get_data_forecast(path_data,fn_data_fcst_prefix,fn_data_fcst_suffix,nprocs_f
wtime_uwm_file = float(line_split)
#print("WTIME UFS Weather Model=",wtime_uwm_file)

wtime_uwm.append(wtime_uwm_file)
if not wtime_uwm_file:
wtime_uwm.append(None)
else:
wtime_uwm.append(wtime_uwm_file)

tcpu_uwm = [x * nprocs_fcst for x in wtime_uwm]

Expand Down
Loading