[Kst] branches/work/kst/portto4/kst/src/datasources/ascii

Barth Netterfield netterfield at astro.utoronto.ca
Wed Jun 13 14:32:20 UTC 2012


SVN commit 1300414 by netterfield:

BUG: 301203

Interpret empty custom-delimited columns as NaN.

NOTE: this is different than non-numeric columns, which are interpreted
by atof() as zero.  I think NaN is the 'correct' interpretation, but
this would slow the interpretation of all ascii files.


 M  +8 -0      asciisource.cpp  


--- branches/work/kst/portto4/kst/src/datasources/ascii/asciisource.cpp #1300413:1300414
@@ -596,6 +596,8 @@
   lexc.setDecimalSeparator(_config._useDot);
   const QString delimiters = _config._delimiters.value();
 
+  bool is_custom = (_config._columnType.value() == AsciiSourceConfig::Custom);
+
   int col_start = -1;
   for (int i = 0; i < n; i++, s++) {
     bool incol = false;
@@ -613,6 +615,12 @@
       if (isLineBreak(buffer[ch])) {
         break;
       } else if (column_del(buffer[ch])) { //<- check for column start
+        if ((!incol) && is_custom) {
+          ++i_col;
+          if (i_col == col) {
+            v[i] = NAN;
+          }
+        }
         incol = false;
       } else if (comment_del(buffer[ch])) {
         break;


More information about the Kst mailing list