gemath Manual

Introduction

The gemath package contains methods and function to conduct some array manipulation, numerical analysis and mathematical calculations that are commonly encountered in the atmospheric sciences.

The home page for the package contains the package license, installation and downloading instructions, a complete listing of package contents, help for the modules, and probably all the description and examples most users need to use the package. Most users can ignore this manual you're currently reading.

That being said, this manual describes details of the programming logic behind the package. This information may be useful if you want to add modules, change the source code, etc.

The manual is subdivided into these categories:


Testing

The example pages in the documentation function as unit tests, particularly of applications of gemath functions on multi-dimensional arrays (e.g. calculating the curl). All (or nearly all) modules, however, also make use of the doctest module which executes all example docstrings in the module. For instance, to check that the deriv module passes its docstring unit tests, in the source code directory at the OS command line just type:

>>> python deriv.py

If there are no problems, you should get back nothing.

There is one major caveat. In the curl_2d module, there are docstring examples using algorithms in function curl_2d that require the module sphere implementation of the NCAR package SPHEREPACK 3.0; sphere is a contributed package of CDAT. The current version of curl_2d passes doctest unit testing with CDAT 3.3 but not CDAT 4.0. In CDAT 4.0 (or its dependencies), some changes have been made (at least in the Debian install) that have altered the results from using sphere. For values near zero, the difference can be in all significant digits. For values away from zero, the difference is generally limited to just 1-2 significant digits. It is possible this is a LAPACK problem, but I do not know. Because the time it would take to track down this "error" is prohibitive, I'm just documenting it for reference.

As curl_2d is currently the only module in gemath that uses sphere, all other gemath modules pass doctest unit testing without difficulty.

[Back up top to the Introduction.]


Future Work

  • Array manipulation operations to add: IDL REPLICATE function (both array creation function and removing degenerate dimensions function), function to remove degenerate dimensions (call it squeeze after the CDAT name).
  • Mathematical operations to add: divergence, variance, lag-correlation, factorial.
  • Addition of methods to calculate: gaussian latitudes.

[Back up top to the Introduction.]

Return to gemath Home Page.
Return to Johnny Lin's Python Library.

Valid HTML 4.01! Valid CSS! Updated: April 23, 2004 by Johnny Lin <email address>. License.