.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/gravity_disturbance.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_gallery_gravity_disturbance.py: Gravity Disturbances ==================== Gravity disturbances are the differences between the measured gravity and a reference (normal) gravity produced by an ellipsoid. The disturbances are what allows geoscientists to infer the internal structure of the Earth. We'll use the :meth:`boule.Ellipsoid.normal_gravity` function from :mod:`boule` to calculate the global gravity disturbance of the Earth using our sample gravity data. .. GENERATED FROM PYTHON SOURCE LINES 18-55 .. image-sg:: /gallery/images/sphx_glr_gravity_disturbance_001.png :alt: gravity disturbance :srcset: /gallery/images/sphx_glr_gravity_disturbance_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out Out: .. code-block:: none Dimensions: (longitude: 2161, latitude: 1081) Coordinates: * longitude (longitude) float64 -180.0 -179.8 -179.7 ... 179.7 179.8 180.0 * latitude (latitude) float64 -90.0 -89.83 -89.67 -89.5 ... 89.67 89.83 90.0 height (latitude, longitude) float32 1e+04 1e+04 1e+04 ... 1e+04 1e+04 Data variables: gravity (latitude, longitude) float32 9.801e+05 9.801e+05 ... 9.802e+05 grdimage [WARNING]: Longitude range too small; geographic boundary condition changed to natural. | .. code-block:: default import boule as bl import ensaio import pygmt import xarray as xr # Load the global gravity grid fname = ensaio.fetch_earth_gravity(version=1) data = xr.load_dataset(fname) print(data) # Calculate normal gravity using the WGS84 ellipsoid ellipsoid = bl.WGS84 gamma = ellipsoid.normal_gravity(data.latitude, data.height) # The disturbance is the observed minus normal gravity (calculated at the # observation point) disturbance = data.gravity - gamma # Make a plot of data using PyGMT fig = pygmt.Figure() pygmt.grd2cpt(grid=disturbance, cmap="polar", continuous=True) title = "Gravity disturbance of the Earth" fig.grdimage( region="g", projection="G160/0/15c", frame=f"+t{title}", grid=disturbance, cmap=True, ) fig.coast(shorelines="0.5p,black", resolution="crude") fig.colorbar(cmap=True, frame=["a100f50", "x+lmGal"]) fig.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 20.925 seconds) .. _sphx_glr_download_gallery_gravity_disturbance.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: gravity_disturbance.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: gravity_disturbance.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_