Paraview reading Legacy VTK File

Hi,
I am using Paraview to map a set of x,y,z points. The data is in a .vtr file in the format of vtk legacy file in rectilinear grid. I have attached the file to this email. When I open the .vtr file in Paraview 4.1.0 the reader option ‘Legacy VTK files’ is not an option. How to make the file open as a legacy vtk file if the reader is not an option to open it with?

Welcome !

.vtr file are not the legacy .vtk format.
Please read the following : https://vtk.org/wp-content/uploads/2015/04/file-formats.pdf

You are supposed to read .vtr files using the “VTK Rectilinearg Grid Files” reader.

When I save my .vtr file that is in Notepad and is formatted for .vtk as a .vtk file the ‘Legacy VTK files’ reader is still not an option when I try to open it in Paraview. Do you have a suggestion for how I change my formatting? My file is pasted below as reference. I am just interested in being able to open my file and then contour the data once it is open in Paraview.

#vtk Datafile Version 3.0
Non-uniform Rectilinear - Rectilinear Grid
ASCII
DATASET RECTILINEAR_GRID
DIMENSIONS 2 23 1
X_COORDINATES 2 float
4850.0 4900.0
Y_COORDINATES 23 float
600.0 650.0 700.0 750.0 800.0 850.0 900.0 950.0 1000.0 1050.0 1100.0 1150.0 1200.0 1250.0 1300.0 1350.0 1400.0 1450.0 1500.0 1550.0 1600.0 1650.0 1700.0
Z_COORDINATES 1 float
378.0

this is not a .vtr file. This is a Rectilinear Grid in a VTK Legacy Format. Save as a .vtk file.

(This format is legacy and should not be used when possible)

So would you suggest reformatting it into the .vtr file? Can I reformat it in a program like Notepad? Would my file now be in XML format?

no. In your case, just rename to .vtk.

Thank you. When I enter my data into the .vtk file, each x value has the same 23 y values. Should I repeat the 23 y values under the y coordinates so that there would 46 y values (23 for for each of the 2 x values)? Or does Paraview only need the 23 values inputted once?

Here is a correctly formatted rectilinear grid in the .vtk legacy format:

# vtk DataFile Version 4.2
vtk output
ASCII
DATASET RECTILINEAR_GRID
DIMENSIONS 2 23 1
X_COORDINATES 2 double
-7.5 -7.3906202316 
Y_COORDINATES 23 double
-3 -2.90625 -2.8125 -2.71875 -2.625 -2.53125 -2.4375 -2.34375 -2.25 
-2.15625 -2.0625 -1.96875 -1.875 -1.78125 -1.6875 -1.59375 -1.5 -1.40625 
-1.3125 -1.21875 -1.125 -1.03125 -0.9375 
Z_COORDINATES 1 double
-3

That is very helpful. If I had 5 x coordinates, would I still use ‘double’? Also, if I had another value of x velocity that I wanted Paraview to contour based on, how would I include that in my VTK file?

Hi everyone,
I have two vtk files(velocity and pressure of surface ) in my postprocessing folder and I want to visualize them in paraview but I don’t know which specified tools for each of those file should use for a report. it would be helpful if you could help me.

kind regards,
Arghavan

Please open your own topic.