Changeset 20097
- Timestamp:
- 02/09/16 10:48:17 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/scripts/BinRead.py
r16306 r20097 6 6 import math 7 7 import struct 8 import argparse 9 from MatlabFuncs import * 10 from EnumDefinitions import * 11 from EnumToString import EnumToString 8 12 9 def BinRead(filin,filout=''): 10 11 from MatlabFuncs import * 12 from EnumDefinitions import * 13 from EnumToString import EnumToString 13 def BinRead(filin,filout=''): #{{{ 14 14 15 15 print "reading binary file." … … 105 105 106 106 elif code == FormatToCode('MatArray'): 107 f id.seek(reclen-4,1)107 f.seek(reclen-4,1) 108 108 print "skipping %d bytes for code %d." % (code, reclen-4) 109 109 110 110 elif code == FormatToCode('StringArray'): 111 f id.seek(reclen-4,1)111 f.seek(reclen-4,1) 112 112 print "skipping %d bytes for code %d." % (code, reclen-4) 113 113 … … 116 116 117 117 f.close() 118 118 #}}} 119 119 def FormatToCode(format): # {{{ 120 120 """ … … 123 123 sent. 124 124 """ 125 from MatlabFuncs import *126 125 127 126 if strcmpi(format,'Boolean'): … … 149 148 # }}} 150 149 151 if __name__ == '__main__': 150 if __name__ == '__main__': #{{{ 152 151 if 'PYTHONSTARTUP' in os.environ: 153 152 PYTHONSTARTUP=os.environ['PYTHONSTARTUP'] … … 161 160 print "PYTHONSTARTUP file '%s' does not exist." % PYTHONSTARTUP 162 161 163 import argparse164 162 parser = argparse.ArgumentParser(description='BinRead - function to read binary input file.') 165 163 parser.add_argument('-f','--filin', help='name of binary input file', default='') 164 parser.add_argument('-o','--filout', help='optional name of text output file', default='') 166 165 args = parser.parse_args() 167 166 168 BinRead(args.filin )169 167 BinRead(args.filin, args.filout) 168 #}}}
Note:
See TracChangeset
for help on using the changeset viewer.