.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/caribbean-bathymetry.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_caribbean-bathymetry.py: Bathymetry single-beam surveys of the Caribbean ----------------------------------------------- This dataset is a compilation of several public domain single-beam bathymetry surveys of the ocean in the Caribbean. The data display a wide range of tectonic activity and uneven distribution. **Original source:** `NOAA NCEI `__ **Pre-processing:** `Source code for preparation of the original dataset for redistribution in Ensaio `__ .. admonition:: Changes in version 2 :class: note In version 1, there were 1,938,095 data taking up a larger area. The data were ``depth_m`` and positive downward. Version 2, cropped the data to make it more manageable and converted the depths to bathymetric heights (negative downward). .. GENERATED FROM PYTHON SOURCE LINES 31-36 .. code-block:: Python import pandas as pd import pygmt import ensaio .. GENERATED FROM PYTHON SOURCE LINES 37-38 Download and cache the data and return the path to it on disk .. GENERATED FROM PYTHON SOURCE LINES 38-41 .. code-block:: Python fname = ensaio.fetch_caribbean_bathymetry(version=2) print(fname) .. rst-class:: sphx-glr-script-out .. code-block:: none /home/runner/work/_temp/cache/ensaio/v2/caribbean-bathymetry.csv.xz .. GENERATED FROM PYTHON SOURCE LINES 42-43 Load the CSV formatted data with pandas .. GENERATED FROM PYTHON SOURCE LINES 43-46 .. code-block:: Python data = pd.read_csv(fname) data .. raw:: html
survey_id latitude longitude bathymetry_m
0 86005311 16.09652 -61.52117 -187
1 86005311 16.09415 -61.52104 -177
2 86005311 16.09177 -61.52091 -185
3 86005311 16.08940 -61.52078 -188
4 86005311 16.08703 -61.52066 -192
... ... ... ... ...
294316 JR336 15.28529 -57.01258 -5276
294317 JR336 15.28705 -57.00994 -5277
294318 JR336 15.28883 -57.00732 -5278
294319 JR336 15.29057 -57.00467 -5277
294320 JR336 15.29234 -57.00203 -5276

294321 rows × 4 columns



.. GENERATED FROM PYTHON SOURCE LINES 47-48 Make a PyGMT map with the data points colored by the bathymetry. .. GENERATED FROM PYTHON SOURCE LINES 48-65 .. code-block:: Python fig = pygmt.Figure() pygmt.makecpt( cmap="cmocean/topo+h", series=[data.bathymetry_m.min(), data.bathymetry_m.max()], ) fig.plot( x=data.longitude, y=data.latitude, fill=data.bathymetry_m, cmap=True, style="c0.02c", projection="M15c", frame=True, ) fig.colorbar(frame='af+l"bathymetry [m]"') fig.coast(land="#666666") fig.show() .. image-sg:: /gallery/images/sphx_glr_caribbean-bathymetry_001.png :alt: caribbean bathymetry :srcset: /gallery/images/sphx_glr_caribbean-bathymetry_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 6.584 seconds) .. _sphx_glr_download_gallery_caribbean-bathymetry.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: caribbean-bathymetry.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: caribbean-bathymetry.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_