Changeset 3909
- Timestamp:
- Nov 2, 2006, 9:29:04 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/abstract_2d_finite_volumes/util.py
r3900 r3909 752 752 753 753 #Fixme - Use geospatial to read this file - it's an xya file 754 #Need to include other information into this filename, so xya + Name - required for report 754 755 def get_gauges_from_file(filename): 755 756 from os import sep, getcwd, access, F_OK, mkdir … … 763 764 line1 = lines[0] 764 765 line11 = line1.split(',') 766 east_index = len(line11)+1 767 north_index = len(line11)+1 768 name_index = len(line11)+1 769 elev_index = len(line11)+1 765 770 for i in range(len(line11)): 766 if line11[i].strip('\n').strip(' ') == 'Easting': east_index = i767 if line11[i].strip('\n').strip(' ') == 'Northing': north_index = i768 if line11[i].strip('\n').strip(' ') == 'Name': name_index = i769 if line11[i].strip('\n').strip(' ') == 'Elevation': elev_index = i771 if line11[i].strip('\n').strip(' ').title() == 'Easting': east_index = i 772 if line11[i].strip('\n').strip(' ').title() == 'Northing': north_index = i 773 if line11[i].strip('\n').strip(' ').title() == 'Name': name_index = i 774 if line11[i].strip('\n').strip(' ').title() == 'Elevation': elev_index = i 770 775 771 776 for line in lines[1:]: 772 777 fields = line.split(',') 773 gauges.append([float(fields[east_index]), float(fields[north_index])]) 774 elev.append(float(fields[elev_index])) 775 loc = fields[name_index] 776 gaugelocation.append(loc.strip('\n')) 778 if east_index < len(line11) and north_index < len(line11): 779 gauges.append([float(fields[east_index]), float(fields[north_index])]) 780 else: 781 msg = 'WARNING: %s does not contain location information' %(filename) 782 raise Exception, msg 783 if elev_index < len(line11): elev.append(float(fields[elev_index])) 784 if name_index < len(line11): 785 loc = fields[name_index] 786 gaugelocation.append(loc.strip('\n')) 777 787 778 788 return gauges, gaugelocation, elev … … 944 954 ax.plot_surface(model_time[:,:,j],eastings[:,:,j],stages[:,:,j]) 945 955 else: 946 ax.plot_wireframe(model_time[:,:,j],eastings[:,:,j],stages[:,:,j])947 #ax.plot3D(ravel(eastings[:,:,j]),ravel(model_time[:,:,j]),ravel(stages[:,:,j]))956 #ax.plot_wireframe(model_time[:,:,j],eastings[:,:,j],stages[:,:,j]) 957 ax.plot3D(ravel(eastings[:,:,j]),ravel(model_time[:,:,j]),ravel(stages[:,:,j])) 948 958 ax.set_xlabel('time') 949 959 ax.set_ylabel('x') … … 966 976 savefig('profilefig') 967 977 968 stage_axis = axis([time_min/60.0, time_max/60.0, min(min_stages), max(max_stages)*1.1]) 978 #stage_axis = axis([time_min/60.0, time_max/60.0, min(min_stages), max(max_stages)*1.1]) 979 stage_axis = axis([time_min/60.0, time_max/60.0, -3.0, 3.0]) 969 980 vel_axis = axis([time_min/60.0, time_max/60.0, min(max_speeds), max(max_speeds)*1.1]) 970 981 mom_axis = axis([time_min/60.0, time_max/60.0, min(max_momentums), max(max_momentums)*1.1]) … … 1093 1104 fid.write(s) 1094 1105 c += 1 1095 if c % 25== 0: fid.write('\\clearpage \n')1106 if c % 6 == 0: fid.write('\\clearpage \n') 1096 1107 savefig(graphname_latex) 1097 1108 … … 1129 1140 fid.write(s) 1130 1141 c += 1 1131 if c % 25== 0: fid.write('\\clearpage \n')1142 if c % 6 == 0: fid.write('\\clearpage \n') 1132 1143 1133 1144 #### finished generating figures ###
Note: See TracChangeset
for help on using the changeset viewer.