# Mapping from csv file to cell center of VTK file

**URL:** https://discourse.paraview.org/t/mapping-from-csv-file-to-cell-center-of-vtk-file/8781
**Category:** ParaView Support
**Created:** [January 14, 2022, 2:48pm UTC](https://discourse.paraview.org/t/mapping-from-csv-file-to-cell-center-of-vtk-file/8781 "2022-01-14T14:48:50Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![bias](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/b/b19c9b/32.png) [@bias](https://discourse.paraview.org/u/bias)
#### Post date: [January 14, 2022, 2:48pm UTC](https://discourse.paraview.org/t/mapping-from-csv-file-to-cell-center-of-vtk-file/8781/1 "2022-01-14T14:48:51Z")

</div>

Hi,  
I think my problem should be relatively easy but I haven’t figured out how to solve it. I have a csv file with data organized as X, Y, Z and a scalar value “Velocity”.

Now I want to open a VTK file and “map” the data from the csv file onto the VTK file. In this case I dont really need an interpolation since I know that the data in the csv file is at the **face** center of the VTK file.

So far I figured out it to do like this:

1. Open the VTK file
2. Open the csv file
3. TableToPoints
4. PointDataSetInterpolator

The problem now is however that with this Paraview will interpolate my data onto vertexes on the VTK file and not on the cell center. How can I solve this problem? Is there a way to convert the VTK file to a “cell centered surface” or something similar and then do the same procedure as I described?

---

<div class="post-metadata">

### Author: ![pavel](https://discourse.paraview.org/user_avatar/discourse.paraview.org/pavel/32/8287_2.png) [@pavel](https://discourse.paraview.org/u/pavel)
#### Post date: [January 14, 2022, 3:06pm UTC](https://discourse.paraview.org/t/mapping-from-csv-file-to-cell-center-of-vtk-file/8781/2 "2022-01-14T15:06:58Z")

</div>

Hi Tobias,

Does it make sense to add new points according to the list of x,y,z coordinates and, after that, apply PointDataSetInterpolator?

Edited: that was a wrong comment.

If it is not possible to map data from one point array to the cell faces centers of another cell array by built-in PV filters, it is possible to do it by programmable filter (or plugin).  
In case of 2D mesh, for each cell:  
based on cell vertices coordinates, find appropriate velocity value from x,y,z,v list and add this velocity value to a new cell data array (‘Velocity’).  
There will be a constant color within the bounds of each face.  
If I understand the problem correctly, in case of 3D mesh, it needs to add new 2D cells for each of faces of initial 3D mesh cells.

Best Regards,  
Pavel

---

<div class="post-metadata">

### Author: ![bias](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/b/b19c9b/32.png) [@bias](https://discourse.paraview.org/u/bias)
#### Post date: [January 20, 2022, 2:21pm UTC](https://discourse.paraview.org/t/mapping-from-csv-file-to-cell-center-of-vtk-file/8781/3 "2022-01-20T14:21:56Z")

</div>

Hi, I don’t think I can do as you suggested, not in a easy way at least. The problem would be to find out the new face center coordinates. Ideally I would like to change the surface so that the points are at the face center instead of vortex center and than I think I could use the “PointDataSetInterpolator” directly on the “new surface”.

---

<div class="post-metadata">

### Author: ![pavel](https://discourse.paraview.org/user_avatar/discourse.paraview.org/pavel/32/8287_2.png) [@pavel](https://discourse.paraview.org/u/pavel)
#### Post date: [January 27, 2022, 3:12pm UTC](https://discourse.paraview.org/t/mapping-from-csv-file-to-cell-center-of-vtk-file/8781/4 "2022-01-27T15:12:05Z")

</div>

Ok. Anyway, if you

> [@bias](#):
>
> would like to change the surface so that the points are at the face center instead of vortex center

you will have another mesh with different topology. What kind of mesh is in your .vtk file? Maybe you can share an example dataset, and we try to use _Python calculator_ filter for starting to solve the problem?
