.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/v1/earth-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_v1_earth-topography.py: Topography of the Earth at 10 arc-minute resolution --------------------------------------------------- The grid is grid-node registered and stored in netCDF with CF-compliant metadata. The values are derived from a spherical harmonic model of the ETOPO1 bedrock grid. Topography values are referenced to "sea level" and are positive upwards. **Original source:** `ETOPO1 `__ .. GENERATED FROM PYTHON SOURCE LINES 19-24 .. code-block:: default import pygmt import xarray as xr import ensaio.v1 as ensaio .. GENERATED FROM PYTHON SOURCE LINES 25-26 Download and cache the data and return the path to it on disk. .. GENERATED FROM PYTHON SOURCE LINES 26-29 .. code-block:: default fname = ensaio.fetch_earth_topography() print(fname) .. rst-class:: sphx-glr-script-out Out: .. code-block:: none /home/runner/work/_temp/cache/ensaio/v1/earth-topography-10arcmin.nc .. GENERATED FROM PYTHON SOURCE LINES 30-31 Load the netCDF grid with xarray. .. GENERATED FROM PYTHON SOURCE LINES 31-34 .. code-block:: default data = xr.load_dataarray(fname) data .. raw:: html
<xarray.DataArray 'topography' (latitude: 1081, longitude: 2161)>
    array([[ 2742.,  2742.,  2742., ...,  2742.,  2742.,  2742.],
           [ 2768.,  2768.,  2768., ...,  2768.,  2768.,  2768.],
           [ 2822.,  2822.,  2821., ...,  2822.,  2822.,  2822.],
           ...,
           [-4243., -4244., -4245., ..., -4242., -4243., -4243.],
           [-4156., -4157., -4157., ..., -4156., -4156., -4156.],
           [-4237., -4237., -4237., ..., -4237., -4237., -4237.]],
          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
    Attributes:
        Conventions:     CF-1.8
        title:           Topographic and bathymetric height of ETOPO1 (ice surfac...
        crs:             WGS84
        source:          Generated from a spherical harmonic model by the ICGEM C...
        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:    [-10023.   6082.]
        icgem_metadata:  generating_institute: gfz-potsdam\ngenerating_date: 2021...


.. GENERATED FROM PYTHON SOURCE LINES 35-36 Make a PyGMT pseudo-color map of the grid in a Mollweide projection. .. GENERATED FROM PYTHON SOURCE LINES 36-46 .. code-block:: default fig = pygmt.Figure() fig.basemap( region="g", projection="W15c", frame=True, ) fig.grdimage(data, cmap="etopo1", shading="+nt0.5") fig.colorbar(frame='af+l"topography [m]"') fig.coast(shorelines=True, resolution="c", area_thresh=1e4) fig.show() .. image-sg:: /gallery/v1/images/sphx_glr_earth-topography_001.png :alt: earth topography :srcset: /gallery/v1/images/sphx_glr_earth-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 9.534 seconds) .. _sphx_glr_download_gallery_v1_earth-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: earth-topography.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: earth-topography.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_