Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix csv import #1074

Merged
merged 2 commits into from
Aug 7, 2021
Merged

Fix csv import #1074

merged 2 commits into from
Aug 7, 2021

Conversation

ischoegl
Copy link
Member

@ischoegl ischoegl commented Jul 16, 2021

Changes proposed in this pull request

Fix issues with import of SolutionArray from CSV

  • allow for import of data with single row
  • fix error message for incompatible species
  • fix import for species names containing special characters

If applicable, fill in the issue number this pull request is fixing

Closes #1073

If applicable, provide an example illustrating new features this pull request is introducing

This now works:

import cantera as ct

gas = ct.Solution('gri30.yaml')
states = ct.SolutionArray(gas)
states.append(T=300, P=101300, X='CH4:0.5, O2:0.4')

states.write_csv('test.csv', ('T', 'P', 'X'))
b = ct.SolutionArray(gas)
b.read_csv('test.csv')

Checklist

  • The pull request includes a clear description of this code change
  • Commit messages have short titles and reference relevant issues
  • Build passes (scons build & scons test) and unit tests address code coverage
  • Style & formatting of contributed code follows contributing guidelines
  • The pull request is ready for review

- allow for import of data with single row
- fix error message for incompatible species
- fix import for species names containing special characters
Copy link
Member

@speth speth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thanks, @ischoegl!

@speth speth merged commit 375902b into Cantera:main Aug 7, 2021
@ischoegl ischoegl deleted the fix-csv-import branch August 8, 2021 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issues recreating SolutionArray objects from stored data in csv file
2 participants