2. Software and Packages#

GMT is a toolbox for plotting. We feed it with proper data and it draws beautiful pictures for us in return. Because GMT only does the plotting job, we usually need other tools in our workflow, such as preparing the data for GMT or editing the output files from GMT. This page lists some packages I recommend installing when using GMT.

2.1. Text editor#

We communicate with GMT using a command-line interface, such as the UNIX system’s Shell. That is, we can write all the commands down in a single script (or batch file, whatever you call) and have it run like a Python or bash script. For PyGMT, the way to use it is really similar to writing a Python script. Many operating systems have their built-in text editor for writing a script, like Notepad in Windows. However, I highly recommend finding a better text editor crafted for programming. These fancy editors come along with many handy features like syntax highlighting, auto-indentation, basic debugging, etc. The followings are some popular choices:

2.1.1. Gedit#

Initially designed on GNOME’s desktop (like Ubuntu) as a light-weighted text editor. It’s simple, easy to use, and has syntax highlighting. It has even released on all PC platforms.

2.1.2. Sublime Text#

A popular and powerful code editor with lots of great functions. You can even download extra modules designed by its community, and personalize your own editor. It is available on all platforms and provides a “life-time” trial version, which means you only need to buy the license when you feel worth it.

2.1.3. Visual Studio Code (VS Code)#

VS Code is a free cross-platform programming editor developed by Microsoft. It has all functionality you can imagine for coding and provides various customized themes. More importantly, VS Code supports Git and version control and allows users to navigate or even commit file changes.

Besides, there are other good editors like Vim, Emacs, Micro, Nano, Kate, and Notepad++. Feel free to compare and pick whichever you feel the best.

2.2. Jupyter#

The Jupyter project’s core concept is to provide a standard for open-source software and develop interactive computing interfaces for users who work with different programming languages. Jupyter has many software products, and if you plan to use PyGMT, I recommend installing Jupyter Lab because it allows you to use your web browser as an integrated interface for developing your scripts. See here for more detailed descriptions about Jupyter Lab. The PyGMT scripts provided in the following chapters are written in the Jupyter Notebook format. (Disclaimer: I am currently a team member of the Jupyter Meets the Earth project. All descriptions about Jupyter in these tutorials are my personal opinions and do not represent the Jupyter dev team. I wrote these tutorials using my off-work time.)

2.2.1. Jupyter Notebook#

Jupyter Notebook is an app running on a web browser (i.e. on the server). It uses a user-defined “kernel” such as Python, R, or Shell programming language to access the computation resources. Thus, users can write code and documentation together in the Notebook GUI and display execution results in the same document along with external links and video embeds. Readers can see a highly structured and narrative workflow in a Notebook.

2.2.2. JupyterLab#

JupyterLab is the next generation of the Notebook. It introduces the panels into the GUI to view different kinds of data, manage multiple Notebooks, and compare different workflows more easily. JupyterLab is also the default GUI in this tutorial for the interactive cloud environment (MyBinder).

2.3. GDAL#

GMT natively supports some geospatial formats such as NetCDF and plain text files and has extended support to other common formats with GDAL, including GeoTIFF and shapefile. GDAL is short for “Geospatial Data Abstraction Library.” It is open-source software and is constantly updating. As of now, GDAL supports at least 142 raster formats and 84 vector formats. GDAL comes with handy console commands which let you browse or edit geospatial data without pain. Besides, GDAL also serves as a library that can be run as a module in many programming languages such as Python. GDAL can be installed on any platform independently or as a part of the QGIS standard installation since QGIS uses it for manipulating geospatial data. Note that if you want GMT to read more GDAL-supported file formats, you have to install GDAL before installing GMT.

2.4. Graphic interface for processing geospatial data#

GMT is powerful because it manipulates geospatial data with a few command lines, even though you have to make a complex figure. However, there is always time you might just want to browse your data or run some simple tasks. In this case, a graphic interface of GIS for analyzing geospatial data would be your best friend.

2.4.1. QGIS#

QGIS is popular free GIS software released in 2009. Numerous users and volunteers have joined the community to make it better. It uses Python as the console language, which makes users efficiently process data in a graphic or script-based fashion. You can also make your plugins to increase working efficiency. QGIS supports various operating systems, even including Android!

2.4.2. ArcGIS#

ArcGIS is a well-known business GIS software designed by Esri. This name ArcGIS actually refers to a bunch of packages as Esri fine-tunes their products based on various needs, and we can choose the best package to work for different goals. Python is also the scripting language supported by ArcGIS. Unfortunately, ArcGIS is only available on Windows.

2.4.3. Google Earth#

Strictly speaking, Google Earth is only “Globe software.” We are supposed to view geospatial data using this software instead of editing them. In Google Earth, we can only set up simple features or browse data from other sources. However, this software is still capable of many tasks. Google Earth now supports any platform, including Android, and both standard and professional versions are provided.

2.5. Image viewing, processing, and editing software#

GMT 6 users can select the output map format, for example, vector-format PDF or image-format PNG. Nevertheless, to tweak the map just a little (e.g., adjusting resolution and image size), it is still easier to use an image processor as it saves your time from rerunning the GMT script. Here I list two popular open-science tools to help expedite your task:

2.5.1. ImageMagick#

An open-source and free package for image processing. It includes numerous commands; each of them has various options. It also supports many image or vector formats. You can run the command convert to easily adjust images. ImageMagick is available on several platforms and is pre-installed on Linux as one of the standard OS packages.

2.5.2. Inkscape#

If you are a fan of free software or you are using Linux, Inkscape would suit you the best for tackling vectorized images. It is also available on non-Linux platforms.

If you would like to have the options from the proprietary software, Adobe Illustrator and CorelDRAW are two good ones.