From d1df40af87a03848bcde3e02b5c1d92af62b24ce Mon Sep 17 00:00:00 2001 From: Santosh Shanbhogue Date: Tue, 6 Dec 2016 22:45:40 -0500 Subject: [PATCH] Separate transport data from comments in parseTransportData --- interfaces/cython/cantera/ck2cti.py | 10 ++++++---- test/data/h2o2-extra-column-entries-tran.dat | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/interfaces/cython/cantera/ck2cti.py b/interfaces/cython/cantera/ck2cti.py index dd2856d29..f3942ad28 100644 --- a/interfaces/cython/cantera/ck2cti.py +++ b/interfaces/cython/cantera/ck2cti.py @@ -1933,21 +1933,23 @@ class Parser(object): if '!' in line: line, comment = line.split('!', 1) - data = line.split() + [comment] else: - data = line.split() + comment = None + + data = line.split() + if len(data) < 7: raise InputParseError('Unable to parse transport data: not' ' enough parameters on line {0} of "{1}".'.format( line_offset + i, filename)) - if len(data) > 8: + if len(data) > 7: raise InputParseError('Extra parameters found in transport entry' ' for species {0} in file {1}'.format(data[0], filename)) speciesName = data[0] if speciesName in self.speciesDict: if self.speciesDict[speciesName].transport is None: - self.speciesDict[speciesName].transport = TransportData(*data) + self.speciesDict[speciesName].transport = TransportData(*data, comment=comment) else: self.warn('Ignoring duplicate transport data' ' for species "{0} on line {1} of "{2}".'.format( diff --git a/test/data/h2o2-extra-column-entries-tran.dat b/test/data/h2o2-extra-column-entries-tran.dat index 1f869758a..3fd508142 100644 --- a/test/data/h2o2-extra-column-entries-tran.dat +++ b/test/data/h2o2-extra-column-entries-tran.dat @@ -1,7 +1,7 @@ AR 0 136.500 3.330 0.000 0.000 0.000 H 0 145.000 2.050 0.000 0.000 0.000 H2 1 38.000 2.920 0.000 0.790 280.000 -H2O 2 572.400 2.605 1.8 0. 0.000 4.000 ! bad entry +H2O 2 572.400 2.605 1.8 0. 0.000 4.000 H2O2 2 107.400 3.458 0.000 0.000 3.800 HO2 2 107.400 3.458 0.000 0.000 1.000 ! * O 0 80.000 2.750 0.000 0.000 0.000