Changeset 20890
- Timestamp:
- 07/13/16 10:19:51 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/scripts/BinRead.py
r20219 r20890 18 18 while True: 19 19 try: 20 #Step 1: read the enum to identify this record uniquely21 enum=struct.unpack('i',f.read(struct.calcsize('i')))[0]20 #Step 1: read size of record name 21 recordnamesize=struct.unpack('i',f.read(struct.calcsize('i')))[0] 22 22 except struct.error as e: 23 23 print "probable EOF: %s" % e 24 24 break 25 print "\nenum = %d (%s)" % (enum,EnumToString(enum)[0]) 25 print "\nrecordnamesize = \"%d\"" % (recordnamesize) 26 recordname=struct.unpack('%ds' % recordnamesize,f.read(recordnamesize))[0] 27 print "recordname = '%s'" % recordname 26 28 27 29 #Step 2: read the data itself. … … 110 112 111 113 else: 112 raise TypeError('BinRead error message: data type: %d not supported yet! (%s)' % (code, EnumToString(enum)[0]))114 raise TypeError('BinRead error message: data type: %d not supported yet! (%s)' % (code,recordname)) 113 115 114 116 f.close() … … 163 165 164 166 from MatlabFuncs import * 165 from EnumDefinitions import *166 from EnumToString import EnumToString167 167 168 168 BinRead(args.filin, args.filout)
Note:
See TracChangeset
for help on using the changeset viewer.