How to calculate gradient of data on non-orthogonal ordered grid?
I have a grid of xy-coordinates that I generate using np.meshgrid
. The spacing in x-direction is constant, the y-coordinates are scaled, as a function of x. In this specific case, this results in a cloud of points that lie on a trapezoid, with a side length of 2 on the left and 1 on the right side. I have a function f(x, y)
, and I want to get the gradient of that function in y-direction and in the direction of each row of points. How can I use np.gradient
with xy-arguments to do this? I find the documentation somewhat confusing.
How to calculate gradient of data on non-orthogonal ordered grid?
I have a grid of xy-coordinates that I generate using np.meshgrid
. The spacing in x-direction is constant, the y-coordinates are scaled, as a function of x. In this specific case, this results in a cloud of points that lie on a trapezoid, with a side length of 2 on the left and 1 on the right side. I have a function f(x, y)
, and I want to get the gradient of that function in y-direction and in the direction of each row of points. How can I use np.gradient
with xy-arguments to do this? I find the documentation somewhat confusing.
Why my np.gradient calculation in R^2 doesn’t fit with the analytical gradient calculation?
I’m trying to compute a gradient on a map using np.gradient
, but I’m encountering issues. To simplify my problem I am trying on an analytical function