Visualizing Bathymetry Data in Python

[Skip the text, and go straight to the code]

Ok, so you built your own autonomous surface vehicle, got all the components and sensors working, and you watched proudly as your creation cruised from waypoint to waypoint on your local lake, all while storing GPS and depth data. Wouldn’t it be nice to quickly and easily display your data as colored contours, either as an image or in free GIS software like Google Earth or QGIS? Unfortunately, few open source programs exist. Sure, ReefMaster offers a 14 day free trial, but then what? Luckily, visualizing bathymetry data in Python is not too difficult. With some basic Python we can turn your text file into a contour plot that you can view in Google Earth!

Visualizing bathymetry data in Python and Google Earth
Example depth data visualized in Google Earth.

Getting Started With Python

Jupyter Notebooks make getting started with Python really easy. Jupyter Notebooks allow you to execute code directly in your web browser. Take our advice and use Anaconda to create a new environment and install Python libraries. Many tutorials and videos can walk you through this process so we won’t try to reinvent the wheel.

Example Data

Alistair Green acquired depth measurements in the Shek Pik Reservoir on Lantau Island using his ArduPilot-powered ASV. He has kindly provided these data for us to use to develop open-source alternatives to commercial software. Download the data here.

Considerations

Keep in mind that we only plan to cover the basics at this point. We define ‘the basics’ as reading raw data, computing averages and plotting contours (filled and/or lines). Commercial software, like ReefMaster, costs money because they can offer a ton of functionality. However, let us know if you really want or need a certain data analysis tool for your data and we’ll see what we can do. Finally, it goes without saying that these scripts are provided for informational purposes only. Do not use them for navigation, or anything other than educating and/or amusing yourself and others.

The Basics

The next post will cover reading the .csv file in Python, plotting the vehicle track, and averaging the discrete depth measurements on a grid. So, let’s visualize some bathymetry data in Python!

Google Earth

After mastering the basics, learn how to view your data in Google Earth!