[Paraview] VTK Writer
Yumin Yuan
yumin.yuan at kitware.com
Thu May 10 15:40:35 EDT 2012
Is this your own csv writer? if yes, did you have hints for the writer
in your xml config file
</WriterProxy>
......
<Hints>
<WriterFactory extensions="csv"
file_description="my csv writer"/>
</Hints>
</WriterProxy>
This is something I found out that I have to do for my writer plugin with 3.14.
Yumin
On Thu, May 10, 2012 at 2:14 PM, Utkarsh Ayachit
<utkarsh.ayachit at kitware.com> wrote:
> Your script looks reasonable to me. I'll check it out.
>
> Utkarsh
>
> On Sun, May 6, 2012 at 2:44 PM, Luis Martinez <lamtmartos at hotmail.com> wrote:
>> Hi all,
>>
>> I have a pvbatch script that worked in version 3.12. It uses plot over line
>> and writes out CSV data. Now I get the following error in version 3.14:
>>
>> Is this a bug or am I supposed to call the writer differently in 3.14?
>>
>> Thanks!
>>
>> Tony
>>
>>
>>
>> ERROR: In
>> /build/buildd/paraview-3.14.1/ParaViewCore/ServerManager/vtkSMWriterFactory.cxx,
>> line 374
>> vtkSMWriterFactory (0x17ee360): No matching writer found for extension: csv
>>
>> Traceback (most recent call last):
>> File "wakeProfilesAllTurbines.py", line 65, in <module>
>> writer.FieldAssociation = "Points"
>> AttributeError: 'NoneType' object has no attribute 'FieldAssociation'
>>
>>
>>
>>
>> Here is the script Im using:
>>
>>
>>
>> try: paraview.simple
>> except: from paraview.simple import *
>> paraview.simple._DisableFirstRenderCameraReset()
>> import os
>> import math
>> import matplotlib as mpl
>> mpl.use('Agg')
>> import matplotlib.pyplot as plt
>> import csv
>> from scipy.integrate import trapz
>> # Current location
>> directory=os.getcwd()
>> if not os.path.exists('./wakeProfiles/plots/'):
>> os.makedirs('./wakeProfiles/plots/')
>> # Rotor Diameter
>> D=93
>> width=D*1.5
>> profiles=[0.125,0.25,0.5,0.75,1,2,3,4]
>> layout=open('./layout.dat')
>> Umean_slice_0_vtk = LegacyVTKReader(
>> FileNames=[directory+'/../ADM/sliceDataADM/12746.8908019/Umean_slice_0.vtk']
>> )
>> Umean_slice_1_vtk = LegacyVTKReader(
>> FileNames=[directory+'/../ALM/sliceDataALM/12771/Umean_slice_0.vtk'] )
>> SetActiveSource(Umean_slice_0_vtk)
>> CellDatatoPointData1 = CellDatatoPointData()
>> SetActiveSource(CellDatatoPointData1)
>> Calculator1 = Calculator()
>> Calculator1.AttributeMode = 'point_data'
>> Calculator1.Function = 'Umean_X*cos(0.84444265) + Umean_Y*sin(0.84444265)'
>> Calculator1.ResultArrayName = 'U_row'
>> SetActiveSource(Umean_slice_1_vtk)
>> CellDatatoPointData2 = CellDatatoPointData()
>> SetActiveSource(CellDatatoPointData2)
>> Calculator2 = Calculator()
>> Calculator2.AttributeMode = 'point_data'
>> Calculator2.Function = 'Umean_X*cos(0.84444265) + Umean_Y*sin(0.84444265)'
>> Calculator2.ResultArrayName = 'U_row'
>> for i, turbine in enumerate(layout):
>> for profile in profiles:
>> SetActiveSource(Calculator1)
>> PlotOverLine1 = PlotOverLine( Source="High Resolution Line Source" )
>> PlotOverLine1.Source.Resolution = 100
>> alpha0=0.84444265-math.atan((width/2)/(profile*D))
>> alpha1=0.84444265+math.atan((width/2)/(profile*D))
>> L=math.sqrt((D*profile)**2+(width/2)**2)
>> x0=float(turbine.split()[0])+L*math.cos(alpha0)
>> y0=float(turbine.split()[1])+L*math.sin(alpha0)
>> x1=float(turbine.split()[0])+L*math.cos(alpha1)
>> y1=float(turbine.split()[1])+L*math.sin(alpha1)
>> PlotOverLine1.Source.Point1 = [x0, y0, 65.0]
>> PlotOverLine1.Source.Point2 = [x1, y1, 65.0]
>> if not os.path.exists('./wakeProfiles/'+str(profile)):
>> os.makedirs('./wakeProfiles/'+str(profile))
>> if not os.path.exists('./wakeProfiles/plots/'+str(profile)):
>> os.makedirs('./wakeProfiles/plots/'+str(profile))
>>
>> nameADM=directory+'/wakeProfiles/'+str(profile)+'/ADM'+'turbine'+str(i+1)+'.csv'
>> writer = CreateWriter(nameADM, PlotOverLine1)
>> writer.FieldAssociation = "Points"
>> writer.UpdatePipeline()
>> del writer
>> SetActiveSource(Calculator2)
>> PlotOverLine2 = PlotOverLine( Source="High Resolution Line Source" )
>> PlotOverLine2.Source.Resolution = 100
>> PlotOverLine2.Source.Point1 = [x0, y0, 65.0]
>> PlotOverLine2.Source.Point2 = [x1, y1, 65.0]
>>
>> nameALM=directory+'/wakeProfiles/'+str(profile)+'/ALM'+'turbine'+str(i+1)+'.csv'
>> writer = CreateWriter(nameALM, PlotOverLine2)
>> writer.FieldAssociation = "Points"
>> writer.UpdatePipeline()
>> del writer
>> csvreader1 = csv.reader(open(nameADM,'rb'))
>> csvreader2 = csv.reader(open(nameALM,'rb'))
>> x,y,x1,y1=[],[],[],[]
>> for j, line in enumerate(csvreader1):
>> if j>0:
>> x.append((float(line[5])-width/2)/D)
>> y.append(float(line[0]))
>> for j, line in enumerate(csvreader2):
>> if j>0:
>> x1.append((float(line[5])-width/2)/D)
>> y1.append(float(line[0]))
>> plt.plot(x,y,'-',label='ADM',color='black')
>> plt.plot(x1,y1,'--',label='ALM',color='black')
>> plt.xlabel('Distance')
>> plt.ylabel(r'$U$ (m/s)')
>> plt.legend(loc='best')
>> plt.ylim([2,10])
>>
>> plt.savefig('./wakeProfiles/plots/'+str(profile)+'/turbine'+str(i+1)+'.eps')
>>
>> plt.savefig('./wakeProfiles/plots/'+str(profile)+'/turbine'+str(i+1)+'.png')
>> plt.clf()
>> del x,y,x1,y1,csvreader1,csvreader2
>>
>>
>>
>>
>> _______________________________________________
>> 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://www.paraview.org/mailman/listinfo/paraview
>>
> _______________________________________________
> 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://www.paraview.org/mailman/listinfo/paraview
More information about the ParaView
mailing list