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 |
---|
2 | and converts it to space separated data x,y,z. |
---|
3 | All you need to do is specify the data file name and output file name |
---|
4 | |
---|
5 | by Ole Nielsen |
---|
6 | modified by Petar Milevski to save to 3 decimal places (to reduce file size) |
---|
7 | """ |
---|
8 | |
---|
9 | import string |
---|
10 | |
---|
11 | infid = open('River2D.bed', 'r') # input file |
---|
12 | outfid = open('csv.csv', 'w') # output filename |
---|
13 | |
---|
14 | for 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)) |
---|
20 | outfid.close() |
---|
21 | infid.close() |
---|
Note: See
TracBrowser
for help on using the repository browser.