[Paraview] ExtractSubset not working well in pvpython
Chukwudi Chukwudozie
cchukw1 at tigers.lsu.edu
Mon Nov 3 16:44:07 EST 2014
So you understand what I'm doing, below is the full script. I added those
lines and now its giving one above the number of points. I have 800 points
but it pints out 801
import numpy as np
import pylab as pl
try: paraview.simple
except: from paraview.simple import *
paraview.simple._DisableFirstRenderCameraReset()
num_plots = 10
time =
['00010','00050','00090','00130','00184','00250','00300','00350','00400','00500']
lims = np.zeros(num_plots)
pl.gca().set_color_cycle(['black', 'green', 'blue',
'yellow','purple','chocolate','gray','brown','cyan','gold'])
nameoffile = 'TEST_nodal'
for i in range(0,num_plots):
pfile = time[i]
nameof_file = nameoffile+'.'+pfile+'.vts'
print nameof_file
paraview.simple._DisableFirstRenderCameraReset()
TEST_nodal_00001_vts = XMLStructuredGridReader(FileName=nameof_file )
TEST_nodal_00001_vts.UpdatePipeline()
TEST_nodal_00001_vts.PointArrayStatus = ['Pressure']
ExtractSubset0 =
ExtractSubset(guiName="ExtractSubset0",IncludeBoundary=0,VOI=[399, 399, 0,
0, 0, 799], SampleRateK=1, SampleRateJ=1, SampleRateI=1)
ExtractSubset0.UpdatePipeline()
data = servermanager.Fetch(ExtractSubset0)
print ExtractSubset0.GetDataInformation().GetNumberOfPoints()
numPoints=data.GetNumberOfPoints()
print numPoints
p = np.zeros(numPoints)
coord = np.zeros((numPoints,3))
for j in range(0,numPoints):
coord[j,:] = np.array(data.GetPoint(j))
p[j]=data.GetPointData().GetArray("Pressure").GetValue(j)
pl.plot(coord[:,2], p,linewidth=2.0)
pl.xlabel('Position Along Length (m)',size = 20)
pl.ylabel('Pore pressure (MPa)', size = 20)
pl.ticklabel_format(axis='y', style='sci', scilimits=(-2,2))
pl.legend(['t = 10 s','t = 50 s','t = 90 s', 't = 130 s', 't = 184 s', 't =
250 s', 't = 300 s', 't = 350', 't = 400 s', 't = 500 s'],'best',loc='upper
left', numpoints=1, prop={'size':16})
pl.savefig('pressures.pdf')
On Mon, Nov 3, 2014 at 9:00 AM, Utkarsh Ayachit <utkarsh.ayachit at kitware.com
> wrote:
> Hi,
>
> I wonder if the problem is with Fetch(). What does the following yeild?
>
> ExtractSubset0.UpdatePipeline()
> print ExtractSubset0.GetDataInformation().GetNumberOfPoints()
>
> Utkarsh
>
> On Thu, Oct 30, 2014 at 5:29 PM, Chukwudi Chukwudozie
> <cchukw1 at tigers.lsu.edu> wrote:
> > Hi,
> >
> > I have a structured grid computational domain of size 800,2,800. I want
> to
> > extract the information along a line and so I do the following in my
> python
> > script.
> >
> > ExtractSubset0 =
> > ExtractSubset(guiName="ExtractSubset0",IncludeBoundary=0,VOI=[399, 399,
> 0,
> > 0, 0, 799], SampleRateK=1, SampleRateJ=1, SampleRateI=1)
> > data = servermanager.Fetch(ExtractSubset0)
> > numPoints=data.GetNumberOfPoints()
> >
> > However, when I plot the information on that line, I see it has only
> > extracted information between 0-399 in the z-coordinate direction. I even
> > printed numPoints to confirm how much information is extracted and I get
> > "numPoints=400". I am using PV 3.98.0.
> >
> > Any help on this will be appreciated.
> >
> >
> >
> >
> > --
> > Chukwudi Chukwudozie
> > cchukw1 at tigers.lsu.edu
> > Craft and Hawkins Department of Petroleum Engineering
> > Louisiana State University
> > Patrick F. Taylor Hall (CEBA)
> > Room 3429
> > Baton Rouge LA, 70803
> > Cell:3373546822
> > Office: 2255786064
> >
> > _______________________________________________
> > 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
> >
> > Follow this link to subscribe/unsubscribe:
> > http://public.kitware.com/mailman/listinfo/paraview
> >
>
--
Chukwudi Chukwudozie
cchukw1 at tigers.lsu.edu
Craft and Hawkins Department of Petroleum Engineering
Louisiana State University
Patrick F. Taylor Hall (CEBA)
Room 3429
Baton Rouge LA, 70803
Cell:3373546822
Office: 2255786064
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20141103/b2918119/attachment.html>
More information about the ParaView
mailing list