#!/usr/bin/python -tt #======================================================================= # General Documentation """Utilities for climate modeling. Some useful online help commands for the package: * help(modelutil): Help for the package. A list of all modules in this package is found in the "Package Contents" section of the help output. * help(modelutil.M): Details of each module "M", where "M" is the module's name. """ #----------------------------------------------------------------------- # Additional Documentation # # Package Name: # modelutil # # RCS Revision Code: # $Id: __init__.py,v 1.1.1.1 2005/01/13 00:15:42 jlin Exp $ # # Modification History: # - 03 Jan 2005: Original by Johnny Lin, Computation Institute, # University of Chicago. Passed passably reasonable tests. # # Notes: # - Written for Python 2.2.2. # - Module docstrings can be tested using the doctest module. To # test, execute "python __init__.py". # - See import statements throughout for non-"built-in" packages and # modules required. # # Copyright (c) 2004-2005 by Johnny Lin. For licensing, distribution # conditions, contact information, and additional documentation see # the URL http://geosci.uchicago.edu/csc/modelutil/doc/. #======================================================================= #---------------- Module General Import and Declarations --------------- #- Set module version to package version: import package_version __version__ = package_version.version __author__ = package_version.author __date__ = package_version.date __credits__ = package_version.credits del package_version #- If you're importing this module in testing mode, or you're running # pydoc on this module via the command line, import user-specific # settings to make sure any non-standard libraries are found: import os, sys if (__name__ == "__main__") or \ ("pydoc" in os.path.basename(sys.argv[0])): import user del os, sys #- Import Numeric/numarray as appropriate (see gemath.num_settings # module for details as to what gets imported): from gemath.num_settings import * #- List of modules in package: __all__ = [ "atmconst" \ , "field" \ , "generic_model" \ , "package_version" \ , "state" \ , "stateset" ] #-------------------------- Main: Test Module ------------------------- #- Define additional examples for doctest to use: __test__ = {'Additional Example 1': """ #- Test full path import: >>> import modelutil.field >>> data = [1., 2., 5., -3., -4.4] >>> a = modelutil.field.Field(data) >>> ['%.6g' % a[i] for i in range(len(a))] ['1', '2', '5', '-3', '-4.4'] >>> print a.typecode() d >>> print a.id None >>> print a.extra_meta.__dict__ {} """} #- Execute doctest if module is run from command line: if __name__ == "__main__": """Test the module. Tests the examples in all the module documentation strings, plus __test__. Note: To help ensure that module testing of this file works, the parent directory to the current directory is added to sys.path. """ import doctest, sys, os sys.path.append(os.pardir) doctest.testmod(sys.modules[__name__]) # ===== end file =====