Skip to content
Snippets Groups Projects
Commit cf15be69 authored by David Verelst's avatar David Verelst
Browse files

prepost: consistently make case_id/log/res file names lower case due to HAWC2

parent 918846bd
No related branches found
No related tags found
No related merge requests found
......@@ -1118,7 +1118,7 @@ def post_launch(cases, save_iter=False, silent=False, suffix=None,
# file. If it is a directory, it will check all that is in the dir
run_dir = cases[k]['[run_dir]']
log_dir = cases[k]['[log_dir]']
errorlogs.PathToLogs = os.path.join(run_dir, log_dir, kk)
errorlogs.PathToLogs = os.path.join(run_dir, log_dir)
try:
errorlogs.check(save_iter=save_iter)
if not silent:
......@@ -1809,6 +1809,12 @@ class HtcMaster(object):
htc = self.master_str
# FIXME: HAWC2 always outputs result and logfile in lower case, so
# force case_id/Case id. to be lower case
self.tags['[case_id]'] = self.tags['[case_id]'].lower()
if '[Case id.]' in self.tags:
self.tags['[Case id.]'] = self.tags['[Case id.]'].lower()
# and now replace all the tags in the htc master file
# when iterating over a dict, it will give the key, given in the
# corresponding format (string keys as strings, int keys as ints...)
......@@ -2626,7 +2632,8 @@ class PBS(object):
run_dir = case['[run_dir]']
res_dir = case['[res_dir]']
log_dir = case['[log_dir]']
cname_ = cname.replace('.htc', '')
# FIXME: HAWC2 outputs result and logfile always in lower cases
cname_ = cname.replace('.htc', '').lower()
f_log = os.path.join(run_dir, log_dir, cname_)
f_res = os.path.join(run_dir, res_dir, cname_)
if not os.path.exists(f_log + '.log'):
......@@ -2729,14 +2736,13 @@ class ErrorLogs(windIO.LogFile):
# walk trough the files present in the folder path
for fname in FileList[0][2]:
fname_lower = fname.lower()
# progress indicator
if NrFiles > 1:
if not self.silent:
print('progress: ' + str(i) + '/' + str(NrFiles))
# open the current log file
f_log = os.path.join(self.PathToLogs, str(fname_lower))
f_log = os.path.join(self.PathToLogs, fname)
if self.cases is not None:
case = self.cases[fname.replace('.log', '.htc')]
......@@ -3615,7 +3621,7 @@ class Cases(object):
respath = os.path.join(case['[run_dir]'], case['[res_dir]'])
resfile = case['[case_id]']
self.res = windIO.LoadResults(respath, resfile)
self.res = windIO.LoadResults(respath, resfile.lower())
if not _slice:
_slice = np.r_[0:len(self.res.sig)]
self.time = self.res.sig[_slice,0]
......@@ -3677,12 +3683,6 @@ class Cases(object):
#return cases
def force_lower_case_id(self):
tmp_cases = {}
for cname, case in self.cases.items():
tmp_cases[cname.lower()] = case.copy()
self.cases = tmp_cases
def _get_cases_dict(self, post_dir, sim_id):
"""
Load the pickled dictionary containing all the cases and their
......@@ -3699,8 +3699,6 @@ class Cases(object):
self.cases = load_pickled_file(os.path.join(post_dir, sim_id + '.pkl'))
self.cases_fail = {}
self.force_lower_case_id()
if self.rem_failed:
try:
self.load_failed(sim_id)
......
......@@ -279,7 +279,6 @@ def post_launch(sim_id, statistics=True, rem_failed=True, check_logs=True,
config['Weibull']['Vref'] = 50
config['nn_shaft'] = 4
cc = sim.Cases(POST_DIR, sim_id, rem_failed=rem_failed, config=config)
cc.force_lower_case_id()
if force_dir:
for case in cc.cases:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment