Changeset 3944
- Timestamp:
- Nov 8, 2006, 5:16:44 PM (16 years ago)
- Files:
-
- 1 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/documentation/user_manual/anuga_user_manual.tex
r3925 r3944 3219 3219 http://www.mssanz.org.au/modsim05/papers/nielsen.pdf 3220 3220 3221 3221 \bibitem[grid250]{grid250} 3222 Australian Bathymetry and Topography Grid, June 2005. 3223 Webster, M.A. and Petkovic, P. 3224 Geoscience Australia Record 2005/12. ISBN: 1-920871-46-2.\\ 3225 http://www.ga.gov.au/meta/ANZCW0703008022.html 3222 3226 3223 3227 -
anuga_core/documentation/user_manual/examples/project.py
r3869 r3944 45 45 # demo poly 46 46 j0 = [385000, 6280000] 47 j1 = [360000, 627 2500]48 j2 = [335000, 627 2500]47 j1 = [360000, 6273000] 48 j2 = [335000, 6273000] 49 49 j3 = [330000, 6265000] 50 50 j31 = [325000, 6260000] 51 51 j4 = [316000, 6260000] 52 j5 = [316000, 624 7000]53 j6 = [350000, 624 7000]52 j5 = [316000, 6246750] 53 j6 = [350000, 6246750] 54 54 j7 = [385000, 6238000] 55 55 56 56 demopoly = [j0, j1, j2, j3, j31, j4, j5, j6, j7] 57 57 58 from utilities.polygon import read_polygon 59 polygonptsfile4 = polygondir + 'poly1' 60 polygonptsfile0 = polygondir + 'poly2' 61 polygonptsfile1 = polygondir + 'poly3' 62 polygonptsfile2 = polygondir + 'poly4' 63 polygonptsfile3 = polygondir + 'poly5' 64 northern_polygon = read_polygon(polygonptsfile0 + '.csv') 65 manly_polygon = read_polygon(polygonptsfile1 + '.csv') 66 harbour_polygon = read_polygon(polygonptsfile2 + '.csv') 67 southern_polygon = read_polygon(polygonptsfile3 + '.csv') 68 top_polygon = read_polygon(polygonptsfile4 + '.csv') 58 from anuga.utilities.polygon import read_polygon, plot_polygons 59 #polygonptsfile4 = polygondir + 'poly1' 60 #polygonptsfile0 = polygondir + 'poly2' 61 #polygonptsfile1 = polygondir + 'poly3' 62 #polygonptsfile2 = polygondir + 'poly4' 63 #polygonptsfile3 = polygondir + 'poly5' 64 #northern_polygon = read_polygon(polygonptsfile0 + '.csv') 65 #manly_polygon = read_polygon(polygonptsfile1 + '.csv') 66 #harbour_polygon = read_polygon(polygonptsfile2 + '.csv') 67 #southern_polygon = read_polygon(polygonptsfile3 + '.csv') 68 #top_polygon = read_polygon(polygonptsfile4 + '.csv') 69 coastal_polygon = read_polygon(polygondir+'coastal'+'.csv') 70 shallow_polygon = read_polygon(polygondir+'shallow'+'.csv') 71 72 #plot_polygons([demopoly,northern_polygon,manly_polygon,harbour_polygon,southern_polygon,top_polygon],'model_setup',verbose=False) 73 plot_polygons([demopoly,coastal_polygon,shallow_polygon],'new_model_setup',verbose=False) 69 74 70 75 slump_origin = [372500.0, 6255000.0] #Absolute UTM -
anuga_core/documentation/user_manual/examples/runsydney.py
r3869 r3944 59 59 # Interior regions and mesh resolutions 60 60 interior_res = 5000 61 interior_regions = [[project.northern_polygon, interior_res], 62 [project.harbour_polygon, interior_res], 63 [project.southern_polygon, interior_res], 64 [project.manly_polygon, interior_res], 65 [project.top_polygon, interior_res]] 66 61 shallow_res = 15000 62 ##interior_regions = [[project.northern_polygon, interior_res], 63 ## [project.harbour_polygon, interior_res], 64 ## [project.southern_polygon, interior_res], 65 ## [project.manly_polygon, interior_res], 66 ## [project.top_polygon, interior_res]] 67 interior_regions = [[project.coastal_polygon, interior_res], 68 [project.shallow_polygon, shallow_res]] 67 69 68 70 create_mesh_from_regions(project.demopoly, -
anuga_core/source/anuga/abstract_2d_finite_volumes/util.py
r3939 r3944 681 681 682 682 assert type(gauge_filename) == type(''),\ 683 683 'Gauge filename must be a string' 684 684 685 685 try: … … 693 693 report = False 694 694 695 696 695 if plot_quantity is None: 697 696 plot_quantity = ['depth', 'speed', 'bearing'] … … 733 732 verbose = True, 734 733 use_cache = True) 735 734 735 # determine which gauges are contained in sww file 736 count = 0 737 gauge_index = [] 738 print 'swwfile', swwfile 739 for k, g in enumerate(gauges): 740 if f(0.0, point_id = k)[2] > 1.0e6: 741 count += 1 742 if count == 1: print 'Gauges not contained here:' 743 print locations[k] 744 else: 745 gauge_index.append(k) 746 747 if len(gauge_index) > 0: 748 print 'Gauges contained here: \n', 749 else: 750 print 'No gauges contained here. \n' 751 for i in range(len(gauge_index)): 752 print locations[gauge_index[i]] 753 736 754 index = swwfile.rfind(sep) 737 755 file_loc.append(swwfile[:index+1]) … … 759 777 raise Exception, msg 760 778 761 if verbose: print 'Inputs OK - going to generate figures' 762 763 return generate_figures(plot_quantity, file_loc, report, reportname, surface, 764 leg_label, f_list, gauges, locations, elev, production_dirs, 765 time_min, time_max, title_on, label_id, verbose) 779 if verbose and len(gauge_index) > 0: print 'Inputs OK - going to generate figures' 780 781 if len(gauge_index) <> 0: 782 texfile, elev_output = generate_figures(plot_quantity, file_loc, report, reportname, surface, 783 leg_label, f_list, gauges, locations, elev, gauge_index, 784 production_dirs, time_min, time_max, title_on, label_id, verbose) 785 else: 786 texfile = '' 787 elev_output = [] 788 789 return texfile, elev_output 766 790 767 791 #Fixme - Use geospatial to read this file - it's an xya file 768 792 #Need to include other information into this filename, so xya + Name - required for report 769 793 def get_gauges_from_file(filename): 794 """ Read in gauge information from file 795 """ 770 796 from os import sep, getcwd, access, F_OK, mkdir 771 797 fid = open(filename) … … 803 829 804 830 def check_list(quantity): 805 831 """ Check that input quantities in quantity list are possible 832 """ 806 833 all_quantity = ['stage', 'depth', 'momentum', 'xmomentum', 807 834 'ymomentum', 'speed', 'bearing', 'elevation'] … … 817 844 818 845 def calc_bearing(uh, vh): 819 846 """ Calculate velocity bearing from North 847 """ 820 848 from math import atan, degrees 821 849 … … 836 864 837 865 def generate_figures(plot_quantity, file_loc, report, reportname, surface, 838 leg_label, f_list, 839 gauges, locations, elev, production_dirs, time_min, time_max, 840 title_on, label_id, verbose): 841 866 leg_label, f_list, gauges, locations, elev, gauge_index, 867 production_dirs, time_min, time_max, title_on, label_id, 868 verbose): 869 """ Generate figures based on required quantities and gauges for each sww file 870 """ 842 871 from math import sqrt, atan, degrees 843 872 from Numeric import ones, allclose, zeros, Float, ravel … … 849 878 if surface is True: 850 879 import mpl3d.mplot3d as p3 851 880 852 881 if report == True: 853 882 texdir = getcwd()+sep+'report'+sep … … 904 933 fid_compare = open(comparefile, 'w') 905 934 ##### loop over each gauge ##### 906 for k, g in enumerate(gauges): 935 for k in gauge_index: 936 g = gauges[k] 907 937 if verbose: print 'Gauge %d of %d' %(k, len(gauges)) 908 938 min_stage = 10 … … 992 1022 savefig('profilefig') 993 1023 994 #stage_axis = axis([time_min/60.0, time_max/60.0, min(min_stages), max(max_stages)*1.1])995 stage_axis = axis([time_min/60.0, time_max/60.0, -3.0, 3.0])1024 stage_axis = axis([time_min/60.0, time_max/60.0, min(min_stages), max(max_stages)*1.1]) 1025 #stage_axis = axis([time_min/60.0, time_max/60.0, -3.0, 3.0]) 996 1026 vel_axis = axis([time_min/60.0, time_max/60.0, min(max_speeds), max(max_speeds)*1.1]) 997 1027 mom_axis = axis([time_min/60.0, time_max/60.0, min(max_momentums), max(max_momentums)*1.1]) … … 1002 1032 elev_output = [] 1003 1033 if len(label_id) > 1: graphname_report = [] 1004 for k, g in enumerate(gauges): 1034 for k in gauge_index: 1035 g = gauges[k] 1005 1036 count1 = 0 1006 1037 if report == True and len(label_id) > 1: … … 1008 1039 fid.write(s) 1009 1040 if len(label_id) > 1: graphname_report = [] 1010 #### generate figures for each gauge ### 1041 #### generate figures for each gauge #### 1011 1042 for j, f in enumerate(f_list): 1012 1043 ion() … … 1109 1140 word_quantity += plot_quantity[i] 1110 1141 1111 word_quantity += ' and ' + plot_quantity[nn-1] 1142 word_quantity += ' and ' + plot_quantity[nn-1] 1112 1143 caption = 'Time series for %s at %s location (elevation %.2fm)' %(word_quantity, locations[k], elev[k]) #gaugeloc.replace('_',' ')) 1113 1144 if elev[k] == 0.0: … … 1164 1195 return texfile2, elev_output 1165 1196 1197 1198 def gauge_in_sww(swwfile, 1199 gauge_filename, 1200 verbose = False): 1201 1202 """ Determine which gauges fall in sww file. 1203 1204 Input variables: 1205 1206 swwfiles - sww files 1207 1208 gauge_filename - name of file containing gauge data 1209 - easting, northing, name , elevation 1210 - OR (this is not yet done) 1211 - structure which can be converted to a Numeric array, 1212 such as a geospatial data object 1213 1214 Output: 1215 1216 - Modified gauge_filename containing gauges which fall is given sww file. 1217 Name = gauges_filename_mod 1218 Other important information: 1219 1220 """ 1221 1222 1223 k = _gauge_in_sww(swwfile, 1224 gauge_filename, 1225 verbose) 1226 1227 return k 1228 1229 def _gauge_in_sww(swwfile, 1230 gauge_filename, 1231 verbose = False): 1232 1233 try: 1234 fid = open(swwfile) 1235 except Exception, e: 1236 msg = 'File "%s" could not be opened: Error="%s"'\ 1237 %(swwfile, e) 1238 raise msg 1239 1240 assert type(gauge_filename) == type(''),\ 1241 'Gauge filename must be a string' 1242 1243 try: 1244 fid = open(gauge_filename) 1245 except Exception, e: 1246 msg = 'File "%s" could not be opened: Error="%s"'\ 1247 %(gauge_filename, e) 1248 raise msg 1249 1250 sww_quantity = ['stage', 'elevation', 'xmomentum', 'ymomentum'] 1251 f = file_function(swwfile, 1252 quantities = sww_quantity, 1253 #interpolation_points = gauges, 1254 verbose = True, 1255 use_cache = True) 1256 print dir(f) 1257 1258 #from bstract_2d_finite_volumes.neighbour_mesh import get_boundary_polygon 1259 from anuga.abstract_2d_finite_volumes.neighbour_mesh import Mesh 1260 #from anuga.fit_interpolate.general_fit_interpolate import FitInterpolate 1261 #from anuga.fit_interpolate.interpolate import Interpolation_function 1262 from anuga.fit_interpolate.interpolate import Interpolate 1263 1264 test = Mesh(f.vertex_coordinates) 1265 print test.mesh.get_boundary_polygon() 1266 1267 return check_gauge(gauge_filename,bounding_polygon) 1268 1269 def check_gauge(gauge_filename,bounding_polygon): 1270 1271 from anuga.utilities.polygon import is_inside_polygon 1272 1273 filename_out = gauge_filename + '_mod' 1274 fid_out = open(filename_out, 'w') 1275 fid_out.write(s) 1276 1277 gauges, locations, elev = get_gauges_from_file(gauge_filename) 1278 1279 for i, gauge in enumerate(gauges): 1280 v = is_inside_polygon(gauge,bounding_polygon,verbose=False) 1281 if v == True: 1282 s = '%.2f, %.2f, %.2f, %s\n' %(gauges[0], gauges[1], elev[i], locations[i]) 1283 1284 return fid_out 1285 1166 1286 from os.path import basename 1167 1287 -
anuga_work/development/cairns_2006/run_cairns.py
r3846 r3944 9 9 #------------------------------- 10 10 import sys, os 11 from anuga. pyvolution.shallow_water import Domain, Reflective_boundary,\11 from anuga.shallow_water import Domain, Reflective_boundary,\ 12 12 File_boundary, Transmissive_Momentum_Set_Stage_boundary,\ 13 13 Transmissive_boundary, Dirichlet_boundary 14 from anuga.pyvolution.mesh_factory import rectangular_cross 15 from anuga.pyvolution.pmesh2domain import pmesh_to_domain_instance 14 #from anuga.pyvolution.mesh_factory import rectangular_cross 15 #from anuga.pmesh2domain import pmesh_to_domain_instance 16 from anuga.pmesh.mesh_interface import create_mesh_from_regions 16 17 from Numeric import array, zeros, Float, allclose 17 18 import cairns_project as project … … 41 42 """ 42 43 43 domain = cache(pmesh_to_domain_instance, 44 (project.mesh_filename, Domain), 45 dependencies = [project.mesh_filename]) 44 #cache(pmesh_to_domain_instance, 45 # (project.mesh_filename, Domain), 46 # dependencies = [project.mesh_filename]) 47 domain = Domain(project.mesh_filename, use_cache = True, verbose = True) 46 48 47 49 domain.check_integrity() -
anuga_work/production/broome_2006/export_results.py
r3881 r3944 6 6 from os import sep 7 7 8 time_dir = '20061 026_220716'8 time_dir = '20061101_024119' 9 9 10 10 directory = project.outputdir … … 22 22 23 23 if which_var == 2: # Depth 24 outname = name + '_depth _bruny'24 outname = name + '_depth' 25 25 quantityname = 'stage-elevation' #Depth 26 26 … … 37 37 sww2dem(name, basename_out = outname, 38 38 quantity = quantityname, 39 cellsize = 25, # would prefer this at 2539 cellsize = 100, # would prefer this at 25 40 40 # define region for viz purposes 41 41 easting_min = project.eastingmin, -
anuga_work/production/broome_2006/project.py
r3908 r3944 138 138 139 139 # exporting asc grid 140 eastingmin = 4 06215.87141 eastingmax = 4 40208.78142 northingmin = 7983427.73143 northingmax = 80 32834.52140 eastingmin = 412036.43 141 eastingmax = 427184.37 142 northingmin = 8007984 143 northingmax = 8029830 144 144 145 145 -
anuga_work/production/hobart_2006/export_results.py
r3852 r3944 49 49 ## format = 'asc') 50 50 51 # for bruny 51 ### for bruny 52 ##sww2dem(name, basename_out = outname, 53 ## quantity = quantityname, 54 ## cellsize = 25, # would prefer this at 25 55 ## # define region for viz purposes 56 ## easting_min = project.eastingmin25_2, 57 ## easting_max = project.eastingmax25_2, 58 ## northing_min = project.northingmin25_2, 59 ## northing_max = project.northingmax25_2, 60 ## reduction = max, #this is because we want max quantityname 61 ## verbose = True, 62 ## format = 'asc') 63 64 # for fixed timestep 52 65 sww2dem(name, basename_out = outname, 53 66 quantity = quantityname, 54 cellsize = 25, # would prefer this at 2567 cellsize = 10, # would prefer this at 25 55 68 # define region for viz purposes 56 69 easting_min = project.eastingmin25_2, … … 58 71 northing_min = project.northingmin25_2, 59 72 northing_max = project.northingmax25_2, 60 reduction = max, #this is because we want max quantityname73 #reduction = max, #this is because we want max quantityname 61 74 verbose = True, 62 75 format = 'asc') 76 -
anuga_work/production/hobart_2006/make_report.py
r3886 r3944 99 99 #reportname = 'latexoutput', 100 100 plot_quantity = ['stage', 'speed'], 101 surface = False,101 surface = True, 102 102 time_min = None, 103 103 time_max = None, -
anuga_work/production/hobart_2006/report/hobart_2006_report_MRT.tex
r3867 r3944 172 172 \input{metadata} 173 173 174 \ pagebreak174 \clearpage 175 175 176 176 \section{Time series}
Note: See TracChangeset
for help on using the changeset viewer.