source: anuga_work/production/exmouth_2006/convert2latlon.py @ 4949

Last change on this file since 4949 was 4949, checked in by sexton, 16 years ago

(a) minor updates for Cairns example in manual (b) scripts for stratification investigation for other model areas

File size: 1.7 KB
Line 
1"""
2Convert Easting Northing to lon/lat for ultimately get kml file
3"""
4
5def 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
29import project
30from os import sep
31
32#timedir = '20070618_035101_run_final_1.4_dampier_nbartzis' # HAT 1 in Dampier 10000 yr
33#timedir = '20070619_042043_run_final_1.4_onslow_nbartzis' # HAT 1 in Onslow 10000 yr
34timedir = '20070619_042542_run_final_1.4_exmouth_nbartzis' # HAT 1 in Exmouth 10000 yr
35
36filename = project.output_dir + timedir + sep + 'stage0_interp.csv'
37#filename = project.output_dir + timedir + sep + 'stage5_interp.csv'
38#filename = project.output_dir+ timedir + sep + 'stage20_interp.csv'
39#filename = project.output_dir+ timedir + sep + 'stage50_interp.csv'
40#filename = project.output_dir+  timedir + sep + 'stage80_interp.csv'
41filename_out = project.output_dir + timedir + sep + 'stage0_convert.csv'
42#filename_out = project.output_dir + timedir + sep + 'stage5_convert.csv'
43#filename_out = project.output_dir + timedir + sep + 'stage20_convert.csv'
44#filename_out = project.output_dir + timedir + sep + 'stage50_convert.csv'
45#filename_out = project.output_dir + timedir + sep + 'stage80_convert.csv'
46alter_file(filename,filename_out)
Note: See TracBrowser for help on using the repository browser.