nasa / cape

Computational Aerosciences Productivity & Execution
Other
22 stars 9 forks source link

DataBook read issue #20

Open nasa-ddalle opened 1 year ago

nasa-ddalle commented 1 year ago

Follow-on to #18

From @rbreslavsky:

One more comment on this. The databooks are all generated correctly now. However, when they are read back in (for carpet plots or other operations), lists of strings get split up into multiple parts. So for instance, if I have "['hvanleer', 'hvanleer']" in a cell, that gets split into two parts by util.split_line().

nasa-ddalle commented 1 year ago

Figured out that the issue was util.split_line() not remembering which character opened the escaped string. So the ' at the end of "['hvanleer' was closing the opening ".

nasa-ddalle commented 1 year ago

Should be fixed as of https://github.com/nasa/cape/commit/bfe4f556190e35f9b66f8acaa6a612294199d396

Here's my verification test:

>>> cape.util.split_line('"[\'hvanleer\', \'hvanleer\']"', ',', 1)
['"[\'hvanleer\', \'hvanleer\']"']

A little bit hard to read, but it would have been ['"[\'hvanleer\'', '\'hvanleer\']"'] before.

I think this version could still get tricked by the string "[\"hvanleer\", \"hvanleer\"]", so I'll add one more commit to fix that one.

rbreslavsky commented 1 year ago

Derek, everything seems to be working now. The only thing that's still amiss is that when running lineloads (pyfun --ll) the top level databook/ll_<component_name>_line_loads.csv files don't parse the lists/strings correctly. The actual line loads data inside databook/lineload/ look to be fine, however.

rbreslavsky commented 1 year ago

Another note: there is also an impact to databooks. On initial databook generation, all seems to be well. But if runs are appended to the databook, the column data no longer line up with the column titles.

rbreslavsky commented 7 months ago

@nasa-ddalle, has this been looked at or fixed for databooks?

nasa-ddalle commented 7 months ago

Ok, I think this should finally be fixed. Patches applied to both main and v1.1 branches.