[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

GEMPAK/Python interface



My wife uses the gemlib functions in her work as a student to access grid files. In order to do this, she, of course, uses FORTRAN. However, she wanted to use some functionality of the Python (http://www.python.org) language as well in these programs, but there really wasn't an efficient/easy way to do this. If you aren't familiar with Python, it is a very simple to use, but very powerful scripting language (similar to Perl, but not as ugly :) ). After doing some work on this and working with the developer of F2Py (http://cens.ioc.ee/projects/f2py2e/) to iron out some problems, I was able to successfully wrap several gd functions and create a very easy to use Python interface to grid files with very little work. I don't, however, have the GEMPAK expertise to do a complete interface to all of GEMPAK's functionality, and thought that I would present my work to you in case you wanted to continue this work.

The basic process of creating Python interfaces is:
- Add f2py directives to FORTRAN files to guide f2py in creating interface files
    - Run f2py on the FORTRAN files to create the Python interface
- Write Python class wrappers around GEMPAK functions to give them a more object oriented presentation

I've included a tar file of the the gd*.f files, as well as inbdta.f, a small build script, and a Python module that wraps the gd functions in a "Pythonic" way (see the comments at the top of gempak.py for examples of it's usage). If you have any questions, please let me know.

Attachment: gdf2py.tgz
Description: GNU Zip compressed data



Kevin Smith
address@hidden