From 92cbf00b3c7e1b34a8b1e7643220b7934d20231d Mon Sep 17 00:00:00 2001
From: dave <dave@dtu.dk>
Date: Tue, 15 Nov 2016 12:38:15 +0100
Subject: [PATCH] prepost: robust fallback on [time_stop] tag name with _ or
 space

---
 wetb/prepost/dlcdefs.py     | 2 ++
 wetb/prepost/dlctemplate.py | 5 ++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/wetb/prepost/dlcdefs.py b/wetb/prepost/dlcdefs.py
index 664897c3..92b1057f 100644
--- a/wetb/prepost/dlcdefs.py
+++ b/wetb/prepost/dlcdefs.py
@@ -361,6 +361,8 @@ def excel_stabcon(proot, fext='xlsx', pignore=None, pinclude=None, sheet=0,
                 tags_dict['[case_id]'] = tags_dict['[Case id.]']
             if '[time stop]' in tags_dict.keys():
                 tags_dict['[time_stop]'] = tags_dict['[time stop]']
+            else:
+                tags_dict['[time stop]'] = tags_dict['[time_stop]']
             try:
                 tags_dict['[turb_base_name]'] = tags_dict['[Turb base name]']
             except KeyError:
diff --git a/wetb/prepost/dlctemplate.py b/wetb/prepost/dlctemplate.py
index 07213815..928420a0 100644
--- a/wetb/prepost/dlctemplate.py
+++ b/wetb/prepost/dlctemplate.py
@@ -162,7 +162,10 @@ def variable_tag_func(master, case_id_short=False):
     mt['[log_dir]'] = 'logfiles/%s/' % dlc_case
     mt['[htc_dir]'] = 'htc/%s/' % dlc_case
     mt['[case_id]'] = mt['[Case id.]']
-    mt['[time_stop]'] = mt['[time stop]']
+    try:
+        mt['[time_stop]'] = mt['[time stop]']
+    except KeyError:
+        mt['[time stop]'] = mt['[time_stop]']
     mt['[turb_base_name]'] = mt['[Turb base name]']
     mt['[DLC]'] = mt['[Case id.]'].split('_')[0][3:]
     mt['[pbs_out_dir]'] = 'pbs_out/%s/' % dlc_case
-- 
GitLab