.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/earth-gravity.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_gallery_earth-gravity.py: Earth gravity grid at 10 arc-minute resolution ---------------------------------------------- The grid is grid-node registered and stored in netCDF with CF-compliant metadata. The gravity values are derived from the EIGEN-6C4 spherical harmonic model. Here "gravity" refers to the combined gravitational and centrifugal accelerations. The data are calculated uniformly at 10 km above the WGS84 ellipsoid. **Original source:** `EIGEN-6C4 model `__ **Pre-processing:** `Source code for preparation of the original dataset for redistribution in Ensaio `__ .. GENERATED FROM PYTHON SOURCE LINES 26-31 .. code-block:: Python import pygmt import xarray as xr import ensaio .. GENERATED FROM PYTHON SOURCE LINES 32-33 Download and cache the data and return the path to it on disk. .. GENERATED FROM PYTHON SOURCE LINES 33-36 .. code-block:: Python fname = ensaio.fetch_earth_gravity(version=1) print(fname) .. rst-class:: sphx-glr-script-out .. code-block:: none /home/runner/work/_temp/cache/ensaio/v1/earth-gravity-10arcmin.nc .. GENERATED FROM PYTHON SOURCE LINES 37-38 Load the netCDF grid with xarray. .. GENERATED FROM PYTHON SOURCE LINES 38-41 .. code-block:: Python data = xr.load_dataarray(fname) data .. raw:: html
<xarray.DataArray 'gravity' (latitude: 1081, longitude: 2161)> Size: 19MB
    array([[980106.525, 980106.525, 980106.525, ..., 980106.525, 980106.525,
            980106.525],
           [980108.225, 980108.225, 980108.225, ..., 980108.225, 980108.225,
            980108.225],
           [980108.825, 980108.825, 980108.825, ..., 980108.725, 980108.725,
            980108.825],
           ...,
           [980153.825, 980153.725, 980153.625, ..., 980153.925, 980153.825,
            980153.825],
           [980160.425, 980160.425, 980160.425, ..., 980160.425, 980160.425,
            980160.425],
           [980157.525, 980157.525, 980157.525, ..., 980157.525, 980157.525,
            980157.525]], shape=(1081, 2161))
    Coordinates:
      * longitude  (longitude) float64 17kB -180.0 -179.8 -179.7 ... 179.8 180.0
      * latitude   (latitude) float64 9kB -90.0 -89.83 -89.67 ... 89.67 89.83 90.0
        height     (latitude, longitude) float32 9MB 1e+04 1e+04 ... 1e+04 1e+04
    Attributes:
        Conventions:     CF-1.8
        title:           Gravity acceleration (EIGEN-6C4) at a constant geometric...
        crs:             WGS84
        source:          Generated from the EIGEN-6C4 model by the ICGEM Calculat...
        license:         Creative Commons Attribution 4.0 International Licence
        references:      https://doi.org/10.5880/icgem.2015.1
        long_name:       gravity acceleration
        description:     magnitude of the gravity acceleration vector (gravitatio...
        units:           mGal
        actual_range:    [974748.6 980201.9]
        icgem_metadata:  generating_institute: gfz-potsdam\ngenerating_date: 2021...


.. GENERATED FROM PYTHON SOURCE LINES 42-43 Make a PyGMT pseudo-color map of the grid in a Mollweide projection. .. GENERATED FROM PYTHON SOURCE LINES 43-53 .. code-block:: Python fig = pygmt.Figure() fig.basemap( region="g", projection="W15c", frame=True, ) fig.grdimage(data, cmap="viridis", shading="+nt0.5") fig.colorbar(frame='af+l"gravity [mGal]"') fig.coast(shorelines=True, resolution="c", area_thresh=1e4) fig.show() .. image-sg:: /gallery/images/sphx_glr_earth-gravity_001.png :alt: earth gravity :srcset: /gallery/images/sphx_glr_earth-gravity_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 5.225 seconds) .. _sphx_glr_download_gallery_earth-gravity.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: earth-gravity.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: earth-gravity.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_