Changeset 253
- Timestamp:
- 11/19/09 17:37:10
- Files:
-
- sodar/branches/scintec-branch/setup.py (modified) (2 diffs)
- sodar/branches/scintec-branch/sodar/scintec/maindata.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sodar/branches/scintec-branch/setup.py
r239 r253 3 3 Installer for sodar package. 4 4 """ 5 6 __author__ = 'Chris Calloway' 7 __email__ = 'cbc@chriscalloway.org' 8 __copyright__ = 'Copyright 2009 UNC-CH Department of Marine Science' 9 __license__ = 'GPL2' 5 10 6 11 from setuptools import setup, find_packages … … 34 39 entry_points=""" 35 40 """, 41 test_suite='sodar.tests.suite.test_suite', 36 42 ) sodar/branches/scintec-branch/sodar/scintec/maindata.py
r251 r253 1 1 """ 2 2 Module to handle Scintec sodar .mnd files. 3 4 >>> from sodar.scintec import maindata 3 5 """ 4 6 … … 16 18 Parse the format header: 17 19 18 >>> main_data = MainData( _testSetUp('good','091117.mnd'))19 >>> main_data. format_header[0]20 >>> main_data = MainData(good_mnd) 21 >>> main_data._format_header[0] 20 22 'FORMAT-1' 21 23 """ … … 29 31 Where mnd is a str object containing the complete contents read from a 30 32 Scintec .mnd daily sodar file including all line endings. 33 34 Parse a known good .mnd file: 35 36 >>> main_data = MainData(good_mnd) 31 37 """ 32 38 33 39 super(MainData, self).__init__() 34 self. blocks = [block.strip()35 for block in mnd.split('\n\n')36 if block.strip()]37 self. format_header = [line.strip()38 for line in self.blocks[0].split('\n')39 if line.strip()]40 self. file_header = [line.strip()41 for line in self.blocks[1].split('\n')42 if line.strip()]43 self. profile_blocks = self.blocks[2:]40 self._blocks = [self._block.strip() 41 for self._block in mnd.split('\n\n') 42 if self._block.strip()] 43 self._format_header = [self._line.strip() 44 for self._line in self._blocks[0].split('\n') 45 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:] 44 50 45 def _testSetUp(mnd_dir,mnd_file):46 module_dir = os.path.abspath(os.path.dirname(__file__))47 package_dir = os.path.split(module_dir)[0]48 mnd_file = os.path.join(package_dir,'tests','data',mnd_dir,mnd_file)49 mnd = open(mnd_file).read()50 return mnd51 52 51 def _test(): 52 """ 53 Run module tests in script mode. 54 55 >>> from sodar.scintec.maindata import _test 56 """ 53 57 import doctest 54 doctest.testmod() 58 from sodar.tests import suite 59 good_mnd = suite.setUpGoodMndData() 60 doctest.testmod(extraglobs=dict(good_mnd=good_mnd)) 55 61 56 62 if __name__ == "__main__":