""" This scrip takes a River2D csv output file of format node no.,x,y,z,roughness and converts it to space separated data x,y,z. All you need to do is specify the data file name and output file name by Ole Nielsen modified by Petar Milevski to save to 3 decimal places (to reduce file size) """ import string infid = open('River2D.bed', 'r') # input file outfid = open('csv.csv', 'w') # output filename for line in infid.readlines(): fields = line.split(' ') x=float(fields[1]) y=float(fields[2]) z=float(fields[3]) outfid.write('%.3f,%.3f,%.3f\n' %(x, y, z)) outfid.close() infid.close()