Re: [Paraview] VTK Writer

2012-06-19 Thread Sebastien Jourdain
I've just push a fixed in next. You can follow the bug here:

http://www.paraview.org/Bug/view.php?id=13250

Thanks for reporting issues,

Seb

On Tue, May 29, 2012 at 8:46 AM, Sebastien Jourdain
sebastien.jourd...@kitware.com wrote:
 Hum, the GUI XML should be fine. Did you try to add those hint in the
 XML itself to see if that solve the issue or not ?

 Please let us know, as it looks like a bug to me.

 Seb

 On Mon, May 28, 2012 at 5:09 PM, Paul Edwards paul.m.edwa...@gmail.com 
 wrote:
 Sorry, by pqXML, I meant the XML file for the GUI plugin.

 On May 28, 2012 5:55 PM, Sebastien Jourdain
 sebastien.jourd...@kitware.com wrote:

 Hi Paul,

 can you be more explicit in what you mean by:

  I thought the type just went in the pqXML file.

 Thanks,

 Seb

 On Mon, May 28, 2012 at 11:45 AM, Paul Edwards paul.m.edwa...@gmail.com
 wrote:
  I've just noticed that none of my writer plugins are working from the
  GUI.
   They appear but when trying to write I get the following output:
 
  Failed to create writer for:  /path/to/file.mytype
  ERROR: In /ParaView/ParaViewCore/ServerManager/vtkSMWriterFactory.cxx,
  line
  374
  vtkSMWriterFactory (0x8b3d8a0): No matching writer found for extension:
  mytype
 
  Is this intentional and do we need to put in hints for each writer now?
   I
  thought the type just went in the pqXML file.
 
  Thanks,
  Paul
 
  On 10 May 2012 20:40, Yumin Yuan yumin.y...@kitware.com wrote:
 
  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.ayac...@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
   lamtmar...@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.8265) +
   Umean_Y*sin(0.8265)'
   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.8265) +
   Umean_Y*sin(0.8265)'
   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.8265-math.atan((width/2)/(profile*D))
       alpha1=0.8265+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]
      

Re: [Paraview] VTK Writer

2012-05-29 Thread Sebastien Jourdain
Hum, the GUI XML should be fine. Did you try to add those hint in the
XML itself to see if that solve the issue or not ?

Please let us know, as it looks like a bug to me.

Seb

On Mon, May 28, 2012 at 5:09 PM, Paul Edwards paul.m.edwa...@gmail.com wrote:
 Sorry, by pqXML, I meant the XML file for the GUI plugin.

 On May 28, 2012 5:55 PM, Sebastien Jourdain
 sebastien.jourd...@kitware.com wrote:

 Hi Paul,

 can you be more explicit in what you mean by:

  I thought the type just went in the pqXML file.

 Thanks,

 Seb

 On Mon, May 28, 2012 at 11:45 AM, Paul Edwards paul.m.edwa...@gmail.com
 wrote:
  I've just noticed that none of my writer plugins are working from the
  GUI.
   They appear but when trying to write I get the following output:
 
  Failed to create writer for:  /path/to/file.mytype
  ERROR: In /ParaView/ParaViewCore/ServerManager/vtkSMWriterFactory.cxx,
  line
  374
  vtkSMWriterFactory (0x8b3d8a0): No matching writer found for extension:
  mytype
 
  Is this intentional and do we need to put in hints for each writer now?
   I
  thought the type just went in the pqXML file.
 
  Thanks,
  Paul
 
  On 10 May 2012 20:40, Yumin Yuan yumin.y...@kitware.com wrote:
 
  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.ayac...@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
   lamtmar...@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.8265) +
   Umean_Y*sin(0.8265)'
   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.8265) +
   Umean_Y*sin(0.8265)'
   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.8265-math.atan((width/2)/(profile*D))
       alpha1=0.8265+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)):
       

Re: [Paraview] VTK Writer

2012-05-28 Thread Paul Edwards
I've just noticed that none of my writer plugins are working from the GUI.
 They appear but when trying to write I get the following output:

Failed to create writer for:  /path/to/file.mytype
ERROR: In /ParaView/ParaViewCore/ServerManager/vtkSMWriterFactory.cxx, line
374
vtkSMWriterFactory (0x8b3d8a0): No matching writer found for extension:
mytype

Is this intentional and do we need to put in hints for each writer now?  I
thought the type just went in the pqXML file.

Thanks,
Paul

On 10 May 2012 20:40, Yumin Yuan yumin.y...@kitware.com wrote:

 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.ayac...@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 lamtmar...@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.8265) +
 Umean_Y*sin(0.8265)'
  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.8265) +
 Umean_Y*sin(0.8265)'
  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.8265-math.atan((width/2)/(profile*D))
  alpha1=0.8265+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 = 

Re: [Paraview] VTK Writer

2012-05-28 Thread Sebastien Jourdain
Hi Paul,

can you be more explicit in what you mean by:

 I thought the type just went in the pqXML file.

Thanks,

Seb

On Mon, May 28, 2012 at 11:45 AM, Paul Edwards paul.m.edwa...@gmail.com wrote:
 I've just noticed that none of my writer plugins are working from the GUI.
  They appear but when trying to write I get the following output:

 Failed to create writer for:  /path/to/file.mytype
 ERROR: In /ParaView/ParaViewCore/ServerManager/vtkSMWriterFactory.cxx, line
 374
 vtkSMWriterFactory (0x8b3d8a0): No matching writer found for extension:
 mytype

 Is this intentional and do we need to put in hints for each writer now?  I
 thought the type just went in the pqXML file.

 Thanks,
 Paul

 On 10 May 2012 20:40, Yumin Yuan yumin.y...@kitware.com wrote:

 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.ayac...@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 lamtmar...@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.8265) +
  Umean_Y*sin(0.8265)'
  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.8265) +
  Umean_Y*sin(0.8265)'
  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.8265-math.atan((width/2)/(profile*D))
      alpha1=0.8265+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]
 
 
  

Re: [Paraview] VTK Writer

2012-05-28 Thread Paul Edwards
Sorry, by pqXML, I meant the XML file for the GUI plugin.
 On May 28, 2012 5:55 PM, Sebastien Jourdain 
sebastien.jourd...@kitware.com wrote:

 Hi Paul,

 can you be more explicit in what you mean by:

  I thought the type just went in the pqXML file.

 Thanks,

 Seb

 On Mon, May 28, 2012 at 11:45 AM, Paul Edwards paul.m.edwa...@gmail.com
 wrote:
  I've just noticed that none of my writer plugins are working from the
 GUI.
   They appear but when trying to write I get the following output:
 
  Failed to create writer for:  /path/to/file.mytype
  ERROR: In /ParaView/ParaViewCore/ServerManager/vtkSMWriterFactory.cxx,
 line
  374
  vtkSMWriterFactory (0x8b3d8a0): No matching writer found for extension:
  mytype
 
  Is this intentional and do we need to put in hints for each writer now?
  I
  thought the type just went in the pqXML file.
 
  Thanks,
  Paul
 
  On 10 May 2012 20:40, Yumin Yuan yumin.y...@kitware.com wrote:
 
  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.ayac...@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 lamtmar...@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.8265) +
   Umean_Y*sin(0.8265)'
   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.8265) +
   Umean_Y*sin(0.8265)'
   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.8265-math.atan((width/2)/(profile*D))
   alpha1=0.8265+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
   

Re: [Paraview] VTK Writer

2012-05-14 Thread Sebastien Jourdain
Thanks Tony for your feedback.

Here is the bug associated with that topic:
http://www.paraview.org/Bug/view.php?id=13172

On Fri, May 11, 2012 at 7:28 PM, Luis Martinez lamtmar...@hotmail.com wrote:
 Hi all,

 I was able to get it to work in 3.14 by doing:

     PlotOverLine1.UpdatePipeline()

 before creating the writer.

 Thanks,

 Tony



 Date: Fri, 11 May 2012 09:18:29 -0400

 Subject: Re: [Paraview] VTK Writer
 From: utkarsh.ayac...@kitware.com
 To: mmn...@gmail.com
 CC: lamtmar...@hotmail.com; paraview@paraview.org


 There definitely seems to be a bug in the WriterFactory which fails to
 return valid readers when running through Python. We are looking into
 it.

 Utkarsh

 On Thu, May 10, 2012 at 10:38 PM, Mohamad M. Nasr-Azadani
 mmn...@gmail.com wrote:
  Luis,
 
  I had similar problem with some writers.
  It was very strange and sporadic (it occurred both when I used *.vtu and
  *.csv writers).
  I kind of got the feeling that most of the times it appeared when I ran
  PV
  in parallel so I could solve it by running PV in serial mode.
  But as I said, I am not 100% what is going on.
 
  Good luck,
  Mohamad
 
  On Sun, May 6, 2012 at 11:44 AM, Luis Martinez lamtmar...@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.8265) +
  Umean_Y*sin(0.8265)'
  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.8265) +
  Umean_Y*sin(0.8265)'
  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.8265-math.atan((width/2)/(profile*D))
      alpha1=0.8265+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

Re: [Paraview] VTK Writer

2012-05-11 Thread Utkarsh Ayachit
There definitely seems to be a bug in the WriterFactory which fails to
return valid readers when running through Python. We are looking into
it.

Utkarsh

On Thu, May 10, 2012 at 10:38 PM, Mohamad M. Nasr-Azadani
mmn...@gmail.com wrote:
 Luis,

 I had similar problem with some writers.
 It was very strange and sporadic (it occurred both when I used *.vtu and
 *.csv writers).
 I kind of got the feeling that most of the times it appeared when I ran PV
 in parallel so I could solve it by running PV in serial mode.
 But as I said, I am not 100% what is going on.

 Good luck,
 Mohamad

 On Sun, May 6, 2012 at 11:44 AM, Luis Martinez lamtmar...@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.8265) + Umean_Y*sin(0.8265)'
 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.8265) + Umean_Y*sin(0.8265)'
 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.8265-math.atan((width/2)/(profile*D))
     alpha1=0.8265+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 j0:
     x.append((float(line[5])-width/2)/D)
     y.append(float(line[0]))
     for j, line in enumerate(csvreader2):
     if j0:
     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')
     

Re: [Paraview] VTK Writer

2012-05-10 Thread Utkarsh Ayachit
Your script looks reasonable to me. I'll check it out.

Utkarsh

On Sun, May 6, 2012 at 2:44 PM, Luis Martinez lamtmar...@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.8265) + Umean_Y*sin(0.8265)'
 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.8265) + Umean_Y*sin(0.8265)'
 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.8265-math.atan((width/2)/(profile*D))
     alpha1=0.8265+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 j0:
     x.append((float(line[5])-width/2)/D)
     y.append(float(line[0]))
     for j, line in enumerate(csvreader2):
     if j0:
     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 

Re: [Paraview] VTK Writer

2012-05-10 Thread Yumin Yuan
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.ayac...@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 lamtmar...@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.8265) + Umean_Y*sin(0.8265)'
 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.8265) + Umean_Y*sin(0.8265)'
 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.8265-math.atan((width/2)/(profile*D))
     alpha1=0.8265+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 j0:
     x.append((float(line[5])-width/2)/D)
     y.append(float(line[0]))
     for j, line in enumerate(csvreader2):
     if j0:
     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])

 

Re: [Paraview] VTK Writer

2012-05-10 Thread Mohamad M. Nasr-Azadani
Luis,

I had similar problem with some writers.
It was very strange and sporadic (it occurred both when I used *.vtu and
*.csv writers).
I kind of got the feeling that most of the times it appeared when I ran PV
in parallel so I could solve it by running PV in serial mode.
But as I said, I am not 100% what is going on.

Good luck,
Mohamad

On Sun, May 6, 2012 at 11:44 AM, Luis Martinez lamtmar...@hotmail.comwrote:

  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.8265) + Umean_Y*sin(0.8265)'
 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.8265) + Umean_Y*sin(0.8265)'
 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.8265-math.atan((width/2)/(profile*D))
 alpha1=0.8265+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 j0:
 x.append((float(line[5])-width/2)/D)
 y.append(float(line[0]))
 for j, line in enumerate(csvreader2):
 if j0:
 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')