Python wrappers for the Generic Mapping Tools on the way


An interface for interoperability between the Generic Mapping Tools (GMT), a tool used by geophysicists to create research-quality figures, and Matlab has recently been developed that allows GMT users to interact with Matlab and Matlab users to make use of GMT.

GMT wrappers are currently also being developed for the Python programming language, particularly to be used in the IPython/Jupyter notebook due to an initiative by Leonardo Uieda (and his professor Paul Wessel) whose Postdoc is being funded by the NSF. You can watch his talk at the SciPy 2017 conference below.

Some of the mentioned advantages to which I attest  include:

  • Begin and End statements are introduced to eliminate the need to pipe postscript results into a file in each line of code being written. This also eliminates the need to use the -K and -O flags which keep the file open and updates it, respectively. The -K and -O flags are a major confusion for newcomers to GMT.
  • temporary files are created under the /tmp directory, in Linux, so they will automatically be cleaned once the jupyter notebook is closed or the operating system is rebooted. Moreover, every project will have its own  directory so files from different projects don’t get mixed up.
  • GMT documentation straight in the Jupyter notebook
  • Matplotlib- & Basemap-like behaviour, particularly inline viewing of figures, using
  • Pythonic aliases make the compact GMT flags

To contribute:


Cook, T. (2017), A powerful new tool for research, Eos, 98, Published on 17 July 2017.

Amazing NASA simulation of Solar Wind Striping the Martian Atmosphere


The following video by NASA’s Scientific Visualization Center simulates the Martian atmosphere being striped by incoming solar wind.

More videos and images can be found here.

Mars is a cold and barren desert today, but scientists think that in the ancient past it was warm and wet. The loss of the early Martian atmosphere may have led to this dramatic change, and one of the prime suspects is the solar wind. Unlike Earth, Mars lacks a global magnetic field to deflect the stream of charged particles continuously blowing off the Sun. Instead, the solar wind crashes into the Mars upper atmosphere and can accelerate ions into space. Now, for the first time, NASA’s MAVEN spacecraft has observed this process in action – by measuring the speed and direction of ions escaping from Mars. This data visualization compares simulations of the solar wind and Mars atmospheric escape with new measurements taken by MAVEN.

R – Labels inside ggplots using directlabels


The other day I generated the following figure with ggplot2


using the following code:

ggplot(dat, aes(x = Year, y = log10(sum), group = id, colour = id)) +
 geom_point() +
 geom_smooth() +
 labs(x = "", y = "")

Note that I used the “group” argument to plot both curves on the same figure. Similarly I used the “colour” argument to colorize each curve differently.

But instead of a legend I wanted to have labels on or near the curves. To do that I resorted to the “directlabels” package.

First I needed to install it after installing its dependency package “quadprog” and load ggplot2 & directlabels:

install.packages("quadprog") # dependency for directlabels
install.packages("directlabels", repo="")

library(directlabels) # load "directlabels"

To plot the figure, I went on as before but instead I assigned the plot command to “p” which I then passed on to direct.label().

p <- ggplot(dat, aes(x = Year, y = log10(sum), group = id, colour = id)) +
 geom_point() +
 geom_smooth() +
 labs(x = "", y = "")

As you can see the direct.label() function took care of the legend and replaced it with labels on the curves:


This is a really useful package.

If you found this post helpful please give it a like or share it somewhere in the digital universe.