Changeset 343 for nappy/trunk/general.py


Ignore:
Timestamp:
15/06/04 13:46:42 (16 years ago)
Author:
astephen
Message:

Latest version with new files in test directory.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nappy/trunk/general.py

    r339 r343  
    1616""" 
    1717 
    18 # Import required modules 
    19 import os 
    20 import textParser 
    21 from naFile import * 
     18# Imports from local package 
     19import naFile, naFile1001, naFile1010, naFile1020, naFile2010 
     20import naFile2110, naFile2110, naFile2160, naFile2310 
     21import naFile3010, naFile4010 
    2222 
    2323# Set up global variables 
    24 classMap={1001:NAFile1001, 1010:NAFile1010, 1020:NAFile1020, 
    25           2010:NAFile2010, 2110:NAFile2110, 2160:NAFile2160, 
    26           2310:NAFile2310, 3010:NAFile3010, 4010:NAFile4010} 
     24classMap={1001:naFile1001.NAFile1001, 1010:naFile1010.NAFile1010, 
     25          1020:naFile1020.NAFile1020, 2010:naFile2010.NAFile2010, 
     26          2110:naFile2110.NAFile2110, 2160:naFile2160.NAFile2160, 
     27          2310:naFile2310.NAFile2310, 3010:naFile3010.NAFile3010, 
     28          4010:naFile4010.NAFile4010} 
    2729 
    2830def readFFI(filename): 
     31    """ 
     32    Function to read the top line of a NASA Ames file to extract 
     33    the File Format Index (FFI) and return it as an integer. 
     34    """ 
    2935    topline=open(filename).readline() 
    3036    return int(topline.split()[-1]) 
    3137 
    32  
    3338def chooseFFI(naDict): 
     39    """ 
     40    Function to choose the appropriate FFI based on the contents of the 
     41    'naDict' dictionary object that holds NASA Ames internal variables. 
     42    """ 
    3443    d=naDict 
    3544    if d["NIV"]>4:        # More than 4 independent variables not allowed 
     
    6776def openNAFile(filename, mode="r", naDict=None): 
    6877    """ 
    69     Works out the correct FFI and maps to the appropriate NASA Ames File 
    70     class. 
     78    Function wrapper around the NASA Ames File classes. Any NASA Ames 
     79    file can be opened through this function and the appropriate read or 
     80    write NASA Ames File class instance is returned. 
    7181    """ 
    7282    if mode=="r": 
Note: See TracChangeset for help on using the changeset viewer.