.. 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 Click :ref:`here ` 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 `__ .. GENERATED FROM PYTHON SOURCE LINES 22-27 .. code-block:: default import pygmt import xarray as xr import ensaio .. GENERATED FROM PYTHON SOURCE LINES 28-29 Download and cache the data and return the path to it on disk. .. GENERATED FROM PYTHON SOURCE LINES 29-32 .. code-block:: default fname = ensaio.fetch_earth_gravity(version=1) print(fname) .. rst-class:: sphx-glr-script-out Out: .. code-block:: none /home/runner/work/_temp/cache/ensaio/v1/earth-gravity-10arcmin.nc .. GENERATED FROM PYTHON SOURCE LINES 33-34 Load the netCDF grid with xarray. .. GENERATED FROM PYTHON SOURCE LINES 34-37 .. code-block:: default data = xr.load_dataarray(fname) data .. raw:: html
<xarray.DataArray 'gravity' (latitude: 1081, longitude: 2161)>
    array([[980106.5 , 980106.5 , 980106.5 , ..., 980106.5 , 980106.5 ,
            980106.5 ],
           [980108.25, 980108.25, 980108.25, ..., 980108.25, 980108.25,
            980108.25],
           [980108.8 , 980108.8 , 980108.8 , ..., 980108.75, 980108.75,
            980108.8 ],
           ...,
           [980153.8 , 980153.75, 980153.6 , ..., 980153.94, 980153.8 ,
            980153.8 ],
           [980160.44, 980160.44, 980160.44, ..., 980160.44, 980160.44,
            980160.44],
           [980157.5 , 980157.5 , 980157.5 , ..., 980157.5 , 980157.5 ,
            980157.5 ]], dtype=float32)
    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
    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 38-39 Make a PyGMT pseudo-color map of the grid in a Mollweide projection. .. GENERATED FROM PYTHON SOURCE LINES 39-49 .. code-block:: default 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-script-out Out: .. code-block:: none .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 10.521 seconds) .. _sphx_glr_download_gallery_earth-gravity.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: earth-gravity.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: earth-gravity.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_