fatiando / harmonica

Forward modeling, inversion, and processing gravity and magnetic data
https://www.fatiando.org/harmonica
BSD 3-Clause "New" or "Revised" License
208 stars 68 forks source link

Add a finite-difference upward derivative #441

Open leouieda opened 9 months ago

leouieda commented 9 months ago

The upward_derivative function gains a method argument that defaults to finite-diff. The way this works is by upward and downward continuing the grid by half of the average grid spacing and then calculating a central difference approximation for the derivative. An advantage of this method is a lower sensitivity to noise than the FFT-based one. Even though the continuation is FFT-based, it's not very sensitive to high-frequency noise.

leouieda commented 9 months ago

Trying this out. We've had good experiences with it in our magnetic microscopy paper. This was much better than the FFT-based one, particularly for Euler Deconvolution where the quality of the upward derivative is very important.

Implemented a test but it's still failing. Need to see if this is something I'm doing wrong in the code of if the results aren't as good as I thought.

santisoler commented 6 months ago

@leouieda I think this PR just needs some little work to be ready, and I think it would be great to have it in the next release of Harmonica. Is that possible? What do you think?

leouieda commented 6 months ago

@santisoler not sure I'll be able to finish this in time. I'll try but don't let this be a bottleneck for a release.

RichardScottOZ commented 6 months ago

Much better in what sense for the layperson Leo?

leouieda commented 6 months ago

In the paper we were writing, it was the difference between getting completely wrong depth from Euler deconvolution and getting the correct ones. But now that I think about it, our data didn't have a lot of high frequency noise so maybe that's what's making it not so good in this case.