From 52244fb426e041a91318111c00e2105d5a88e5d2 Mon Sep 17 00:00:00 2001
From: Carlo Tibaldi <tlbl@dtu.dk>
Date: Mon, 7 Mar 2016 14:17:08 +0100
Subject: [PATCH] prepost: add if to check if tagsexist and print on a except
 in windIO

---
 wetb/prepost/dlcdefs.py | 6 ++++--
 wetb/prepost/windIO.py  | 4 ++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/wetb/prepost/dlcdefs.py b/wetb/prepost/dlcdefs.py
index 687cc4ee..ce8dbc14 100644
--- a/wetb/prepost/dlcdefs.py
+++ b/wetb/prepost/dlcdefs.py
@@ -320,8 +320,10 @@ def excel_stabcon(proot, fext='xlsx', pignore=None, sheet=0,
             tags_dict['[res_dir]'] = 'res/%s/' % dlc_case
             tags_dict['[log_dir]'] = 'logfiles/%s/' % dlc_case
             tags_dict['[htc_dir]'] = 'htc/%s/' % dlc_case
-            tags_dict['[case_id]'] = tags_dict['[Case id.]']
-            tags_dict['[time_stop]'] = tags_dict['[time stop]']
+            if '[Case id.]' in tags_dict.keys():
+                tags_dict['[case_id]'] = tags_dict['[Case id.]']
+            if '[time stop]' in tags_dict.keys():
+                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/windIO.py b/wetb/prepost/windIO.py
index ebf6e764..11468c09 100755
--- a/wetb/prepost/windIO.py
+++ b/wetb/prepost/windIO.py
@@ -1018,14 +1018,14 @@ class LoadResults(object):
 
         try:
             sig_rf = rainflow_astm(signal)
-        except:
+        except (TypeError) as e:
+            print(e)
             return []
 
         if len(sig_rf) < 1 and not sig_rf:
             return []
 
         hist_data, x, bin_avg =  rfc_hist(sig_rf, no_bins)
-
         m = np.atleast_1d(m)
 
         eq = []
-- 
GitLab