Changeset 3221 for inundation/pyvolution
- Timestamp:
- Jun 23, 2006, 5:06:07 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/pyvolution/util.py
r3190 r3221 599 599 surface - if True, then generate solution surface with 3d plot 600 600 and save to current working directory 601 - default = False 601 602 602 603 time_min - beginning of user defined time range for plotting purposes … … 862 863 for j, f in enumerate(f_list): 863 864 if verbose: print 'swwfile %d of %d' %(j, len(f_list)) 865 comparefile = file_loc[j]+sep+'gauges_maxmins'+'.csv' 866 fid_compare = open(comparefile, 'w') 864 867 ##### loop over each gauge ##### 865 868 for k, g in enumerate(gauges): … … 874 877 s = 'Time, Stage, Momentum, Speed \n' 875 878 fid_out.write(s) 879 876 880 #### generate quantities ####### 877 881 for i, t in enumerate(f.get_time()): … … 901 905 s = '%.2f, %.2f, %.2f, %.2f\n' %(t, w, m, vel) 902 906 fid_out.write(s) 907 if t/60.0 <= 13920: tindex = i 903 908 if w > max_stage: max_stage = w 904 909 if w < min_stage: min_stage = w 905 910 if m > max_momentum: max_momentum = m 906 if vel > max_speed: max_speed = vel 907 911 if vel > max_speed: max_speed = vel 912 913 914 s = '%.2f, %.2f, %.2f, %s\n' %(max_stage, min_stage, z, leg_label[j]) 915 fid_compare.write(s) 908 916 max_stages.append(max_stage) 909 917 min_stages.append(min_stage) 910 918 max_momentums.append(max_momentum) 911 max_speeds.append(max_speed) 919 max_speeds.append(max_speed) 912 920 #### finished generating quantities for each swwfile ##### 913 921 914 922 model_time_plot3d[:,:] = model_time[:,:,j] 915 923 stages_plot3d[:,:] = stages[:,:,j] … … 922 930 ax = p3.Axes3D(fig) 923 931 if len(gauges) > 80: 924 ax.plot_surface(eastings,model_time_plot3d,stages_plot3d) 925 #ax.plot_surface(eastings[:,:,j],model_time[:,:,j],stages[:,:,j]) 932 ax.plot_surface(model_time[:,:,j],eastings[:,:,j],stages[:,:,j]) 926 933 else: 927 #ax.plot_wireframe(eastings[:,:,j],model_time[:,:,j],stages[:,:,j]) 928 ax.plot_wireframe(eastings,model_time_plot3d,stages_plot3d) 934 ax.plot_wireframe(model_time[:,:,j],eastings[:,:,j],stages[:,:,j]) 929 935 #ax.plot3D(ravel(eastings[:,:,j]),ravel(model_time[:,:,j]),ravel(stages[:,:,j])) 930 ax.set_xlabel(' x')931 ax.set_ylabel(' time')936 ax.set_xlabel('time') 937 ax.set_ylabel('x') 932 938 ax.set_zlabel('stage') 933 939 fig.add_axes(ax) … … 936 942 p1.savefig(surfacefig) 937 943 p1.close() 938 944 939 945 #### finished generating quantities for all swwfiles ##### 940 946 947 # x profile for given time 948 if surface == True: 949 figure(11) 950 plot(eastings[tindex,:,j],stages[tindex,:,j]) 951 xlabel('x') 952 ylabel('stage') 953 profilefig = 'solution_xprofile' 954 savefig('profilefig') 955 941 956 stage_axis = axis([time_min/60.0, time_max/60.0, min(min_stages), max(max_stages)*1.1]) 942 957 vel_axis = axis([time_min/60.0, time_max/60.0, min(max_speeds), max(max_speeds)*1.1]) 943 mom_axis = axis([time_min/60.0, time_max/60.0, min(max_momentums), max(max_momentums)*1.1]) 944 958 mom_axis = axis([time_min/60.0, time_max/60.0, min(max_momentums), max(max_momentums)*1.1]) 959 945 960 cstr = ['g', 'r', 'b', 'c', 'm', 'y', 'k'] 946 961 nn = len(plot_quantity) … … 1005 1020 xlabel('time (mins)') 1006 1021 ylabel('%s (%s)' %(which_quantity, units)) 1007 legend((leg_label),loc='upper right')1022 if len(label_id) > 1: legend((leg_label),loc='upper right') 1008 1023 1009 1024 gaugeloc1 = gaugeloc.replace(' ','') … … 1040 1055 else: 1041 1056 s = '& \n' 1042 fid.write(s) 1057 fid.write(s) 1058 savefig(graphname_latex) 1043 1059 1044 1060 if title_on == True: … … 1055 1071 1056 1072 word_quantity += ' and ' + plot_quantity[nn-1] 1057 caption = 'Time series for %s at %s gaugelocation (elevation %.2fm)' %(word_quantity, locations[k], elev[k]) #gaugeloc.replace('_',' '))1073 caption = 'Time series for %s at %s location (elevation %.2fm)' %(word_quantity, locations[k], elev[k]) #gaugeloc.replace('_',' ')) 1058 1074 if elev[k] == 0.0: 1059 caption = 'Time series for %s at %s gaugelocation (elevation %.2fm)' %(word_quantity, locations[k], elevations[0,k,j])1075 caption = 'Time series for %s at %s location (elevation %.2fm)' %(word_quantity, locations[k], elevations[0,k,j]) 1060 1076 east = gauges[0] 1061 1077 north = gauges[1] … … 1090 1106 word_quantity += ' and ' + plot_quantity[nn-1] 1091 1107 label = 'gauge%s' %(gaugeloc2) 1092 caption = 'Time series for %s at %s gaugelocation (elevation %.2fm)' %(word_quantity, locations[k], elev[k])1108 caption = 'Time series for %s at %s location (elevation %.2fm)' %(word_quantity, locations[k], elev[k]) 1093 1109 if elev[k] == 0.0: 1094 caption = 'Time series for %s at %s gaugelocation (elevation %.2fm)' %(word_quantity, locations[k], elevations[0,k,j])1110 caption = 'Time series for %s at %s location (elevation %.2fm)' %(word_quantity, locations[k], elevations[0,k,j]) 1095 1111 thisgauge = gauges[k] 1096 1112 east = thisgauge[0]
Note: See TracChangeset
for help on using the changeset viewer.