From 19b0043f4e5000dd178772764dbd7d2ba7720eea Mon Sep 17 00:00:00 2001 From: "Mads M. Pedersen" <mmpe@dtu.dk> Date: Mon, 8 Oct 2018 13:33:06 +0200 Subject: [PATCH] made gtsdf similar to other formats in hawc2io and chaned htcFile to add OutputSection if name is output --- wetb/hawc2/Hawc2io.py | 11 ++++++----- wetb/hawc2/htc_contents.py | 7 ++++++- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/wetb/hawc2/Hawc2io.py b/wetb/hawc2/Hawc2io.py index 2cb9ddf..e1cb85a 100644 --- a/wetb/hawc2/Hawc2io.py +++ b/wetb/hawc2/Hawc2io.py @@ -159,7 +159,7 @@ class ReadHawc2(object): self._ReadSensorFile() elif FileName.lower().endswith('.hdf5') or os.path.isfile(self.FileName + ".hdf5"): self.FileFormat = 'GTSDF' - self.ReadAll() + self.ReadGtsdf() else: print ("unknown file: " + FileName) ################################################################################ @@ -197,14 +197,15 @@ class ReadHawc2(object): def ReadGtsdf(self): self.t, data, info = gtsdf.load(self.FileName + '.hdf5') self.Time = self.t - self.ChInfo = [info['attribute_names'], - info['attribute_units'], - info['attribute_descriptions']] - self.NrCh = data.shape[1] + self.ChInfo = [['Time'] + info['attribute_names'], + ['s'] + info['attribute_units'], + ['Time'] + info['attribute_descriptions']] + self.NrCh = data.shape[1] + 1 self.NrSc = data.shape[0] self.Freq = self.NrSc / self.Time self.FileFormat = 'GTSDF' self.gtsdf_description = info['description'] + data = np.hstack([self.Time[:,np.newaxis], data]) return data ################################################################################ # One stop call for reading all data formats diff --git a/wetb/hawc2/htc_contents.py b/wetb/hawc2/htc_contents.py index 45967be..9135ed9 100644 --- a/wetb/hawc2/htc_contents.py +++ b/wetb/hawc2/htc_contents.py @@ -131,7 +131,12 @@ class HTCContents(object): def add_section(self, name, allow_duplicate=False): if name in self and allow_duplicate is False: return self[name] - section = HTCSection(name) + if name == "output": + section = HTCOutputSection(name) + elif name.startswith("output_at_time"): + section = HTCOutputAtTimeSection(name) + else: + section = HTCSection(name) self._add_contents(section) return section -- GitLab