10.6084/m9.figshare.6814052.v2 Leonardo Uieda Leonardo Uieda Paul Wessel Paul Wessel Presentation: Building an object-oriented Python interface for the Generic Mapping Tools figshare 2019 GMT Python Open Source Software Geophysics Earth Sciences not elsewhere classified Geophysics Oceanography Atmospheric Sciences 2019-01-26 12:06:04 Presentation https://figshare.com/articles/presentation/Building_an_object-oriented_Python_interface_for_the_Generic_Mapping_Tools/6814052 <div>Talk at the Scipy Conference 2018.</div><div><br></div><div>Live demo: http://try.gmtpython.xyz<br></div><div><h2>Short summary</h2> <p>We are building a Python wrapper for the Generic Mapping Tools (GMT), a set of command-line programs used across the Earth, Atmospheric, and Ocean Sciences to process and visualize geographic data. At Scipy 2017, we presented the project goals and an initial prototype. The feedback received led to improvements in the design of the library, mainly the creation of an object-oriented API. We will present the newest developments including support for numpy arrays and pandas Dataframes, interactive visualization in the Jupyter notebook using NASA WorldWind, and more. Once again, we seek feedback from the community to guide us moving forward.</p> <h2><a href="https://github.com/leouieda/scipy2018#abstract"></a>Abstract</h2> <p>The <a href="http://www.gmtpython.xyz" rel="nofollow">GMT/Python library</a> has been in development for approximately 1 year. Much of the current design of the library was inspired by the <a href="http://www.leouieda.com/blog/gmt-after-scipy2017.html" rel="nofollow">feedback that we received following our presentation at Scipy 2017</a>. Since then, we have been implementing this design, establishing a solid low-level API on which to build the rest of the library, and exploring new ways to interface with the Jupyter notebook. In this talk, we will present the current state of the project, including: the design of the low-level wrapper for the GMT C API (the <code>gmt.clib.LibGMT</code> class); the new object-oriented plotting API (the <code>gmt.Figure</code> class); the support for numpy arrays and pandas Dataframes; using GMT's built-in topography grids and sample datasets; interactive visualization in the Jupyter notebook using the <a href="https://worldwind.arc.nasa.gov" rel="nofollow">NASA WorldWind Web Javascript library</a>; and more. An online demo of these features is available through the Binder service at <a href="http://try.gmtpython.xyz" rel="nofollow">http://try.gmtpython.xyz</a>. We will also share the lessons learned from using ctypes to build the wrapper and the changes that were required in the C API to make the wrapping process as smooth as possible when porting to other languages. Finally, we will layout our development plans and solicit feedback and contributions to help guide the future of the project.</p> <p>GMT has an extensive feature set that goes well beyond data visualization. It has sophisticated algorithms for processing and interpolating data in Cartesian and spherical coordinates that is still unmatched in the Scipy ecosystem. GMT is also the basis for specialized software like <a href="https://www.mbari.org/products/research-software/mb-system" rel="nofollow">MB-System</a> for processing and visualizing bathymetry and backscatter imagery data derived from multibeam, interferometry, and sidescan sonars and <a href="http://topex.ucsd.edu/gmtsar" rel="nofollow">GMTSAR</a> for processing Interferometric Synthetic-Aperture Radar (InSAR) data. A well designed wrapper for the GMT C API is the first step to bring these powerful tools to the Scipy community. The data visualization landscape in Python has grown immensely in the past few years with the advent of Boheh, Altair, Cartopy, Holoviews, etc. GMT/Python can help diversify this ecosystem and bring important lessons learned during the 28+ years of continuous development of GMT.</p></div>