Enhancement: Field data export#17
Enhancement: Field data export#17renefritze merged 21 commits intopyscience-projects:masterfrom MuellerSeb:field_data
Conversation
…ove ref to non-existing routine (64bit)
- removes EOL'ed python versions - switches Travis's base image to the latest (ubuntu bionic)
|
Thank you for the contribution @MuellerSeb ! I'm having a little trouble discovering the functional changes in between the formatting ones. Can you help me with that? I've also update the CI setup in #18 just now, if you rebase on master now, travis can work again. |
MuellerSeb
left a comment
There was a problem hiding this comment.
Here I pointed out the substantial changes. Most of them are related to field data.
|
|
||
| point_data = {"test_pd": np.array([1, 2, 3, 4, 5, 6])} | ||
| cell_data = {"test_cd": np.array([1, 2, 3])} | ||
| field_data = {"test_fd": np.array([1.0, 2.0])} |
There was a problem hiding this comment.
Here I added field data to the grid.
| cell_types=ctype, | ||
| cellData=cell_data, | ||
| pointData=point_data, | ||
| fieldData=field_data, |
There was a problem hiding this comment.
This field data can now simply be added to the call of the export functions.
| # Helper functions | ||
| # ================================= | ||
| def _addDataToFile(vtkFile, cellData, pointData): | ||
| def _addDataToFile(vtkFile, cellData, pointData, fieldData=None): |
There was a problem hiding this comment.
Here you can now pass field data to create a corresponding section.
| def _appendDataToFile(vtkFile, cellData, pointData): | ||
| # Field data | ||
| # https://www.visitusers.org/index.php?title=Time_and_Cycle_in_VTK_files#XML_VTK_files | ||
| if fieldData: |
There was a problem hiding this comment.
Field data has no attributes, so just a section is created.
| vtkFile.closeData("Field") | ||
|
|
||
|
|
||
| def _appendDataToFile(vtkFile, cellData, pointData, fieldData=None): |
There was a problem hiding this comment.
Here we can now create DataSets for field data.
| cell_types, | ||
| cellData=None, | ||
| pointData=None, | ||
| fieldData=None, |
There was a problem hiding this comment.
Added fieldData keyword to unstructuredGridToVTK
| npilars=16, | ||
| cellData=None, | ||
| pointData=None, | ||
| fieldData=None, |
There was a problem hiding this comment.
Added fieldData keyword to cylinderToVTK
| The default is False. | ||
| """ | ||
|
|
||
| def __init__(self, filepath, ftype): |
There was a problem hiding this comment.
removed the unused largeFile keyword.
| VtkFile | ||
| This VtkFile to allow chained calls. | ||
| """ | ||
| self.xml.openElement(nodeType + "Data") |
There was a problem hiding this comment.
This creates the FieldData element, when nodeType="Field"
| if self.largeFile == False: | ||
| writeBlockSize(self.xml.stream, block_size) | ||
| else: | ||
| writeBlockSize64Bit(self.xml.stream, block_size) |
There was a problem hiding this comment.
This routine did not exists.
…ove ref to non-existing routine (64bit)
I did a review, pointing out the essential changes. I also rebased and travis succeeded. |
|
Great! Thanks. Those changes look good to me. While I do not mind the style changes personally, lets see if @somada141 or @xylar have strong opinions. |
xylar
left a comment
There was a problem hiding this comment.
I like the updated formatting. It might be hard to merge changes from Paulo Herrera's version but I don't think we expect much from there.
|
Cool. Is @somada141 still active on GitHub? |
Indeed. There hasn't been anything in over a year. We can always just run black on the remote too before a hypothetical merge though.
Let's wait till monday with the merge in either way. |
|
Thank you again @MuellerSeb, I'll try to prepare a new release today. |
|
@renefritze : maybe we could address #19 first, before releasing a new version. |
This PR adresses #15. In addition I made some corrections in the code:
writeBlockSize64BitlargeFileattribute formVtkFileval != Nonetoval is not None