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

Cannot add data to VTK export #242

Closed
baender opened this issue Jun 26, 2020 · 2 comments
Closed

Cannot add data to VTK export #242

baender opened this issue Jun 26, 2020 · 2 comments

Comments

@baender
Copy link

baender commented Jun 26, 2020

Problem description

I use pyGIMLi to calculate ERT inversions. To export the resulting model to VTK I was using the same approach as in BERT.
This worked just fine in a previous version of pyGIMLi (unfortunately I don't know which version it was). I could not find any way to export to VTK other then via paraDomain.

Your environment

Windows 10, 64-bit
Anaconda, Python 3.7.6
pyGIMLi Vversion: 1.1.0+31.g47c8d810
Installed via Conda package

Steps to reproduce

Here is a minimal example with the data from slagdump.ohm.

import pygimli as pg
from pygimli.physics.ert import ERTManager

slagdump = pg.load('slagdump.ohm')
slagdump.set('err', pg.Vector(slagdump.size(), 0.03)) # Inversion does not run without a defined error > 0

ertinv = ERTManager(verbose=True, debug=False)

mesh1 = ertinv.createMesh(slagdump,
                          quality=34, 
                          paraDX=0.5, 
                          paraMaxCellSize=2, 
                          smooth=[1, 10], 
                          paraDepth=0)

ertinv.invert(data = slagdump, mesh = mesh1, lam = 20, zWeight = 1)

ertinv.showModel(ertinv.model)

ertinv.paraDomain.exportVTK('Test.vtk') # creates a .vtk  file without any inversion data, only '_Attribute' and '_Marker'
ertinv.paraDomain.addData('Model', ertinv.model) # manually add the model for exporting
ertinv.paraDomain.haveData('Model') # returns false
ertinv.paraDomain.exportVTK('Test.vtk') # creates a .vtk  file with the same exact content as the previous export (no model)

Expected behavior

I would assume that it still works the same as with a (unfortunately unknown) previous version of pyGIMLi.

Actual behavior

See comments in the last couple of lines

@florian-wagner
Copy link
Member

Hi Daniel,

you can use the ertinv.saveResult("my-results") method, which is more convenient. In the source code of that function, you'll find the new syntax for adding data to the mesh: https://github.com/gimli-org/gimli/blob/dev/pygimli/physics/ert/ert.py#L1083-L1122

Best wishes
Florian

@baender
Copy link
Author

baender commented Jun 26, 2020

Dear Florian,

thanks a lot for this very fast answer!

Kind regards,
Daniel

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

No branches or pull requests

2 participants