Skip to content

vtk export: .vti and .vtr formats (#833), code improvements and fixes#836

Merged
christianlangevin merged 2 commits into
modflowpy:developfrom
etiennebresciani:vtk_exp
Mar 29, 2020
Merged

vtk export: .vti and .vtr formats (#833), code improvements and fixes#836
christianlangevin merged 2 commits into
modflowpy:developfrom
etiennebresciani:vtk_exp

Conversation

@etiennebresciani
Copy link
Copy Markdown
Contributor

I implemented the export of data to ImageData (.vti) or RectilinearGrid (.vtr) formats when possible, instead of always UnstructuredGrid (.vtu), since this can greatly reduce file volume and speed up subsequent operations (e.g. in Paraview). The user can also choose to force an export to a specific format (e.g., .vtu) by using the new parameter vtk_grid_type (by default = 'auto').

I made significant improvements to the vtk export code and fixed a number of issues along the way. These are in fact beneficial regardless of my initial intention. For better readability, I arranged my contribution into two commits: the first one only contains independent code improvements and fixes, and the second one actually contains the new feature. If possible, I think it would be better to keep the two commits.

This PR addresses issue #833 (although in this issue I also mentioned two more new functionalities, but I’d rather keep those for later to facilitate integration).

* Create XmlWriterInterface class and child classes (XmlWriterAscii and XmlWriterBinary), allowing to factorize  lot of code. Namely, merge write() and write_binary(). binary is now a parameter of the Vtk class, consistently with other parameters. In addition, ascii and binary files are now written more consistently. Note: the written files are slightly different than before, but this only concerns minor style with no functionalities being impaired.
* Use more appropriate data types for connectivity, offsets and cell types
* Fix vtk.export_transient and utils.transient2d_export for binary option (it was actually saving in ascii)
* Fix weird file name separators (i.e., "__", " _") in transient cases
* Fix issue with inactive cells not ignored when smoothing : now ignore them (i.e., in extendedDataArray())
* Export ibound as well (it was excluded, but I see no reason why)
* Improve code documentation
* Simplify tests (t050) and make them more robust
* Export data in vtk ImageData (.vti) or RectilinearGrid (.vtr) formats when possible, instead of always UnstructuredGrid (.vtu), since this can greatly reduce file volume and speed up subsequent operations (e.g. in Paraview). The user can also choose to force an export in a specific format (e.g., .vtu) by using the new parameter vtk_grid_type (by default = 'auto')
* Add tests for it to t050
@christianlangevin
Copy link
Copy Markdown

@mwtoews, do you have any idea why we are getting TravisCI failures with the latest version of pyproj? The following command seems to be failing with pyproj version 2.6 on linux. I can't reproduce it on my Mac.

pyproj.Proj('epsg:4326')

@mwtoews
Copy link
Copy Markdown
Contributor

mwtoews commented Mar 29, 2020

@langevin-usgs yes, this is a new regression with pyproj==2.6.0, I'll follow-up when I find the solution.

@christianlangevin
Copy link
Copy Markdown

@etiennebresciani, I looked through all of your changes and think it looks great. Thanks for the awesome contribution.

@christianlangevin christianlangevin merged commit 48c7ef7 into modflowpy:develop Mar 29, 2020
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.

3 participants