If you do this step, your code will be able to read a CODAS database, or uhdas “rbin” and “gbin” files with Python. Work is underway to develop Python tools to read single-ping ADCP data from RDI ADCPs.
In the “near” future, this step will be required.
Instructions:
Get Cython
Cython is a language that is written in python, and that is almost python, but that produces C code for compilation into python extensions. Hence it provides a way to get C speed for critical code paths, and to access C modules and libraries from Python. We have recently switched to Cython from Pyrex, its predecessor.
We are using cython for several extensions in pycurrents, including the python interface to codas databases. Although it is not yet required, quick_adcp will increasingly take advantage of this interface, and will in the future require it.
Install Cython
Cython is easy to install. Get the zip or tar archive and put it in a “downloads” location. Unpack it and read the INSTALL.txt. It will probably direct you to do this (on unix systems you’ll have to be root)
python setup.py install
In a shell prompt in the “pycurrents” directory, type
python runsetup.py
If you proceed with the instructions in this section, you will also be able to make plots such as these, using matplotlib:
(thumbnails are links to larger images)
![]() |
![]() |
![]() |
NumPy is the core numerical array extension for Python, and it is central to our shift from Matlab to Python. Download and install version 1.3 or later. Versions available from linux distributions will generally be old, so install from the tarball or from the svn repository. Binary versions are available for OSX and Windows; use those, but pay attention to the instructions regarding Python versions.
Matplotlib is the plotting tool we will use. Installation from source is quite easy on linux but can be difficult on OSX and Windows. Increasing effort is going into improving both the ease of installation from source and the availability of up-to-date binary packages for OSX and Windows.
iPython is an extremely useful python shell which interacts well with matplotlib. You can get it here
Scipy is a sprawling, uneven library that can take advantage of many external libraries and of a Fortran compiler. We are trying to NOT rely on scipy.
However, if you want to be able to read matlab binary files (“*.mat”) from python, download and install scipy. Simple functionality like reading “mat” files doesn’t require any of the fancy parts.