acroucher / PyTOUGH

A Python library for automating TOUGH2 simulations of subsurface fluid and heat flow
GNU Lesser General Public License v3.0
96 stars 36 forks source link

lst.write_vtk error #16

Closed wyangattud closed 6 years ago

wyangattud commented 6 years ago

When I try to use lst.write_vtk to generate the vtk files, it gives me the following info: AttributeError: 'vtkCommonCorePython.vtkCharArray' object has no attribute 'SetTupleValue'. Does anyone also meet this error?

acroucher commented 6 years ago

Which version of VTK are you using? A few people running recent versions of VTK have reported problems like this- it looks like VTK may have made some changes that are not backwards-compatible. I am running VTK 6.3 here and it is working OK.

wyangattud commented 6 years ago

I am using VTK 8.1.0 now. I will try the old version. Thank you a lot.

labgeothermal commented 6 years ago

I am using python 2.7.14, pytough 1.5.0 and vtk 6.3.0, but still got an error when running 'Hydrostatic 3D Model' in Pytough example, as follow: Traceback (most recent call last): File "tiga.py", line 51, in dat.grid.write_vtk(geo, 'INFILE.vtu') File "C:\Python27\lib\site-packages\t2grids.py", line 551, in write_vtk vtu = geo.get_vtk_grid(arrays, surface_snap) File "C:\Python27\lib\site-packages\mulgrids.py", line 3166, in get_vtk_grid node3d, elt3d = self.grid3d(surface_snap) File "C:\Python27\lib\site-packages\mulgrids.py", line 3085, in grid3d unique_elevations, columns = unique_values(col_surf, surface_snap) File "C:\Python27\lib\site-packages\mulgrids.py", line 3074, in unique_values uniques = asort[d > tol] IndexError: boolean index did not match indexed array along dimension 0; dimension is 2 but corresponding boolean dimension is 1.

acroucher commented 6 years ago

Yes, I think that is a separate issue, and one that has been recently fixed in the PyTOUGH testing branch: https://github.com/acroucher/PyTOUGH/commit/786d8559ce155be45a52bff1609243d74d90b628

Can you try pulling the latest testing branch and see if it fixes your problem?

labgeothermal commented 6 years ago

Yes, it fixes my problem. Thank you very much.

acroucher commented 6 years ago

I think this problem is now fixed by commit cba5177df703365448c643daaacb62851d38502c. It was caused by some changes made in VTK 7.1 (the vtkCharArray SetTupleValues() method was changed to SetTypedTuple()). So the PyTOUGH VTK export should now work for VTK 7.1 and later.