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

Changeset 301

Show
Ignore:
Timestamp:
12/09/09 19:01:43
Author:
cbc
Message:

Fix for Windows .mnd files binary copied to Unix.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sodar/trunk/sodar/tests/suite.py

    r296 r301  
    5959    mnd_file = '091117.mnd' 
    6060    mnd,mnd_path = setUpData(mnd_dir,mnd_file) 
    61     profile = mnd.split('\n\n')[2].split('\n') 
     61    EOL = '\r\n' # Windows file binary copied to Unix 
     62    def divide(mnd,eol): 
     63        blocks = [block.strip() 
     64                  for block 
     65                  in mnd.split(eol*2) 
     66                  if block.strip()] 
     67        if len(blocks) < 2: 
     68            eol = '\n' # Windows to Windows or Unix to Unix 
     69            blocks, eol = divide(mnd,eol) 
     70        return (blocks,eol) 
     71    blocks,EOL = divide(mnd,EOL) 
     72    profile = blocks[2].split(EOL) 
    6273    profile = [line.strip() for line in profile if line] 
    6374    variables = profile[1].split()[1:]