.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/southern-africa-topography.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-topography.py: Topography and bathymetry of Southern Africa -------------------------------------------- This dataset consists in a regular grid with topography and bathymetry over Southern Africa. It was generated by cropping the ETOPO1 global topography grid to the desired area. The topography and bathymetry heights are referenced to sea level (what can be considered as the geoid). **Original source:** `ETOPO1 `__ **Pre-processing:** `Source code for preparation of the original dataset for redistribution in Ensaio `__ .. GENERATED FROM PYTHON SOURCE LINES 24-29 .. code-block:: default import pygmt import xarray as xr import ensaio .. GENERATED FROM PYTHON SOURCE LINES 30-31 Download and cache the data and return the path to it on disk .. GENERATED FROM PYTHON SOURCE LINES 31-34 .. code-block:: default fname = ensaio.fetch_southern_africa_topography(version=1) print(fname) .. rst-class:: sphx-glr-script-out Out: .. code-block:: none /home/runner/work/_temp/cache/ensaio/v1/southern-africa-topography.nc .. GENERATED FROM PYTHON SOURCE LINES 35-36 Load the netCDF file with xarray (netcdf4 is required) .. GENERATED FROM PYTHON SOURCE LINES 36-39 .. code-block:: default data = xr.load_dataarray(fname) data .. raw:: html
<xarray.DataArray 'topography' (latitude: 1182, longitude: 1371)>
    array([[-5039., -5027., -5014., ..., -3846., -3867., -3873.],
           [-5036., -5021., -5007., ..., -3839., -3863., -3872.],
           [-5031., -5016., -5001., ..., -3835., -3860., -3870.],
           ...,
           [-2906., -2901., -2884., ...,   173.,   134.,   118.],
           [-2908., -2906., -2888., ...,   132.,   119.,   118.],
           [-2912., -2910., -2894., ...,   122.,   120.,   128.]],
          dtype=float32)
    Coordinates:
      * longitude  (longitude) float64 10.92 10.93 10.95 10.97 ... 33.72 33.73 33.75
      * latitude   (latitude) float64 -36.0 -35.98 -35.97 ... -16.35 -16.33 -16.32
    Attributes:
        Conventions:    CF-1.8
        title:          Topographic and bathymetric height for Southern Africa ob...
        crs:            WGS84
        source:         Downloaded from NOAA website (https://ngdc.noaa.gov/mgg/g...
        license:        public domain
        references:     https://doi.org/10.7289/V5C8276M
        long_name:      topographic height above mean sea level
        standard_name:  height_above_mean_sea_level
        description:    height topography/bathymetry referenced to mean sea level
        units:          m
        actual_range:   [-5685.  3376.]
        noaa_metadata:  Conventions: COARDS/CF-1.0\ntitle: ETOPO1_Ice_g_gmt4.grd\...


.. GENERATED FROM PYTHON SOURCE LINES 40-41 Make a PyGMT map of the topography and bathymetry data .. GENERATED FROM PYTHON SOURCE LINES 41-47 .. code-block:: default fig = pygmt.Figure() fig.grdimage(data, cmap="etopo1", projection="M15c") fig.colorbar(frame='af+l"topography [m]"', position="JCR") fig.basemap(frame=True) fig.coast(shorelines="0.1p", area_thresh=1e4) fig.show() .. image-sg:: /gallery/images/sphx_glr_southern-africa-topography_001.png :alt: southern africa topography :srcset: /gallery/images/sphx_glr_southern-africa-topography_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 12.830 seconds) .. _sphx_glr_download_gallery_southern-africa-topography.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-topography.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: southern-africa-topography.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_