[GRASS-SVN] r48251 - grass/trunk/scripts/m.proj

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Sep 12 13:57:54 EDT 2011


Author: glynn
Date: 2011-09-12 10:57:54 -0700 (Mon, 12 Sep 2011)
New Revision: 48251

Modified:
   grass/trunk/scripts/m.proj/m.proj.py
Log:
More robust parsing of cs2cs output


Modified: grass/trunk/scripts/m.proj/m.proj.py
===================================================================
--- grass/trunk/scripts/m.proj/m.proj.py	2011-09-12 13:43:24 UTC (rev 48250)
+++ grass/trunk/scripts/m.proj/m.proj.py	2011-09-12 17:57:54 UTC (rev 48251)
@@ -263,16 +263,19 @@
 	if include_header:
 	    outf.write("x%sy%sz\n" % (ofs, ofs))
 	for line in p.stdout:
-	    x, yz = line.split('\t')
-	    y, z = yz.split(' ')
+	    xy, z = line.split(' ', 1)
+	    x, y = xy.split('\t')
 	    outf.write('%s%s%s%s%s\n' % \
                        (x.strip(), ofs, y.strip(), ofs, z.strip()))
     else:
 	if include_header:
 	    outf.write("input_x%sinput_y%sx%sy%sz\n" % (ofs, ofs, ofs, ofs))
 	for line in p.stdout:
-	    inX, therest, z = line.split(' ')
-	    inY, x, y = therest.split('\t')
+            print line
+            inXYZ, x, rest = line.split('\t')
+            print inXYZ
+            inX, inY = inXYZ.split(' ')[:2]
+	    y, z = rest.split(' ', 1)
 	    outf.write('%s%s%s%s%s%s%s%s%s\n' % \
                        (inX.strip(), ofs, inY.strip(), ofs, x.strip(), \
 		        ofs, y.strip(), ofs, z.strip()))



More information about the grass-commit mailing list