I have data on a (x,y) grid with scalar values (time) at each point.

I have used the numpy gradient function and linear interpolation to determine the gradient vector Velocity (Vx,Vy) at each point (See below).

I have achieved this by:

 #LinearTriInterpolator applied to a delaunay triangular mesh
 LTI= LinearTriInterpolator(masked_triang, time_array)

 #Gradient requested at the mesh nodes:
 (Vx, Vy) = LTI.gradient(triang.x, triang.y)

The first image below shows the velocity vectors at each point, and the point labels represent the time value which formed the derivatives (Vx,Vy) Velocity vectors shown at each point with associated time value

The next image shows the resultant scalar value of the derivatives (Vx,Vy) plotted as a colored contour graph with associated node labels.

Derivative scalar plot

So my challenge is:

I need to reverse the process!

Using the use gradient vectors (Vx,Vy) or the resultant scalar value to determine the original Time-Value at that point.

Is this possible?

I was thinking that taking a line derivative between the original point (t=0 at x1,y1) to any point (xi,yi) over the Vx,Vy plane would give me the sum of the velocity components. I could then divide this value by the distance between the two points to get the time taken..

Would this approach work? And if so, which numpy integrate function would be best applied?

enter image description here

An example of my data can be found here [http://www.filedropper.com/calculatearrivaltimefromgradientvalues060820]

Your help would be greatly appreciated

EDIT: Maybe this can explain my problem more simply


  • $\begingroup$ Are you trying to solve $\nabla a = \mathbf{v}$? $\endgroup$ – nicoguaro Aug 6 at 21:31
  • $\begingroup$ @nicoguaro I'm sorry I don't completely understand. But I have the gradient values, but not the original values which formed the gradient.. I've added a simplified drawing above which might explain it better. $\endgroup$ – Morgan Aug 6 at 22:18
  • $\begingroup$ I was asking if you want to find a scalar function from its directional derivatives. That can be written mathematically as the equation. $\endgroup$ – nicoguaro Aug 6 at 22:20
  • $\begingroup$ Yes, I think that is what I'm trying to achieve :) $\endgroup$ – Morgan Aug 6 at 22:23
  • $\begingroup$ Have you checked this question? scicomp.stackexchange.com/q/35322/9667 $\endgroup$ – nicoguaro Aug 7 at 1:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.