""" Convert Easting Northing to lon/lat for ultimately get kml file """ def alter_file(filename,filenameout): from anuga.coordinate_transforms.lat_long_UTM_conversion import UTMtoLL fid = open(filename) lines = fid.readlines() fid.close() fid_out = open(filenameout, 'w') s = '%s,%s,%s\n' %('lon','lat','stage') fid_out.write(s) for line in lines[1:]: fields = line.split(',') easting = float(fields[0]) northing = float(fields[1]) stage = float(fields[3]) lat, lon = UTMtoLL(northing,easting, 50) s = '%f,%f,%f\n' %(lon,lat,stage) fid_out.write(s) fid_out.close() return import project from os import sep #timedir = '20070608_060316_run_final_1.5_onslow_nbartzis' # HAT 1 in Onslow 10000 yr timedir = '20070613_034754_run_final_1.5_dampier_nbartzis' #timedir = '20070906_061418_run_final_1.5_jsexton_exmouth_original' filename = project.outputdir + timedir + sep + 'stage0_interp.csv' #filename = project.outputdir + timedir + sep + 'stage5_interp.csv' #filename = project.outputdir+ timedir + sep + 'stage20_interp.csv' #filename = project.outputdir+ timedir + sep + 'stage80_interp.csv' filename_out = project.outputdir + timedir + sep + 'stage0_convert.csv' #filename_out = project.outputdir + timedir + sep + 'stage5_convert.csv' #filename_out = project.outputdir + timedir + sep + 'stage20_convert.csv' #filename_out = project.outputdir + timedir + sep + 'stage80_convert.csv' alter_file(filename,filename_out)