I output my data to .vtu with vtkXMLUnstructuredGridWriter.
However, the vtu file always has “InformationKey”. I don’t want to output this information.
the vtu file shown as:
<?xml version="1.0"?>
<VTKFile type="UnstructuredGrid" version="0.1" byte_order="LittleEndian" header_type="UInt32" compressor="vtkZLibDataCompressor">
<UnstructuredGrid>
<Piece NumberOfPoints="6" NumberOfCells="0">
<PointData>
<DataArray type="Int32" Name="pressure" format="ascii" RangeMin="0" RangeMax="5">
0 1 2 3 4 5
</DataArray>
</PointData>
<CellData>
</CellData>
<Points>
<DataArray type="Float32" Name="Points" NumberOfComponents="3" format="ascii" RangeMin="0" RangeMax="1.1661903912355949">
0 0 0 1 0 0
0 1 0 0 0 1
1 0 0.4000000059604645 0 1 0.6000000238418579
<InformationKey name="L2_NORM_RANGE" location="vtkDataArray" length="2">
<Value index="0">
0
</Value>
<Value index="1">
1.1661903912
</Value>
</InformationKey>
</DataArray>
</Points>
<Cells>
<DataArray type="Int64" Name="connectivity" format="ascii" RangeMin="1e+299" RangeMax="-1e+299">
</DataArray>
<DataArray type="Int64" Name="offsets" format="ascii" RangeMin="1e+299" RangeMax="-1e+299">
</DataArray>
<DataArray type="UInt8" Name="types" format="ascii" RangeMin="1e+299" RangeMax="-1e+299">
</DataArray>
</Cells>
</Piece>
</UnstructuredGrid>
</VTKFile>
from vtkmodules.vtkIOXML import vtkXMLDataSetWriter
from vtkmodules.vtkCommonCore import vtkPoints
import vtkmodules
from vtkmodules.vtkCommonCore import *
from vtkmodules.util import numpy_support
import numpy
if __name__ == '__main__':
position = vtkPoints()
position.SetDataType(VTK_FLOAT)
position.InsertNextPoint(0, 0, 0)
position.InsertNextPoint(1, 0, 0)
position.InsertNextPoint(0, 1, 0)
position.InsertNextPoint(0, 0, 1)
position.InsertNextPoint(1, 0, .4)
position.InsertNextPoint(0, 1, .6)
grid = vtkmodules.vtkCommonDataModel.vtkUnstructuredGrid()
grid.SetPoints(position)
data = numpy.arange(0, 6, 1)
data = numpy_support.numpy_to_vtk(data)
data.SetName("pressure")
grid.GetPointData().AddArray(data)
writer = vtkmodules.vtkIOXML.vtkXMLUnstructuredGridWriter()
#writer.SetDataModeToAppended()
writer.SetDataMode(writer.Ascii)
writer.SetFileName('a.vtu')
writer.SetInputData(grid)
writer.Write()