kmaterna / Strain_2D

Strain rate modeling from GNSS velocity fields
MIT License
43 stars 17 forks source link

Bug in strain_on_regular_grid? #22

Closed jlmaurer closed 2 years ago

jlmaurer commented 2 years ago

I think I may have introduced a bug in the function strain_on_regular_grid. The current call to numpy.gradient is as follows:

e11, dV1dx2 = np.gradient(V1, dx, dy)
dV2dx1, e22 = np.gradient(V2, dx, dy)

but I think based on Python indexing (rows, columns, ...) it should really be this:

dV1dx2, e11 = np.gradient(V1, dx, dy)
e22, dV2dx1 = np.gradient(V2, dx, dy)

where dx is column spacing and dy is row spacing. I think geostats and gpsgridder are the only methods affected; however, since the geostats results have seemed fine I'm not sure if I'm missing something. I'm testing now to see if it changes the weird geostats results but ran into an issue with pygmt not working.

jlmaurer commented 2 years ago

Fixing this (#23) results in geostats dilatation that matches expectations, at least in sign: dilatation