# Extract velocity field from streamlines

**URL:** https://discourse.vtk.org/t/extract-velocity-field-from-streamlines/7169
**Category:** Support
**Created:** [November 14, 2021, 2:54pm UTC](https://discourse.vtk.org/t/extract-velocity-field-from-streamlines/7169 "2021-11-14T14:54:22Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Francesco\_Montanaro](https://discourse.vtk.org/user_avatar/discourse.vtk.org/francesco_montanaro/32/4206_2.png) [@Francesco\_Montanaro](https://discourse.vtk.org/u/Francesco_Montanaro)
#### Post date: [November 14, 2021, 2:54pm UTC](https://discourse.vtk.org/t/extract-velocity-field-from-streamlines/7169/1 "2021-11-14T14:54:22Z")

</div>

I have a `Streamtracer` object which contains the streamlines of an `UnstructuredGrid`.  
I need to extract the velocity associated with each point of the streamlines.  
To compute the velocity of the i-th point I was thinking of extracting a set of three points from the original grid surrounding it (maybe using a nearest neighbors algorithm) and then interpolate the value of their velocity.

Here is a figure representing what I’m trying to achieve (The blue points are the ones of the Streamstracer, while the red ones are related to the original grid):

 ![Schermata 2021-11-14 alle 11.30.17](https://discourse.vtk.org/uploads/default/original/2X/e/e33401c833042c18aeade3adc9e071843eefc9a9.png)

The problem with this approach is the computational complexity since the original grid contains hundreds of thousands of points to check.

Using Paraview the same result can be achieved much faster. In fact, Paraview allows to color the streamlines according to the Velocity information.  
Is there a way to achieve the same result using the python vtk library?  
Thank you
