In [ ]:
"""
GravMag: 3D forward modeling of total-field magnetic anomaly using triaxial
ellipsoids (model with induced and remanent magnetization)
"""
# Import the required modules
from fatiando import mesher, gridder, utils
from fatiando.gravmag import ellipsoid_triaxial
from fatiando.vis import mpl

# The local-geomagnetic field
inten,inc, dec = 60000., 30, -15
model = [mesher.EllipsoidTriaxial(-2500.,-2500.,500.,2000.,100.,50.,0.,0.,0., 
                                 {'remanence': [100, 90., 0.],
                                  'k': [0.2, 0.1, 0.05, 0., 90., 90.]}),
        mesher.EllipsoidTriaxial(2500.,2500.,500.,2000.,100.,50.,0.,0.,0., 
                                 {'remanence': [100, 90., 0.],
                                  'k': [0.2, 0.1, 0.05, 0., 90., 90.]})]
# Create a regular grid at 0m height
shape = (200, 200)
area = [-5000, 5000, -5000, 5000]
xp, yp, zp = gridder.regular(area, shape, z=0)
# Calculate the anomaly for a given regional field
tf = ellipsoid_triaxial.tf_c(xp,yp,zp,inten,inc,dec,model)
# Plot
mpl.figure()
mpl.title("Total-field anomaly (nT)")
mpl.axis('scaled')
mpl.contourf(yp, xp, tf, shape, 15)
mpl.colorbar()
mpl.xlabel('East y (km)')
mpl.ylabel('North x (km)')
mpl.m2km()
mpl.show()

In [ ]: