[4927] | 1 | """ |
---|
| 2 | Convert Easting Northing to lon/lat for ultimately get kml file |
---|
| 3 | """ |
---|
| 4 | |
---|
| 5 | def alter_file(filename,filenameout): |
---|
| 6 | |
---|
| 7 | from anuga.coordinate_transforms.lat_long_UTM_conversion import UTMtoLL |
---|
| 8 | |
---|
| 9 | fid = open(filename) |
---|
| 10 | lines = fid.readlines() |
---|
| 11 | fid.close() |
---|
| 12 | |
---|
| 13 | fid_out = open(filenameout, 'w') |
---|
| 14 | s = '%s,%s,%s\n' %('lon','lat','stage') |
---|
| 15 | fid_out.write(s) |
---|
| 16 | for line in lines[1:]: |
---|
| 17 | fields = line.split(',') |
---|
| 18 | easting = float(fields[0]) |
---|
| 19 | northing = float(fields[1]) |
---|
| 20 | stage = float(fields[3]) |
---|
| 21 | lat, lon = UTMtoLL(northing,easting, 50) |
---|
| 22 | s = '%f,%f,%f\n' %(lon,lat,stage) |
---|
| 23 | fid_out.write(s) |
---|
| 24 | |
---|
| 25 | fid_out.close() |
---|
| 26 | |
---|
| 27 | return |
---|
| 28 | |
---|
| 29 | import project |
---|
| 30 | from os import sep |
---|
| 31 | |
---|
| 32 | timedir='20070613_044204_run_final_3.6_exmouth_nbartzis' |
---|
[4949] | 33 | #timedir='20070613_061053_run_final_3.6_onslow_nbartzis' |
---|
| 34 | |
---|
| 35 | #filename = project.outputdir + timedir + sep + 'stage0_interp.csv' |
---|
| 36 | filename = project.outputdir + timedir + sep + 'stage5_interp.csv' |
---|
[4927] | 37 | #filename = project.outputdir+ timedir + sep + 'stage20_interp.csv' |
---|
[4949] | 38 | #filename = project.outputdir+ timedir + sep + 'stage50_interp.csv' |
---|
| 39 | #filename_out = project.outputdir + timedir + sep + 'stage0_convert.csv' |
---|
| 40 | filename_out = project.outputdir + timedir + sep + 'stage5_convert.csv' |
---|
[4927] | 41 | #filename_out = project.outputdir + timedir + sep + 'stage20_convert.csv' |
---|
[4949] | 42 | #filename_out = project.outputdir + timedir + sep + 'stage50_convert.csv' |
---|
[4927] | 43 | alter_file(filename,filename_out) |
---|