From be9eef8742f59e63da0f3f0f5e1c2d46fd0af273 Mon Sep 17 00:00:00 2001 From: dave <dave@dtu.dk> Date: Tue, 12 Jan 2016 15:28:40 +0100 Subject: [PATCH] hawcstab2: induction output file number of columns depends on the version of HAWCStab2. Assume 38, but fallback to 34 --- wetb/prepost/hawcstab2.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wetb/prepost/hawcstab2.py b/wetb/prepost/hawcstab2.py index 516be89..c1afefe 100644 --- a/wetb/prepost/hawcstab2.py +++ b/wetb/prepost/hawcstab2.py @@ -59,7 +59,10 @@ class InductionResults(object): def read(self, fname): self.data = np.loadtxt(fname) self.wsp = int(fname.split('_u')[-1][:-4]) / 1000.0 - self.df_data = pd.read_fwf(fname, header=0, widths=[14]*34) + try: + self.df_data = pd.read_fwf(fname, header=0, widths=[14]*38) + except: + self.df_data = pd.read_fwf(fname, header=0, widths=[14]*34) # sanitize the headers cols = self.df_data.columns self.df_data.columns = [k[:-2].replace('#', '').strip() for k in cols] -- GitLab