[Paraview] Accessing field data

Berk Geveci berk.geveci at kitware.com
Fri May 26 09:55:24 EDT 2017


Sorry for my late response.

Although there is a way of doing this in ParaView's application level
Python interface, it is not recommended. This is because when ParaView is
run in client-server mode, the application level Python interface runs on
the client whereas the data resides on the server. So you could use the
Programmable Filter with something like this to access the field data:

inputs[0].FieldData

where the pipeline may look like this:

reader -> Programmable Filter

If you are running client only, this would work (not recommended as a
workflow though because of the client-server issue):

from vtk.numpy_interface import dataset_adapter as dsa
reader_vtk = reader.GetClientSideObject()
output = dsa.WrapDataObject(reader_vtk.GetOutput())
field_data = output.FieldData

Best,
-berk


On Mon, May 8, 2017 at 2:34 PM, John Haase <jhaase1 at nd.edu> wrote:

> I managed to hack something together just using python
>
> writer = CreateWriter(path + 'FieldData.csv', reader, Precision=12,
> UseScientificNotation=1, FieldAssociation='Field Data')
> writer.UpdatePipeline()
>
> fname = glob.glob(path + 'FieldData*.csv')
> FieldData = numpy.genfromtxt(fname[0], delimiter=',').transpose()
>
> But it's kind of annoying that I had to leave Paraview to do it.
>
> Regards,
>
> John R. Haase
> jhaase1 at nd.edu
>
> On Mon, May 8, 2017 at 1:27 PM, John Haase <jhaase1 at nd.edu> wrote:
>
>> I was trying to do this via pvpython
>>
>> Regards,
>>
>> John R. Haase
>> jhaase1 at nd.edu
>>
>> On Mon, May 8, 2017 at 12:51 PM, Berk Geveci <berk.geveci at kitware.com>
>> wrote:
>>
>>> Where are you trying to do this? The Python Console/pypython vs Python
>>> Calculator / Programmable Filter?
>>>
>>> Best,
>>> -berk
>>>
>>> On Wed, May 3, 2017 at 5:52 PM, John Haase <jhaase1 at nd.edu> wrote:
>>>
>>>> Hello Paraview,
>>>>
>>>> I have an Exodus II reader, reader.
>>>>
>>>> I'm trying to extract field data 'Full_EmissionCurrent' and
>>>> 'Native_EmissionCurrent'
>>>>
>>>> I tried to extract the data
>>>>
>>>> reader.FieldData['Full_EmissionCurrent']
>>>>
>>>> Array: Full_EmissionCurrent
>>>>
>>>>
>>>> How do I actually get that array?
>>>>
>>>>
>>>> Regards,
>>>>
>>>> John R. Haase
>>>> jhaase1 at nd.edu
>>>>
>>>> _______________________________________________
>>>> Powered by www.kitware.com
>>>>
>>>> Visit other Kitware open-source projects at
>>>> http://www.kitware.com/opensource/opensource.html
>>>>
>>>> Please keep messages on-topic and check the ParaView Wiki at:
>>>> http://paraview.org/Wiki/ParaView
>>>>
>>>> Search the list archives at: http://markmail.org/search/?q=ParaView
>>>>
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://public.kitware.com/mailman/listinfo/paraview
>>>>
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20170526/2b36988b/attachment.html>


More information about the ParaView mailing list