.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/southern-africa-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_southern-africa-gravity.py: Gravity ground-based surveys of Southern Africa ----------------------------------------------- This dataset is a compilation of several public domain ground measurements of gravity from Southern Africa. The observations are the absolute gravity values in mGal. The horizontal datum is not specified and heights are referenced to "sea level", which we will interpret as the geoid (which realization is likely not relevant since the uncertainty in the height is probably larger than geoid model differences). **Original source:** `NOAA NCEI `__ **Pre-processing:** `Source code for preparation of the original dataset for redistribution in Ensaio `__ .. GENERATED FROM PYTHON SOURCE LINES 25-30 .. code-block:: default import pandas as pd import pygmt import ensaio .. GENERATED FROM PYTHON SOURCE LINES 31-32 Download and cache the data and return the path to it on disk .. GENERATED FROM PYTHON SOURCE LINES 32-35 .. code-block:: default fname = ensaio.fetch_southern_africa_gravity(version=1) print(fname) .. rst-class:: sphx-glr-script-out Out: .. code-block:: none /home/runner/work/_temp/cache/ensaio/v1/southern-africa-gravity.csv.xz .. GENERATED FROM PYTHON SOURCE LINES 36-37 Load the CSV formatted data with pandas .. GENERATED FROM PYTHON SOURCE LINES 37-40 .. code-block:: default data = pd.read_csv(fname) data .. raw:: html
longitude latitude height_sea_level_m gravity_mgal
0 18.34444 -34.12971 32.2 979656.12
1 18.36028 -34.08833 592.5 979508.21
2 18.37418 -34.19583 18.4 979666.46
3 18.40388 -34.23972 25.0 979671.03
4 18.41112 -34.16444 228.7 979616.11
... ... ... ... ...
14354 21.22500 -17.95833 1053.1 978182.09
14355 21.27500 -17.98333 1033.3 978183.09
14356 21.70833 -17.99166 1041.8 978182.69
14357 21.85000 -17.95833 1033.3 978193.18
14358 21.98333 -17.94166 1022.6 978211.38

14359 rows × 4 columns



.. GENERATED FROM PYTHON SOURCE LINES 41-42 Make a PyGMT map with the data points colored by the gravity data. .. GENERATED FROM PYTHON SOURCE LINES 42-64 .. code-block:: default fig = pygmt.Figure() fig.basemap( region=[ data.longitude.min() - 1, data.longitude.max() + 1, data.latitude.min() - 1, data.latitude.max() + 1, ], projection="M15c", frame=True, ) pygmt.makecpt(cmap="viridis", series=[data.gravity_mgal.min(), data.gravity_mgal.max()]) fig.plot( x=data.longitude, y=data.latitude, color=data.gravity_mgal, cmap=True, style="c0.05c", ) fig.colorbar(frame='af+l"gravity [mGal]"') fig.coast(shorelines=True, water="royalblue4", area_thresh=1e4) fig.show() .. image-sg:: /gallery/images/sphx_glr_southern-africa-gravity_001.png :alt: southern africa gravity :srcset: /gallery/images/sphx_glr_southern-africa-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 6.476 seconds) .. _sphx_glr_download_gallery_southern-africa-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: southern-africa-gravity.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: southern-africa-gravity.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_