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

Merge magnetic forward functions into a single one #447

Closed santisoler closed 7 months ago

santisoler commented 7 months ago

Description of the desired feature:

Having two functions (prism_magnetic and prism_magnetic_component) for forward modelling magnetic fields of prisms (and dipoles) is not the best. It's somewhat confusing and also it breaks the design we already have for the gravity forward functions.

We should merge them together, having a single magnetic forward function for prisms (and a single magnetic forward function for dipoles) that can compute a single component or the three components.

The new merged function should keep the name of the first one (prism_magnetic and dipole_magnetic) and should ask for a required field argument. This field argument should be able to take:

field
b_e for the easting component of the magnetic vector
b_n for the northing component of the magnetic vector
b_u for the upward component of the magnetic vector
b for the three components of the magnetic vector (returned as a tuple)

In the future, this function could be expanded to magnetic gradiometry fields:

field
b_ee for the easting-easting component of the magnetic vector
b_nn for the northing-northing component of the magnetic vector
b_uu for the upward-upward component of the magnetic vector
b_en for the easting-northing component of the magnetic vector
b_eu for the easting-upward component of the magnetic vector
b_nu for the northing-upward component of the magnetic vector

Are you willing to help implement and maintain this feature?

Yes! But anyone wanting to tackle this is more than welcomed!

We should work on this before the next release, so we don't release the new magnetic functions with an interface that will be deprecated. Probably it would be easier to tackle this at the same time as #446