# Vtk format reader

**URL:** https://discourse.paraview.org/t/vtk-format-reader/13675
**Category:** ParaView Support
**Tags:** vtk
**Created:** [January 11, 2024, 1:43pm UTC](https://discourse.paraview.org/t/vtk-format-reader/13675 "2024-01-11T13:43:00Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Mateus\_Ribeiro](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mateus_ribeiro/32/13319_2.png) [@Mateus\_Ribeiro](https://discourse.paraview.org/u/Mateus_Ribeiro)
#### Post date: [January 11, 2024, 1:43pm UTC](https://discourse.paraview.org/t/vtk-format-reader/13675/1 "2024-01-11T13:43:00Z")

</div>

Hi,  
I’m trying to read my first .vtk file, but Paraview says that he can’t find a reader for the file. Guess there is something wrong with my file. Can someone help me with this?

[variavel.vtk](https://discourse.paraview.org/uploads/short-url/rLFeQjp2GivXeQcLAbHy4nuJuyx.vtk) (352.2 KB)

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [January 11, 2024, 1:50pm UTC](https://discourse.paraview.org/t/vtk-format-reader/13675/2 "2024-01-11T13:50:32Z")

</div>

This file is incorrectly formated, how was it written ?

---

<div class="post-metadata">

### Author: ![Mateus\_Ribeiro](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mateus_ribeiro/32/13319_2.png) [@Mateus\_Ribeiro](https://discourse.paraview.org/u/Mateus_Ribeiro)
#### Post date: [January 11, 2024, 1:54pm UTC](https://discourse.paraview.org/t/vtk-format-reader/13675/3 "2024-01-11T13:54:45Z")

</div>

With this FORTRAN 03 subroutine:

```
   subroutine visualplanoXY(var,plano)

  use modvar
  implicit none
  integer ii, jj, kk, plano
  real (kind = 8) x, z, var(nx,ny,nzt)

  ! writes data to be open by paraview
  open (3, file = 'variavel.vtk',status = 'unknown')
  write(3,*)'# vtk DataFile Version 2.0'
  write(3,*)'variavel.vtk'
  write(3,*)'ASCII'
  write(3,*)'DATASET STRUCTURED_GRID'
  write(3,*)'DIMENSIONS',nx,ny
  write(3,*)'POINTS',nx*ny,'float'
  
	do jj = 1, ny
    		do ii = 1, nx
      			x = dble(ii-1) * dx
      			write(3,71) x, y(jj)
    		end do
  	end do

write(3,*)'POINT_DATA',nx*ny
write(3,*)'SCALARS var float 1'
write(3,*)'LOOKUP_TABLE default'
do jj = 1, ny
    	do ii = 1, nx
      		x = dble(ii-1) * dx
      		write(3,72)var(ii,jj,plano)
  	end do
end do

  close (unit = 3)

71 format(2(1x, ES13.6E2))
72 format(1x, ES13.6E2)

```

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [January 11, 2024, 1:57pm UTC](https://discourse.paraview.org/t/vtk-format-reader/13675/4 "2024-01-11T13:57:22Z")

</div>

Looks like you are trying to write 2D data ?

[https://docs.vtk.org/en/latest/design\_documents/VTKFileFormats.html#dataset-format](https://docs.vtk.org/en/latest/design_documents/VTKFileFormats.html#dataset-format)

There is not 2D data in VTK, only 3D.

---

<div class="post-metadata">

### Author: ![Mateus\_Ribeiro](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mateus_ribeiro/32/13319_2.png) [@Mateus\_Ribeiro](https://discourse.paraview.org/u/Mateus_Ribeiro)
#### Post date: [January 11, 2024, 2:05pm UTC](https://discourse.paraview.org/t/vtk-format-reader/13675/5 "2024-01-11T14:05:39Z")

</div>

Was I supossed to add a third column full of zeros for z-axis? I tried this and still don’t work. Thank you for the fast replies.

[variavel.vtk](https://discourse.paraview.org/uploads/short-url/aSD6bGosMDLK9oyMoDYxU8SnLPq.vtk) (464.2 KB)

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [January 11, 2024, 2:07pm UTC](https://discourse.paraview.org/t/vtk-format-reader/13675/6 "2024-01-11T14:07:18Z")

</div>

You need to remove the leading space on each line, like this:

[variavel(2).vtk](https://discourse.paraview.org/uploads/short-url/31KvptBV8hzWuCBLCItS05MUZj2.vtk) (448.2 KB)

---

<div class="post-metadata">

### Author: ![Mateus\_Ribeiro](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mateus_ribeiro/32/13319_2.png) [@Mateus\_Ribeiro](https://discourse.paraview.org/u/Mateus_Ribeiro)
#### Post date: [January 11, 2024, 2:20pm UTC](https://discourse.paraview.org/t/vtk-format-reader/13675/7 "2024-01-11T14:20:30Z")

</div>

It worked now. Thank you very much!! 🙂
