Changeset 3330


Ignore:
Timestamp:
08/02/08 20:03:23 (11 years ago)
Author:
astephen
Message:
 
Location:
nappy/trunk/nappy/na_file
Files:
2 edited
1 moved

Legend:

Unmodified
Added
Removed
  • nappy/trunk/nappy/na_file/na_core.py

    r3321 r3330  
    3030                     "NSCOML", "NV", "NVOL", "NVPM", "NX", "NXDEF", 
    3131                     "ONAME", "ORG", "RDATE", "SCOM", "SNAME", "V", 
    32                      "VMISS", "VNAME", "VSCAL", "X", "XNAME"} 
     32                     "VMISS", "VNAME", "VSCAL", "X", "XNAME") 
    3333 
    3434    def __init__(self): 
  • nappy/trunk/nappy/na_file/na_file.py

    r3321 r3330  
    2222# Imports from nappy package 
    2323import nappy.na_file.na_core 
    24 import utils.textParser 
    25 import na_error 
     24import nappy.utils.text_parser 
     25import nappy.na_error 
    2626 
    2727class NAFile(nappy.na_file.na_core.NACore): 
     
    4646        NASA Ames file. 
    4747        """ 
    48         naCore.NACore.__init__(self) 
     48        nappy.na_file.na_core.NACore.__init__(self) 
    4949        self.naDict = naDict 
    5050        self.filename = filename 
     
    5454 
    5555        if mode == "r": 
    56             self._normalizedX="yes" 
     56            self._normalizedX = "yes" 
    5757            self.readHeader() 
    5858        elif mode == "w": 
     
    9090        Returns NLHEAD and FFI in a tuple. 
    9191        """ 
    92         (self.NLHEAD, self.FFI) = utils.text_parser.readItemsFromLine(self.file.readline(), 2, int) 
     92        (self.NLHEAD, self.FFI) = nappy.utils.text_parser.readItemsFromLine(self.file.readline(), 2, int) 
    9393        self.NIV = int(self.FFI/1000) 
    9494        return (self.NLHEAD, self.FFI) 
     
    126126        """ 
    127127        self._readTopLine() 
    128         self.ONAME = utils.text_parser.readItemFromLine(self.file.readline(), str) 
    129         self.ORG = utils.text_parser.readItemFromLine(self.file.readline(), str) 
    130         self.SNAME = utils.text_parser.readItemFromLine(self.file.readline(), str) 
    131         self.MNAME = utils.text_parser.readItemFromLine(self.file.readline(), str) 
    132         (self.IVOL, self.NVOL) = utils.text_parser.readItemsFromLine(self.file.readline(), 2, int) 
    133         dates = utils.text_parser.readItemsFromLine(self.file.readline(), 6, int) 
     128        self.ONAME = nappy.utils.text_parser.readItemFromLine(self.file.readline(), str) 
     129        self.ORG = nappy.utils.text_parser.readItemFromLine(self.file.readline(), str) 
     130        self.SNAME = nappy.utils.text_parser.readItemFromLine(self.file.readline(), str) 
     131        self.MNAME = nappy.utils.text_parser.readItemFromLine(self.file.readline(), str) 
     132        (self.IVOL, self.NVOL) = nappy.utils.text_parser.readItemsFromLine(self.file.readline(), 2, int) 
     133        dates = nappy.utils.text_parser.readItemsFromLine(self.file.readline(), 6, int) 
    134134        (self.DATE, self.RDATE) = (dates[:3], dates[3:]) 
    135135 
     
    151151        Assumes we are at the right point in the file. 
    152152        """ 
    153         self.NV = utils.text_parser.readItemFromLine(self.file.readline(), int) 
    154         self.VSCAL = utils.text_parser.readItemsFromUnknownLines(self.file, self.NV, float) 
    155         self.VMISS = utils.text_parser.readItemsFromUnknownLines(self.file, self.NV, float) 
    156         self.VNAME = utils.text_parser.readItemsFromLines(self._readLines(self.NV), self.NV, str) 
     153        self.NV = nappy.utils.text_parser.readItemFromLine(self.file.readline(), int) 
     154        self.VSCAL = nappy.utils.text_parser.readItemsFromUnknownLines(self.file, self.NV, float) 
     155        self.VMISS = nappy.utils.text_parser.readItemsFromUnknownLines(self.file, self.NV, float) 
     156        self.VNAME = nappy.utils.text_parser.readItemsFromLines(self._readLines(self.NV), self.NV, str) 
    157157 
    158158    def _writeVariablesHeaderSection(self): 
     
    171171        Assumes we are at the right point in the file. 
    172172        """ 
    173         self.NAUXV = utils.text_parser.readItemFromLine(self.file.readline(), int) 
     173        self.NAUXV = nappy.utils.text_parser.readItemFromLine(self.file.readline(), int) 
    174174        if self.NAUXV > 0:         
    175             self.ASCAL = utils.text_parser.readItemsFromUnknownLines(self.file, self.NAUXV, float) 
    176             self.AMISS = utils.text_parser.readItemsFromUnknownLines(self.file, self.NAUXV, float) 
    177             self.ANAME = utils.text_parser.readItemsFromLines(self._readLines(self.NAUXV), self.NAUXV, str) 
     175            self.ASCAL = nappy.utils.text_parser.readItemsFromUnknownLines(self.file, self.NAUXV, float) 
     176            self.AMISS = nappy.utils.text_parser.readItemsFromUnknownLines(self.file, self.NAUXV, float) 
     177            self.ANAME = nappy.utils.text_parser.readItemsFromLines(self._readLines(self.NAUXV), self.NAUXV, str) 
    178178 
    179179    def _writeAuxVariablesHeaderSection(self): 
     
    193193        Assumes we are at the right point in the file. 
    194194        """ 
    195         self.NAUXV = utils.text_parser.readItemFromLine(self.file.readline(), int) 
    196         self.NAUXC = utils.text_parser.readItemFromLine(self.file.readline(), int) 
     195        self.NAUXV = nappy.utils.text_parser.readItemFromLine(self.file.readline(), int) 
     196        self.NAUXC = nappy.utils.text_parser.readItemFromLine(self.file.readline(), int) 
    197197        nonCharAuxVars = self.NAUXV - self.NAUXC 
    198198        if self.NAUXV > 0: 
    199             self.ASCAL = utils.text_parser.readItemsFromUnknownLines(self.file, nonCharAuxVars, float) 
    200             self.AMISS = utils.text_parser.readItemsFromUnknownLines(self.file, nonCharAuxVars, float) 
    201             self.LENA = utils.text_parser.readItemsFromUnknownLines(self.file, self.NAUXC, int) 
     199            self.ASCAL = nappy.utils.text_parser.readItemsFromUnknownLines(self.file, nonCharAuxVars, float) 
     200            self.AMISS = nappy.utils.text_parser.readItemsFromUnknownLines(self.file, nonCharAuxVars, float) 
     201            self.LENA = nappy.utils.text_parser.readItemsFromUnknownLines(self.file, self.NAUXC, int) 
    202202            for i in range(nonCharAuxVars): 
    203203                self.LENA.insert(0, None) 
    204             self.AMISS = self.AMISS + utils.text_parser.readItemsFromUnknownLines(self.file, self.NAUXC, str)     
    205             self.ANAME = utils.text_parser.readItemsFromLines(self._readLines(self.NAUXV), self.NAUXV, str)         
     204            self.AMISS = self.AMISS + nappy.utils.text_parser.readItemsFromUnknownLines(self.file, self.NAUXC, str)     
     205            self.ANAME = nappy.utils.text_parser.readItemsFromLines(self._readLines(self.NAUXV), self.NAUXV, str)         
    206206             
    207207    def _readComments(self): 
     
    210210        Assumes we are at the right point in the file. 
    211211        """         
    212         self.NSCOML = utils.text_parser.readItemFromLine(self.file.readline(), int) 
     212        self.NSCOML = nappy.utils.text_parser.readItemFromLine(self.file.readline(), int) 
    213213        self._readSpecialComments() 
    214         self.NNCOML = utils.text_parser.readItemFromLine(self.file.readline(), int) 
     214        self.NNCOML = nappy.utils.text_parser.readItemFromLine(self.file.readline(), int) 
    215215        self._readNormalComments() 
    216216 
  • nappy/trunk/nappy/na_file/na_file_1001.py

    r3321 r3330  
    1414 
    1515# Imports from local package 
    16 import utils.text_parser 
     16import nappy.utils.text_parser 
    1717import nappy.na_file.na_file 
    1818 
    19 class NAFile1001(nappy.na_file.naFile.NAFile): 
     19class NAFile1001(nappy.na_file.na_file.NAFile): 
    2020    """ 
    2121    Class to read, write and interact with NASA Ames files conforming to the 
     
    2828        """ 
    2929        self._readCommonHeader() 
    30         self.DX = utils.text_parser.readItemsFromLine(self.file.readline(), self.NIV, float) 
    31         self.XNAME = utils.text_parser.readItemsFromLines(self._readLines(self.NIV), self.NIV, str) 
     30        self.DX = nappy.utils.text_parser.readItemsFromLine(self.file.readline(), self.NIV, float) 
     31        self.XNAME = nappy.utils.text_parser.readItemsFromLines(self._readLines(self.NIV), self.NIV, str) 
    3232        self._readVariablesHeaderSection() 
    3333        self._readComments() 
     
    5959        Reads first line/section of current block of data. 
    6060        """ 
    61         (x_and_v, rtlines) = utils.text_parser.readItemsFromUnknownLines(datalines, 1 + self.NV, float) 
     61        (x_and_v, rtlines) = nappy.utils.text_parser.readItemsFromUnknownLines(datalines, 1 + self.NV, float) 
    6262        (x, v) = (x_and_v[0], x_and_v[1:]) 
    6363        self.X.append(x) 
Note: See TracChangeset for help on using the changeset viewer.