harmonica icon indicating copy to clipboard operation
harmonica copied to clipboard

WIP Add function to create a tesseroid layer

Open aguspesce opened this issue 3 years ago • 1 comments

Fix #83

aguspesce avatar May 30 '22 22:05 aguspesce

Hello @leouieda and @santisoler I have a little problem with this PR, so I need your wisdom!

I coded the function to calculate a teseroid layer and its gravity. I also created an example using Esaio's topography. When I ran the example, it calculates the teseroid layer, and I think it's done well. But when it calculates the gravity, it returns this error:

 $ python -i examples/forward/tesseroid_layer.py
ZeroDivisionError: division by zero

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/agustina/Github/harmonica/examples/forward/tesseroid_layer.py", line 41, in <module>
    gravity = tesseroids.tesseroid_layer.gravity(grid_coords, field="g_z")
  File "/home/agustina/Github/harmonica/harmonica/forward/tesseroid_layer.py", line 269, in gravity
    return tesseroid_gravity(
  File "/home/agustina/Github/harmonica/harmonica/forward/tesseroid.py", line 174, in tesseroid_gravity
    dispatcher(parallel, density)(
SystemError: CPUDispatcher(<function jit_tesseroid_gravity at 0x7f9a26841670>) returned a result with an error set

I know that I have a zero division, but I don't know where is the problem... It is my code that create wrong the layer or the tesseroid function to calculate the gravity. Please... Ideas, suggestions, something?

aguspesce avatar Aug 10 '22 23:08 aguspesce

Sorry for not replying directly in this PR, @aguspesce. For the record, the zero division error was due to the fact that the forward modelling wasn't ignoring tesseroids with zero volume. You have already fixed it on #339.

How is the status on this PR? Is it ready for review?

santisoler avatar Sep 09 '22 16:09 santisoler

Hello @santisoler. I've working in the test. If you like, you can review the example and the teseroid_layer function

aguspesce avatar Sep 09 '22 19:09 aguspesce

Hello @santisoler. I think that this PR is ready for your review

aguspesce avatar Sep 13 '22 23:09 aguspesce

@santisoler... when you have some time, take a look at the code

aguspesce avatar Sep 27 '22 21:09 aguspesce