<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>
Hi all,<br><br>I was able to get it to work in 3.14 by doing:<br><br> PlotOverLine1.UpdatePipeline()<br><br>before creating the writer. <br><br>Thanks,<br><br>Tony<br><br><br><br><div><div id="SkyDrivePlaceholder"></div>> Date: Fri, 11 May 2012 09:18:29 -0400<br>> Subject: Re: [Paraview] VTK Writer<br>> From: utkarsh.ayachit@kitware.com<br>> To: mmnasr@gmail.com<br>> CC: lamtmartos@hotmail.com; paraview@paraview.org<br>> <br>> There definitely seems to be a bug in the WriterFactory which fails to<br>> return valid readers when running through Python. We are looking into<br>> it.<br>> <br>> Utkarsh<br>> <br>> On Thu, May 10, 2012 at 10:38 PM, Mohamad M. Nasr-Azadani<br>> <mmnasr@gmail.com> wrote:<br>> > Luis,<br>> ><br>> > I had similar problem with some writers.<br>> > It was very strange and sporadic (it occurred both when I used *.vtu and<br>> > *.csv writers).<br>> > I kind of got the feeling that most of the times it appeared when I ran PV<br>> > in parallel so I could solve it by running PV in serial mode.<br>> > But as I said, I am not 100% what is going on.<br>> ><br>> > Good luck,<br>> > Mohamad<br>> ><br>> > On Sun, May 6, 2012 at 11:44 AM, Luis Martinez <lamtmartos@hotmail.com><br>> > wrote:<br>> >><br>> >> Hi all,<br>> >><br>> >> I have a pvbatch script that worked in version 3.12. It uses plot over<br>> >> line and writes out CSV data. Now I get the following error in version<br>> >> 3.14:<br>> >><br>> >> Is this a bug or am I supposed to call the writer differently in 3.14?<br>> >><br>> >> Thanks!<br>> >><br>> >> Tony<br>> >><br>> >><br>> >><br>> >> ERROR: In<br>> >> /build/buildd/paraview-3.14.1/ParaViewCore/ServerManager/vtkSMWriterFactory.cxx,<br>> >> line 374<br>> >> vtkSMWriterFactory (0x17ee360): No matching writer found for extension:<br>> >> csv<br>> >><br>> >> Traceback (most recent call last):<br>> >> File "wakeProfilesAllTurbines.py", line 65, in <module><br>> >> writer.FieldAssociation = "Points"<br>> >> AttributeError: 'NoneType' object has no attribute 'FieldAssociation'<br>> >><br>> >><br>> >><br>> >><br>> >> Here is the script Im using:<br>> >><br>> >><br>> >><br>> >> try: paraview.simple<br>> >> except: from paraview.simple import *<br>> >> paraview.simple._DisableFirstRenderCameraReset()<br>> >> import os<br>> >> import math<br>> >> import matplotlib as mpl<br>> >> mpl.use('Agg')<br>> >> import matplotlib.pyplot as plt<br>> >> import csv<br>> >> from scipy.integrate import trapz<br>> >> # Current location<br>> >> directory=os.getcwd()<br>> >> if not os.path.exists('./wakeProfiles/plots/'):<br>> >> os.makedirs('./wakeProfiles/plots/')<br>> >> # Rotor Diameter<br>> >> D=93<br>> >> width=D*1.5<br>> >> profiles=[0.125,0.25,0.5,0.75,1,2,3,4]<br>> >> layout=open('./layout.dat')<br>> >> Umean_slice_0_vtk = LegacyVTKReader(<br>> >> FileNames=[directory+'/../ADM/sliceDataADM/12746.8908019/Umean_slice_0.vtk']<br>> >> )<br>> >> Umean_slice_1_vtk = LegacyVTKReader(<br>> >> FileNames=[directory+'/../ALM/sliceDataALM/12771/Umean_slice_0.vtk'] )<br>> >> SetActiveSource(Umean_slice_0_vtk)<br>> >> CellDatatoPointData1 = CellDatatoPointData()<br>> >> SetActiveSource(CellDatatoPointData1)<br>> >> Calculator1 = Calculator()<br>> >> Calculator1.AttributeMode = 'point_data'<br>> >> Calculator1.Function = 'Umean_X*cos(0.84444265) + Umean_Y*sin(0.84444265)'<br>> >> Calculator1.ResultArrayName = 'U_row'<br>> >> SetActiveSource(Umean_slice_1_vtk)<br>> >> CellDatatoPointData2 = CellDatatoPointData()<br>> >> SetActiveSource(CellDatatoPointData2)<br>> >> Calculator2 = Calculator()<br>> >> Calculator2.AttributeMode = 'point_data'<br>> >> Calculator2.Function = 'Umean_X*cos(0.84444265) + Umean_Y*sin(0.84444265)'<br>> >> Calculator2.ResultArrayName = 'U_row'<br>> >> for i, turbine in enumerate(layout):<br>> >> for profile in profiles:<br>> >> SetActiveSource(Calculator1)<br>> >> PlotOverLine1 = PlotOverLine( Source="High Resolution Line Source"<br>> >> )<br>> >> PlotOverLine1.Source.Resolution = 100<br>> >> alpha0=0.84444265-math.atan((width/2)/(profile*D))<br>> >> alpha1=0.84444265+math.atan((width/2)/(profile*D))<br>> >> L=math.sqrt((D*profile)**2+(width/2)**2)<br>> >> x0=float(turbine.split()[0])+L*math.cos(alpha0)<br>> >> y0=float(turbine.split()[1])+L*math.sin(alpha0)<br>> >> x1=float(turbine.split()[0])+L*math.cos(alpha1)<br>> >> y1=float(turbine.split()[1])+L*math.sin(alpha1)<br>> >> PlotOverLine1.Source.Point1 = [x0, y0, 65.0]<br>> >> PlotOverLine1.Source.Point2 = [x1, y1, 65.0]<br>> >> if not os.path.exists('./wakeProfiles/'+str(profile)):<br>> >> os.makedirs('./wakeProfiles/'+str(profile))<br>> >> if not os.path.exists('./wakeProfiles/plots/'+str(profile)):<br>> >> os.makedirs('./wakeProfiles/plots/'+str(profile))<br>> >><br>> >> nameADM=directory+'/wakeProfiles/'+str(profile)+'/ADM'+'turbine'+str(i+1)+'.csv'<br>> >> writer = CreateWriter(nameADM, PlotOverLine1)<br>> >> writer.FieldAssociation = "Points"<br>> >> writer.UpdatePipeline()<br>> >> del writer<br>> >> SetActiveSource(Calculator2)<br>> >> PlotOverLine2 = PlotOverLine( Source="High Resolution Line Source"<br>> >> )<br>> >> PlotOverLine2.Source.Resolution = 100<br>> >> PlotOverLine2.Source.Point1 = [x0, y0, 65.0]<br>> >> PlotOverLine2.Source.Point2 = [x1, y1, 65.0]<br>> >><br>> >> nameALM=directory+'/wakeProfiles/'+str(profile)+'/ALM'+'turbine'+str(i+1)+'.csv'<br>> >> writer = CreateWriter(nameALM, PlotOverLine2)<br>> >> writer.FieldAssociation = "Points"<br>> >> writer.UpdatePipeline()<br>> >> del writer<br>> >> csvreader1 = csv.reader(open(nameADM,'rb'))<br>> >> csvreader2 = csv.reader(open(nameALM,'rb'))<br>> >> x,y,x1,y1=[],[],[],[]<br>> >> for j, line in enumerate(csvreader1):<br>> >> if j>0:<br>> >> x.append((float(line[5])-width/2)/D)<br>> >> y.append(float(line[0]))<br>> >> for j, line in enumerate(csvreader2):<br>> >> if j>0:<br>> >> x1.append((float(line[5])-width/2)/D)<br>> >> y1.append(float(line[0]))<br>> >> plt.plot(x,y,'-',label='ADM',color='black')<br>> >> plt.plot(x1,y1,'--',label='ALM',color='black')<br>> >> plt.xlabel('Distance')<br>> >> plt.ylabel(r'$U$ (m/s)')<br>> >> plt.legend(loc='best')<br>> >> plt.ylim([2,10])<br>> >><br>> >> plt.savefig('./wakeProfiles/plots/'+str(profile)+'/turbine'+str(i+1)+'.eps')<br>> >><br>> >> plt.savefig('./wakeProfiles/plots/'+str(profile)+'/turbine'+str(i+1)+'.png')<br>> >> plt.clf()<br>> >> del x,y,x1,y1,csvreader1,csvreader2<br>> >><br>> >><br>> >><br>> >><br>> >> _______________________________________________<br>> >> Powered by www.kitware.com<br>> >><br>> >> Visit other Kitware open-source projects at<br>> >> http://www.kitware.com/opensource/opensource.html<br>> >><br>> >> Please keep messages on-topic and check the ParaView Wiki at:<br>> >> http://paraview.org/Wiki/ParaView<br>> >><br>> >> Follow this link to subscribe/unsubscribe:<br>> >> http://www.paraview.org/mailman/listinfo/paraview<br>> >><br>> ><br>> ><br>> > _______________________________________________<br>> > Powered by www.kitware.com<br>> ><br>> > Visit other Kitware open-source projects at<br>> > http://www.kitware.com/opensource/opensource.html<br>> ><br>> > Please keep messages on-topic and check the ParaView Wiki at:<br>> > http://paraview.org/Wiki/ParaView<br>> ><br>> > Follow this link to subscribe/unsubscribe:<br>> > http://www.paraview.org/mailman/listinfo/paraview<br>> ><br></div>                                            </div></body>
</html>