<div dir="ltr">Dean,<div><br></div><div>Current numpy support in VTK doesn't include string arrays, You can overcome that as follows:</div><div><br></div><div>colNames = [ 'simulation', 'v0 (m/s)', 'k (%)' ]<br></div><div>col0     = [ 'm01-sim001', 'm01-sim002', 'm02-sim001' ] <br></div><div>...</div><div>strArray = vtk.vtkStringArray()</div><div>strArray.SetName(colNames[0])<br></div><div>strArray.SetNumberOfTuples(len(col0))</div><div>for i in range(len(col0)):</div><div>    strArray.SetValue(i, col0[i])</div><div>output.RowData.AddArray(strArray)</div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 1, 2016 at 9:46 PM, Dean Neumann <span dir="ltr"><<a href="mailto:dwneumann@gmail.com" target="_blank">dwneumann@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I am trying to write a python programmable filter which calculates statistics across multiple input datasets and outputs those as a vtkTable.<div><br></div><div>All is ok for numeric values.   But I can't seem to get any approach to work for outputting a vtkTable column of string values.   </div><div>Using numpy_interface/dataset_adapter.py is the cleanest approach I've yet tried for appending  columns of numeric values to an output dataset of type vtkTable, but it raises the following error on string-valued arrays:</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><span style="color:rgb(128,0,0);font-family:Courier;font-size:8.25pt">Traceback (most recent call last):</span> </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><span style="color:rgb(128,0,0);font-family:Courier;font-size:8.25pt">File "<string>", line 29, in <module></span> </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><span style="color:rgb(128,0,0);font-family:Courier;font-size:8.25pt">File "<string>", line 14, in RequestData</span> </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><span style="color:rgb(128,0,0);font-family:Courier;font-size:8.25pt">File "C:\Program Files\ParaView\lib\paraview-5.0\site-packages\vtk\numpy_interface\dataset_adapter.py", line 648, in append</span> </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><span style="color:rgb(128,0,0);font-family:Courier;font-size:8.25pt">narray = narray * numpy.ones(arrLength)</span> </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><span style="color:rgb(128,0,0);font-family:Courier;font-size:8.25pt">TypeError: only integer arrays with one element can be converted to an index</span></blockquote>
<p style="margin:0px;font-family:Courier;font-size:8.25pt;color:rgb(128,0,0)"><br></p><p style="margin:0px;font-family:Courier;font-size:8.25pt;color:rgb(128,0,0)">Can someone please post an example python programmable filter that outputs a vtkTable which includes a column of string valued data?   I have attached a minimal script which reproduces the problem.</p><p style="margin:0px;font-family:Courier;font-size:8.25pt;color:rgb(128,0,0)"><br></p><p style="margin:0px;font-family:Courier;font-size:8.25pt;color:rgb(128,0,0)">Thanks....</p><span class="HOEnZb"><font color="#888888"><p style="margin:0px;font-family:Courier;font-size:8.25pt;color:rgb(128,0,0)">Dean Neumann</p></font></span></div>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" rel="noreferrer" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=ParaView" rel="noreferrer" target="_blank">http://markmail.org/search/?q=ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/paraview" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/paraview</a><br>
<br></blockquote></div><br></div>