Changeset 2908
- Timestamp:
- May 18, 2006, 11:57:18 AM (18 years ago)
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/pyvolution/util.py
r2905 r2908 900 900 def plot_polygons(bounding_polygon, 901 901 interior_polygon, 902 figname, 902 903 verbose = False): 903 904 … … 909 910 910 911 interior_polygon - list of polygons used in create_mesh_from_regions 911 912 913 Output: 914 915 - plot named = polygon_plot.png 916 917 912 913 figname - name to save figure to 914 918 915 """ 919 916 … … 921 918 k = _plot_polygons(bounding_polygon, 922 919 interior_polygon, 920 figname, 923 921 verbose) 924 922 … … 927 925 def _plot_polygons(bounding_polygon, 928 926 interior_polygon, 927 figname, 929 928 verbose = False): 930 929 … … 944 943 for i in range(len(interior_polygon)): 945 944 x_int, y_int = poly_xy(interior_polygon[i]) 946 plot(x_bound,y_bound,'r-',x_int,y_int,' g-')945 plot(x_bound,y_bound,'r-',x_int,y_int,'r-') 947 946 xlabel('x') 948 947 ylabel('y') 949 948 950 savefig( 'polygon_plot')949 savefig(figname) 951 950 952 951 close('all') -
production/onslow_2006/plot_data_extent.py
r2860 r2908 6 6 from utilities.polygon import inside_polygon 7 7 import project 8 8 from pyvolution.util import plot_polygons 9 9 10 10 datadir = project.datadir 11 11 ion() 12 hold(False) 12 13 plot_data = True 14 plot_with_poly = False 15 16 if plot_data == True: 17 file1 = datadir+'onslow_onshore_30m_dted.pts' 18 file2 = datadir+'onslow_offshore_points.xya' 19 20 G1 = Geospatial_data(file_name = file1) 21 G2 = Geospatial_data(file_name = file2) 22 23 pts1 = G1.get_data_points(absolute = True) 24 pts2 = G2.get_data_points(absolute = True) 25 26 if plot_with_poly == True: 27 figname = 'onslow_data_poly' 28 figure(1) 29 plot(pts1[:,0],pts1[:,1],'g.', 30 pts2[:,0],pts2[:,1],'b.') 31 plot_polygons(project.polyAll, 32 [project.poly_onslow, project.poly_coast, project.poly_region], 33 figname, 34 verbose = True) 35 axis([]) 36 savefig(figname) 37 else: 38 figure(2) 39 plot(pts1[:,0],pts1[:,1],'g.', 40 pts2[:,0],pts2[:,1],'b.') 41 xlabel('x') 42 ylabel('y') 43 savefig('onslow_data_extent') 44 else: 13 45 14 file1 = datadir+'onslow_onshore_30m_dted.pts' 15 file2 = datadir+'onslow_offshore_points.xya' 46 figure(3) 47 figname = 'onslow_polys' 48 plot_polygons(project.polyAll, 49 [project.poly_onslow, project.poly_coast, project.poly_region], 50 figname, 51 verbose = True) 16 52 17 G1 = Geospatial_data(file_name = file1) 18 G2 = Geospatial_data(file_name = file2) 19 20 pts1 = G1.get_data_points(absolute = True) 21 pts2 = G2.get_data_points(absolute = True) 22 z1 = G1.get_attributes() 23 z2 = G2.get_attributes() 24 25 minz1 = min(z1) 26 maxz1 = max(z1) 27 minz2 = min(z2) 28 maxz2 = max(z2) 29 30 print '' 31 print 'Offshore elevation in range [%.2f %.2f] ' %(minz1, maxz1) 32 print 'Onshore elevation in range [%.2f %.2f] ' %(minz2, maxz2) 33 print '' 34 35 minelev = min(minz1,minz2) 36 maxelev = max(maxz1,maxz2) 37 38 # bounding polygon for Onslow scenario 39 polygon_bound = project.polyAll 40 41 x_bound = [] 42 y_bound = [] 43 n = len(polygon_bound) 44 for i in range(n+1): 45 if i == n: 46 thispt = polygon_bound[0] 47 else: 48 thispt = polygon_bound[i] 49 x_bound.append(thispt[0]) 50 y_bound.append(thispt[1]) 51 52 # interior regions 53 figure(1) 54 plot(pts1[:,0],pts1[:,1],'g.', 55 pts2[:,0],pts2[:,1],'b.', 56 x_bound,y_bound,'r-') 57 #title('Offhore (g) and onshore (b) data: Onslow scenario. \n Elevation in range [%.2f %.2f]' %(minelev, maxelev)) 58 xlabel('x') 59 ylabel('y') 60 savefig('onslow_data_extent') 61 62 53 close('all') -
production/pt_hedland_2006/run_pt_hedland.py
r2904 r2908 139 139 count += 1 140 140 141 figname = 'pt_hedland_polys' 141 142 plot_polygons(project.polyAll, 142 143 [project.poly_pt_hedland, project.poly_region], 144 figname, 143 145 verbose = True) 144 146 … … 147 149 else: 148 150 print 'check out your interior polygons' 149 print 'check polygon_plot.png in production directory'151 print 'check %s in production directory' %figname 150 152 import sys; sys.exit() 151 153
Note: See TracChangeset
for help on using the changeset viewer.