Index: /issm/trunk-jpl/scripts/BinRead.py
===================================================================
--- /issm/trunk-jpl/scripts/BinRead.py	(revision 20096)
+++ /issm/trunk-jpl/scripts/BinRead.py	(revision 20097)
@@ -6,10 +6,10 @@
 import math
 import struct
+import argparse
+from MatlabFuncs import *
+from EnumDefinitions import *
+from EnumToString import EnumToString
 
-def BinRead(filin,filout=''):
-
-	from MatlabFuncs import *
-	from EnumDefinitions import *
-	from EnumToString import EnumToString
+def BinRead(filin,filout=''): #{{{
 
 	print "reading binary file."
@@ -105,9 +105,9 @@
 
 		elif code == FormatToCode('MatArray'):
-			fid.seek(reclen-4,1)
+			f.seek(reclen-4,1)
 			print "skipping %d bytes for code %d." % (code, reclen-4)
 
 		elif code == FormatToCode('StringArray'):
-			fid.seek(reclen-4,1)
+			f.seek(reclen-4,1)
 			print "skipping %d bytes for code %d." % (code, reclen-4)
 
@@ -116,5 +116,5 @@
 
 	f.close()
-
+#}}}
 def FormatToCode(format): # {{{
 	"""
@@ -123,5 +123,4 @@
 	sent.
 	"""
-	from MatlabFuncs import *
 
 	if   strcmpi(format,'Boolean'):
@@ -149,5 +148,5 @@
 # }}}
 
-if __name__ == '__main__':
+if __name__ == '__main__': #{{{
 	if 'PYTHONSTARTUP' in os.environ:
 		PYTHONSTARTUP=os.environ['PYTHONSTARTUP']
@@ -161,9 +160,9 @@
 			print "PYTHONSTARTUP file '%s' does not exist." % PYTHONSTARTUP
 
-	import argparse
 	parser = argparse.ArgumentParser(description='BinRead - function to read binary input file.')
 	parser.add_argument('-f','--filin', help='name of binary input file', default='')
+	parser.add_argument('-o','--filout', help='optional name of text output file', default='')
 	args = parser.parse_args()
 
-	BinRead(args.filin)
-
+	BinRead(args.filin, args.filout)
+#}}}
