Skip to main content

1.4) Python As A Glue


Code written in other languages can be called within your Python scripts. For example, you can call functions within a Fortran library. No need to re-write your old Fortran programs! See the F2py function of the Numpy package.

More and more scientific software has an associated Python package (extra Python code) that allows you to use the functionalities of this other software within Python. These packages tend to work as interfaces to other languages and software, allowing you to either write Python code that calls the software functions, or embed the software code directly in your Python program. Either way, you’ll have all the software functionalities available to you from your Python program.

For example:

  • Rpy is a simple Python interface to the R statistical programming language: http://rpy.sourceforge.net/
  • The geochemical calculation program PHREEQC can be used within Python with PHREEQPY (http://www.phreeqpy.com/)
  • The NCAR command Language for climate data analysis and plotting can be used from Python with PyNGL: http://www.pyngl.ucar.edu/
  • Mapping and geospatial analysis software such as GMT, ArcGIS, GDAL and others can be used from Python

Try it yourself: Search on the web for Python interfaces to your favourite specialist software.