Skip to content
This repository has been archived by the owner on Dec 22, 2021. It is now read-only.

Commit

Permalink
Merge 50eebbc into 1e4a4a1
Browse files Browse the repository at this point in the history
  • Loading branch information
leouieda committed Oct 22, 2014
2 parents 1e4a4a1 + 50eebbc commit dc8234f
Show file tree
Hide file tree
Showing 8 changed files with 467 additions and 0 deletions.
1 change: 1 addition & 0 deletions Makefile
Expand Up @@ -76,6 +76,7 @@ clean:
rm -rvf logo.png cookbook/logo.png
rm -rvf crust2.tar.gz cookbook/crust2.tar.gz
rm -rvf bouguer_alps_egm08.grd cookbook/bouguer_alps_egm08.grd
rm -rvf *.gdf cookbook/*.gdf

clean-docs:
cd doc; make clean
49 changes: 49 additions & 0 deletions cookbook/gravmag_normal_gravity.py
@@ -0,0 +1,49 @@
"""
GravMag: Calculate the gravity disturbance and Bouguer anomaly for Hawaii
"""
from fatiando.gravmag import normal_gravity
from fatiando.vis import mpl
import numpy as np
import urllib

# Download the gravity and topography data
url = 'https://raw.githubusercontent.com/leouieda/geofisica1/master/data/'
urllib.urlretrieve(url + 'eigen-6c3stat-havai.gdf',
filename='eigen-6c3stat-havai.gdf')
urllib.urlretrieve(url + 'etopo1-havai.gdf',
filename='etopo1-havai.gdf')
# Load them with numpy
lon, lat, height, gravity = np.loadtxt('eigen-6c3stat-havai.gdf', skiprows=34,
unpack=True)
topo = np.loadtxt('etopo1-havai.gdf', skiprows=30, usecols=[-1], unpack=True)
shape = (151, 151)
area = (lon.min(), lon.max(), lat.min(), lat.max())

# First, lets calculate the gravity disturbance (e.g., the free-air anomaly)
# We'll do this using the closed form of the normal gravity for the WGS84
# ellipsoid
gamma = normal_gravity.gamma_closed_form(lat, height)
disturbance = gravity - gamma

# Now we can remove the effect of the Bouguer plate to obtain the Bouguer
# anomaly. We'll use the standard densities of 2.67 g.cm^-3 for crust and 1.04
# g.cm^-3 for water.
bouguer = disturbance - normal_gravity.bouguer_plate(topo)

mpl.figure(figsize=(14, 3.5))
bm = mpl.basemap(area, projection='merc')
mpl.subplot(131)
mpl.title('Gravity (mGal)')
mpl.contourf(lon, lat, gravity, shape, 60, cmap=mpl.cm.Reds, basemap=bm)
mpl.colorbar(pad=0)
mpl.subplot(132)
mpl.title('Gravity disturbance (mGal)')
amp = np.abs(disturbance).max()
mpl.contourf(lon, lat, disturbance, shape, 60, cmap=mpl.cm.RdBu_r, basemap=bm,
vmin=-amp, vmax=amp)
mpl.colorbar(pad=0)
mpl.subplot(133)
mpl.title('Bouguer anomaly (mGal)')
mpl.contourf(lon, lat, bouguer, shape, 60, cmap=mpl.cm.Reds, basemap=bm)
mpl.colorbar(pad=0)
mpl.show()
9 changes: 9 additions & 0 deletions doc/api/gravmag.normal_gravity.rst
@@ -0,0 +1,9 @@
.. _fatiando_gravmag_normal_gravity:

Compute normal gravity and reductions (``fatiando.gravmag.normal_gravity``)
===========================================================================


.. automodule:: fatiando.gravmag.normal_gravity
:members:
:show-inheritance:
1 change: 1 addition & 0 deletions doc/api/gravmag.rst
Expand Up @@ -24,3 +24,4 @@ Gravity and magnetics (``fatiando.gravmag``)
gravmag.transform.rst
gravmag.half_sph_shell.rst
gravmag.magdir.rst
gravmag.normal_gravity.rst
4 changes: 4 additions & 0 deletions doc/changelog.rst
Expand Up @@ -10,6 +10,10 @@ Version (future)

**Changes**:

* **New module** :ref:`fatiando.gravmag.normal_gravity
<fatiando_gravmag_normal_gravity>` to calculate normal gravity (the gravity
of reference ellipsoids).
(`PR 133 <https://github.com/fatiando/fatiando/pull/133>`_)
* Using `versioneer <https://github.com/warner/python-versioneer>`__ to manage
version numbers. Access the version number + git commit hash from
``fatiando.__version__``.
Expand Down
2 changes: 2 additions & 0 deletions fatiando/gravmag/__init__.py
Expand Up @@ -37,6 +37,8 @@
The processing modules offer tools to prepare potential field data before or
after modeling.
* :mod:`~fatiando.gravmag.normal_gravity`: Compute normal gravity and
reductions.
* :mod:`~fatiando.gravmag.eqlayer`: Equivalent layer processing
* :mod:`~fatiando.gravmag.transform`: Space domain potential field
transformations, like upward continuation
Expand Down

0 comments on commit dc8234f

Please sign in to comment.