Last change
on this file since 6855 was
5245,
checked in by sexton, 17 years ago
|
(1) update of production processes document (2) test for generating points for URS output (3) update of graduate proposal
|
File size:
984 bytes
|
Line | |
---|
1 | """ |
---|
2 | Convert DB's data from lat/long to easting/northing |
---|
3 | |
---|
4 | """ |
---|
5 | |
---|
6 | def alter_file(filename,filenameout): |
---|
7 | |
---|
8 | from anuga.coordinate_transforms.redfearn import redfearn |
---|
9 | |
---|
10 | fid = open(filename) |
---|
11 | lines = fid.readlines() |
---|
12 | fid.close() |
---|
13 | |
---|
14 | fid_out = open(filenameout, 'w') |
---|
15 | s = '%s,%s,%s\n' %('easting','northing','zone') |
---|
16 | fid_out.write(s) |
---|
17 | for line in lines[1:]: |
---|
18 | fields = line.split(',') |
---|
19 | #x = float(fields[1]) |
---|
20 | #y = float(fields[0]) |
---|
21 | x = float(fields[0]) |
---|
22 | y = float(fields[1]) |
---|
23 | zone, easting, northing = redfearn(x,y) |
---|
24 | s = '%f,%f,%f\n' %(easting,northing,zone) |
---|
25 | fid_out.write(s) |
---|
26 | |
---|
27 | fid_out.close() |
---|
28 | |
---|
29 | return |
---|
30 | |
---|
31 | import project |
---|
32 | |
---|
33 | #filename = project.gaugedir + 'db_points.txt' |
---|
34 | #filename_out = project.gaugedir + 'db_points_convert.txt' |
---|
35 | filename = project.gaugedir + 'aus_hazard_pts.txt' |
---|
36 | filename_out = project.gaugedir + 'aus_hazard_pts_en.txt' |
---|
37 | alter_file(filename,filename_out) |
---|
38 | |
---|
Note: See
TracBrowser
for help on using the repository browser.