NCCOOS Trac Projects: Top | Web | Platforms | Processing | Viz | Sprints | Sandbox | (Wind)

Changeset 255

Show
Ignore:
Timestamp:
11/20/09 23:25:15
Author:
cbc
Message:

Inherit from list.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sodar/branches/scintec-branch/setup.py

    r253 r255  
    1 #!/usr/bin/env python 
    21""" 
    32Installer for sodar package. 
  • sodar/branches/scintec-branch/sodar/scintec/maindata.py

    r253 r255  
    1010__license__ = 'GPL2' 
    1111 
    12 import os 
    13  
    14 class MainData(object): 
     12class MainData(list): 
    1513    """ 
    1614    Class to parse Scintec sodar .mnd files. 
    1715     
     16    Parse the a known good .mnd file: 
     17    >>> main_data = MainData(good_mnd) 
     18     
    1819    Parse the format header: 
    19      
    20     >>> main_data = MainData(good_mnd) 
     20    >>> len(main_data._format_header) 
     21    4 
    2122    >>> main_data._format_header[0] 
    2223    'FORMAT-1' 
     24     
     25    Parse the file header after the format header: 
     26    >>> len(main_data._file_header_body) 
     27    26 
     28    >>> main_data._file_header_body[1] 
     29    '# file information' 
     30     
     31    Parse the profile data: 
     32    >>> len(main_data) 
     33    48 
     34    >>> len(main_data[0]) 
     35    41 
     36    >>> main_data[0][0] 
     37    '2009-11-17 00:30:00 00:30:00' 
     38    >>> main_data[0][-1] 
     39    '200  99.99  999.9  -0.07  99.99  9.99E+37       0' 
     40    >>> len(main_data[-1]) 
     41    41 
     42    >>> main_data[-1][0] 
     43    '2009-11-18 00:00:00 00:30:00' 
     44    >>> main_data[-1][-1] 
     45    '200  15.05   71.8  -0.19   0.53  9.99E+37       0' 
    2346    """ 
    2447     
     
    4467                              for self._line in self._blocks[0].split('\n') 
    4568                              if self._line.strip()] 
    46         self._file_header = [self._line.strip() 
    47                             for self._line in self._blocks[1].split('\n') 
    48                             if self._line.strip()] 
    49         self._profile_blocks = self._blocks[2:] 
    50                              
     69        self._file_header_body = [self._line.strip() 
     70                                  for self._line in self._blocks[1].split('\n') 
     71                                  if self._line.strip()] 
     72        self.extend([[self._line.strip() 
     73                      for self._line in self._block.split('\n') 
     74                      if self._line.strip()] 
     75                     for self._block in self._blocks[2:]]) 
     76 
    5177def _test(): 
    5278    """ 
  • sodar/branches/scintec-branch/sodar/tests/suite.py

    r254 r255  
    1818    setUpData(data_dir,data_file) -> str 
    1919     
    20     Where data_dir is a str representation of a relative path in test/data, and 
    21           data_file is a str representation of a data file within data_dir 
     20    Where data_dir is a str representation of a relative path in tests/data, 
     21    and data_file is a str representation of a data file within data_dir 
    2222    """ 
    2323