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

Support all VTK readers #100

Merged
merged 7 commits into from Feb 25, 2019
Merged

Support all VTK readers #100

merged 7 commits into from Feb 25, 2019

Conversation

banesullivan
Copy link
Member

@banesullivan banesullivan commented Feb 25, 2019

This PR creates a way to support all VTK reader classes by mapping them to file extensions.

This creates a standard routine for reading any VTK supported file with just a few lines of code and without having to remember the proper VTK classes for performing those reads.

Find the dictionary mapping the extensions to the proper VTK reader classes in readers.py.

import vtki
filename = 'path/to/my/file.ext'
data = vtki.read(filename)

Perhaps you need some flexibility with what the reader performs and need to call several setters/options on the reader - then simply pass a dictionary of function names and parameters to pass:

import vtki
filename = 'path/to/my/file.ext'
data = vtki.read(filename, attrs={'DebugOn':None, 'SetScalarsName':'foo'})

NOTES:

  • Time-varying readers are not yet supported in this but could be implemented down the road
  • These need to be double checked by people familiar with all the different formats
  • The list of readers is not complete but creates a simple framework to add new ones by simply adding a key-value pair in the READERS dictionary.

@codecov
Copy link

codecov bot commented Feb 25, 2019

Codecov Report

Merging #100 into master will decrease coverage by 0.34%.
The diff coverage is 75%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #100      +/-   ##
==========================================
- Coverage   87.58%   87.23%   -0.35%     
==========================================
  Files          16       17       +1     
  Lines        4220     4254      +34     
==========================================
+ Hits         3696     3711      +15     
- Misses        524      543      +19
Impacted Files Coverage Δ
vtki/container.py 96.58% <100%> (+0.01%) ⬆️
vtki/utilities.py 93.42% <100%> (+0.05%) ⬆️
vtki/__init__.py 97.05% <100%> (+0.08%) ⬆️
vtki/pointset.py 91.17% <100%> (ø) ⬆️
vtki/readers.py 71.05% <71.05%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 999ee09...b164db3. Read the comment docs.

@codecov
Copy link

codecov bot commented Feb 25, 2019

Codecov Report

Merging #100 into master will decrease coverage by 0.08%.
The diff coverage is 87.64%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #100      +/-   ##
==========================================
- Coverage   87.58%   87.49%   -0.09%     
==========================================
  Files          16       17       +1     
  Lines        4220     4254      +34     
==========================================
+ Hits         3696     3722      +26     
- Misses        524      532       +8
Impacted Files Coverage Δ
vtki/container.py 96.58% <100%> (+0.01%) ⬆️
vtki/utilities.py 93.42% <100%> (+0.05%) ⬆️
vtki/examples/examples.py 98.05% <100%> (ø) ⬆️
vtki/__init__.py 97.05% <100%> (+0.08%) ⬆️
vtki/pointset.py 91.17% <100%> (ø) ⬆️
vtki/readers.py 85.52% <85.52%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 999ee09...b164db3. Read the comment docs.

@codecov
Copy link

codecov bot commented Feb 25, 2019

Codecov Report

Merging #100 into master will decrease coverage by 0.08%.
The diff coverage is 87.64%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #100      +/-   ##
==========================================
- Coverage   87.56%   87.47%   -0.09%     
==========================================
  Files          16       17       +1     
  Lines        4222     4256      +34     
==========================================
+ Hits         3697     3723      +26     
- Misses        525      533       +8
Impacted Files Coverage Δ
vtki/container.py 96.58% <100%> (+0.01%) ⬆️
vtki/utilities.py 93.42% <100%> (+0.05%) ⬆️
vtki/examples/examples.py 98.05% <100%> (ø) ⬆️
vtki/__init__.py 97.05% <100%> (+0.08%) ⬆️
vtki/pointset.py 91.17% <100%> (ø) ⬆️
vtki/readers.py 85.52% <85.52%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ecc9356...aa3ad09. Read the comment docs.

@banesullivan banesullivan added enhancement Changes that enhance the library proposed-change Something with regards to the API or internal structure is changing. labels Feb 25, 2019
@banesullivan banesullivan merged commit db9ddb2 into master Feb 25, 2019
@banesullivan banesullivan deleted the readers branch February 26, 2019 23:09
@banesullivan banesullivan added this to the 0.17.0 milestone Mar 4, 2019
@banesullivan banesullivan added the file-formats Issues/questions around file formats and loading data from files label May 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Changes that enhance the library file-formats Issues/questions around file formats and loading data from files proposed-change Something with regards to the API or internal structure is changing.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant