source: trunk/anuga_work/development/tools/r2d/River2DBED_csv.py @ 8866

Last change on this file since 8866 was 5780, checked in by ole, 17 years ago

Added contributed code from Petar Milevski

File size: 634 bytes
Line 
1""" This scrip takes a River2D csv output file of format node no.,x,y,z,roughness
2and converts it to space separated data x,y,z.
3All you need to do is specify the data file name and output file name
4
5by Ole Nielsen
6modified by Petar Milevski to save to 3 decimal places (to reduce file size)
7"""
8
9import string
10
11infid = open('River2D.bed', 'r') # input file
12outfid = open('csv.csv', 'w') # output filename
13
14for line in infid.readlines():
15    fields = line.split(' ')
16    x=float(fields[1])
17    y=float(fields[2])
18    z=float(fields[3])
19    outfid.write('%.3f,%.3f,%.3f\n' %(x, y, z))
20outfid.close()
21infid.close()
Note: See TracBrowser for help on using the repository browser.