.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/v1/british-columbia-lidar.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_british-columbia-lidar.py: Lidar point cloud of the Trail Islands in British Columbia, Canada ------------------------------------------------------------------ This is a lidar point cloud (ground reflections only) sliced to the small `Trail Islands `__ to the North of Vancouver. The islands have some nice looking topography and their isolated nature creates problems for some interpolation methods. **Original source:** `LidarBC `__ .. GENERATED FROM PYTHON SOURCE LINES 20-25 .. code-block:: default import pandas as pd import pygmt import ensaio.v1 as ensaio .. GENERATED FROM PYTHON SOURCE LINES 26-27 Download and cache the data and return the path to it on disk .. GENERATED FROM PYTHON SOURCE LINES 27-30 .. code-block:: default fname = ensaio.fetch_british_columbia_lidar() print(fname) .. rst-class:: sphx-glr-script-out Out: .. code-block:: none /home/runner/work/_temp/cache/ensaio/v1/british-columbia-lidar.csv.xz .. GENERATED FROM PYTHON SOURCE LINES 31-32 Load the CSV formatted data with pandas .. GENERATED FROM PYTHON SOURCE LINES 32-35 .. code-block:: default data = pd.read_csv(fname) data .. raw:: html
longitude latitude elevation_m
0 -123.813753 49.460263 -0.67
1 -123.813725 49.460274 -0.96
2 -123.813764 49.460254 -0.78
3 -123.813744 49.460262 -0.61
4 -123.813737 49.460265 -0.62
... ... ... ...
829728 -123.807407 49.455007 -1.24
829729 -123.807410 49.454995 -1.25
829730 -123.807416 49.454980 -1.19
829731 -123.807428 49.454966 -1.21
829732 -123.807432 49.454963 -1.20

829733 rows × 3 columns



.. GENERATED FROM PYTHON SOURCE LINES 36-37 Make a PyGMT map with the data points colored by the elevation. .. GENERATED FROM PYTHON SOURCE LINES 37-54 .. code-block:: default fig = pygmt.Figure() fig.basemap( region=[ data.longitude.min(), data.longitude.max(), data.latitude.min(), data.latitude.max(), ], projection="M15c", frame=True, ) pygmt.makecpt(cmap="viridis", series=[data.elevation_m.min(), data.elevation_m.max()]) fig.plot( x=data.longitude, y=data.latitude, color=data.elevation_m, cmap=True, style="c0.05c" ) fig.colorbar(frame='af+l"elevation [m]"') fig.show() .. image-sg:: /gallery/v1/images/sphx_glr_british-columbia-lidar_001.png :alt: british columbia lidar :srcset: /gallery/v1/images/sphx_glr_british-columbia-lidar_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 28.749 seconds) .. _sphx_glr_download_gallery_v1_british-columbia-lidar.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: british-columbia-lidar.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: british-columbia-lidar.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_