source: anuga_work/production/sydney_2006/convert_survey_data.py @ 4058

Last change on this file since 4058 was 4056, checked in by sexton, 18 years ago

update sydney script based on survey data

File size: 1.3 KB
Line 
1"""
2Convert Continental Slope Survey data from lat/long to easting/northing
3and ensure elevation data is negative!
4
5Jane Sexton Dec 2006
6"""
7
8def alter_file(filename,filenameout):
9
10    from anuga.coordinate_transforms.redfearn import redfearn
11   
12    fid = open(filename)
13    lines = fid.readlines()
14    fid.close()
15   
16    fid_out = open(filenameout, 'w')
17    for line in lines[1:]:
18       fields = line.split(',')
19       x = float(fields[0])
20       y = float(fields[1])
21       zone, easting, northing = redfearn(x,y)
22       z = -float(fields[2])
23       s = '%f,%f,%f\n' %(easting,northing,z)
24       fid_out.write(s)
25
26    fid_out.close() 
27
28    return
29
30import project_slide
31
32filename1 = project_slide.datadir + 'yxz_Area_A_LL_100mInterp.xya'
33filename2 = project_slide.datadir + 'yxz_Area_B_LL_100mInterp.xya'
34filename3 = project_slide.datadir + 'yxz_Area_C_LL_100mInterp.xya'
35
36filenameout1 = project_slide.datadir + 'surveyAreaA.xya'
37filenameout2 = project_slide.datadir + 'surveyAreaB.xya'
38filenameout3 = project_slide.datadir + 'surveyAreaC.xya'
39
40files = [filename1, filename2, filename3]
41fileouts = [filenameout1, filenameout2, filenameout3]
42
43for i, eachfile in enumerate(files):
44    print 'File ', i, eachfile
45    alter_file(eachfile,fileouts[i])
Note: See TracBrowser for help on using the repository browser.