Changeset 5465
- Timestamp:
- Jul 4, 2008, 1:56:15 PM (17 years ago)
- Location:
- anuga_work/development/boxingday08
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_work/development/boxingday08/boxingday_boundary_order.txt
r5464 r5465 1 index, longitude,latitude2 90, 472194.058708,193430.037143 91, 468910.350862,417814.6609214 0, 336294.174659,659735.8658485 1, 335940.023759,664344.0098346 2, 335585.169534,668952.0729947 3, 333458.007771,671787.840058 4, 333103.527881,676395.934219 5, 335584.913055,679586.17690910 6, 338066.17797,683130.90166411 7, 337712.337412,687384.52603412 8, 340193.365548,691283.67924313 9, 342674.942465,695182.86456514 10, 343028.996544,698727.56309515 11, 343383.181996,702626.69245516 12, 345510.456522,706171.39803717 13, 347636.763496,710070.56125418 14, 348345.993026,713969.74759819 15, 347991.999887,717868.9024120 16, 348700.260229,721413.59833721 17, 348700.74816,725312.74685722 18, 348346.261066,729566.41088623 19, 347637.463051,733465.53964824 20, 346219.280415,737010.26183925 21, 345864.407267,741263.8597526 22, 345510.331768,745163.0391427 23, 342674.316521,747289.86698328 24, 340547.547708,750480.06542929 25, 339484.479114,755088.1980830 26, 341965.31107,757923.96942731 27, 343028.978631,761468.66251532 28, 338420.592193,761823.09701233 29, 335585.22943,764304.38397534 30, 334167.626591,768203.58125135 31, 335584.735827,771393.78683736 32, 337003.09138,775292.95276437 33, 335939.319181,779546.60580338 34, 333103.507345,782027.85745339 35, 329204.500134,783800.23774440 36, 327432.550064,787699.37186141 37, 328141.129947,790889.62124542 38, 329204.642377,795143.22856643 39, 330268.050113,799396.87986544 40, 331331.840794,803296.05551645 41, 332394.68402,807195.22803246 42, 332749.712168,811803.33635447 43, 332749.085392,815347.98847448 44, 331686.000498,819247.1619749 45, 330977.236649,823500.80048250 46, 330622.34502,827754.45871851 47, 330268.46938,831299.14092952 48, 329913.427618,835198.31840453 49, 328141.18488,838742.99462254 50, 325305.544465,841933.24551855 51, 323533.487091,845123.42507656 52, 321051.760662,848668.1493557 53, 321051.898764,852921.80233658 54, 320343.173374,857529.87300159 55, 316443.694676,860011.18855860 56, 312898.80714,861429.0382961 57, 310772.31805,864973.7346762 58, 309354.462261,868872.93051863 59, 305454.953286,870999.73376464 60, 301555.903121,872772.05363765 61, 299429.071562,876671.23812866 62, 299075.077259,880924.88774167 63, 298365.530409,884824.02856268 64, 297302.823004,889077.69982869 65, 294820.924212,892267.8548770 66, 290922.375994,894394.74188671 67, 287377.363778,896167.08673172 68, 284895.736516,899711.77498873 69, 283123.376077,902901.9399874 70, 280997.234969,905737.73381375 71, 278515.811642,908927.94489676 72, 277097.388615,911763.68591677 73, 276389.008202,915308.43119378 74, 277452.296071,919562.06760879 75, 277097.344968,923461.19204880 76, 274616.125999,927360.39829281 77, 272489.492172,930196.11825982 78, 270008.294828,932677.41717583 79, 266817.763524,935867.6641184 80, 262919.01753,937639.95500885 81, 258665.020804,936576.56747986 82, 254411.760125,936576.58672687 83, 257956.617175,988187.29838888 85, 431895.346948,1020339.5509989 84, 456154.607059,1099910.7479690 87, 485676.850637,892038.71991491 86, 436057.013086,865548.24909792 93, 422179.921754,873660.84757193 92, 417478.780955,873745.86566294 88, 533099.268408,829034.04235295 89, 571839.718716,740632.6376271 index, longitude, latitude 2 90,98.75,1.75 3 91,98.7200012207,3.77999997139 4 0,97.5210189819,5.96663379669 5 1,97.5177078247,6.00829792023 6 2,97.5143890381,6.04996109009 7 3,97.4951019287,6.07555246353 8 4,97.4917831421,6.11721515656 9 5,97.5141220093,6.14612770081 10 6,97.5364532471,6.17824554443 11 7,97.5331497192,6.21670341492 12 8,97.5554733276,6.25202655792 13 9,97.5778045654,6.28734970093 14 10,97.5809173584,6.31941461563 15 11,97.584022522,6.35468482971 16 12,97.6031646729,6.38679361343 17 13,97.6222915649,6.42210769653 18 14,97.6286087036,6.45738744736 19 15,97.6253128052,6.49264097214 20 16,97.6316299438,6.52471494675 21 17,97.6315383911,6.5599770546 22 18,97.6282272339,6.59843635559 23 19,97.6217193604,6.63368034363 24 20,97.6088027954,6.66570091248 25 21,97.6054840088,6.70415878296 26 22,97.602180481,6.73941135406 27 23,97.5764694214,6.75857067108 28 24,97.557144165,6.78736352921 29 25,97.5474014282,6.82900667191 30 26,97.569770813,6.85471820831 31 27,97.5792999268,6.8868021965 32 28,97.5375900269,6.88988161087 33 29,97.5118637085,6.91224050522 34 30,97.4989242554,6.94746017456 35 31,97.5116577148,6.97634935379 36 32,97.5243835449,7.01164960861 37 33,97.5146331787,7.05008459091 38 34,97.4888916016,7.07243967056 39 35,97.4535446167,7.08835077286 40 36,97.4373855591,7.12355518341 41 37,97.4437026978,7.15242481232 42 38,97.4532012939,7.19092082977 43 39,97.4626998901,7.22941732407 44 40,97.4722137451,7.26470851898 45 41,97.4817199707,7.2999997139 46 42,97.4847946167,7.3416800499 47 43,97.4846801758,7.37373304367 48 44,97.4749298096,7.4089589119 49 45,97.4683761597,7.44740056992 50 46,97.4650268555,7.48585319519 51 47,97.4617080688,7.51789474487 52 48,97.458366394,7.55314159393 53 49,97.4421920776,7.58513689041 54 50,97.4163894653,7.61389112473 55 51,97.4002227783,7.6426782608 56 52,97.3776092529,7.67464590073 57 53,97.3774642944,7.71310758591 58 54,97.370880127,7.7547492981 59 55,97.3354415894,7.77704811096 60 56,97.3032531738,7.78974056244 61 57,97.2838439941,7.8217124939 62 58,97.2708435059,7.85691452026 63 59,97.2354049683,7.87599658966 64 60,97.1999816895,7.89187002182 65 61,97.1805419922,7.92703914642 66 62,97.1771621704,7.96548223495 67 63,97.1705703735,8.00070571899 68 64,97.1607589722,8.03911972046 69 65,97.1381149292,8.06785964966 70 66,97.1026611328,8.08692550659 71 67,97.0704269409,8.10279750824 72 68,97.0477600098,8.13473510742 73 69,97.031539917,8.16349697113 74 70,97.0121231079,8.18903827667 75 71,96.9894638062,8.21776580811 76 72,96.9764633179,8.24333572388 77 73,96.969871521,8.27534675598 78 74,96.9793243408,8.31384754181 79 75,96.9759216309,8.34907817841 80 76,96.9532165527,8.38420963287 81 77,96.9337768555,8.40974235535 82 78,96.9111328125,8.4320526123 83 79,96.8820114136,8.46073436737 84 80,96.8465270996,8.47656059265 85 81,96.8079605103,8.4667339325 86 82,96.7693481445,8.46651554108 87 83,96.7988052368,8.93318271637 88 85,98.3799972534,9.22999954224 89 84,98.5999984741,9.94999980927 90 87,98.8700027466,8.06999969482 91 86,98.4199981689,7.82999992371 92 93,98.2940063477,7.90318584442 93 92,98.2513580322,7.90388059616 94 88,99.3000030518,7.5 95 89,99.6500015259,6.69999980927 -
anuga_work/development/boxingday08/project.py
r5458 r5465 2 2 from Scientific.IO.NetCDF import NetCDFFile 3 3 from Numeric import asarray,transpose,sqrt,argmax,argmin,arange,Float,\ 4 compress,zeros,fabs,allclose 4 compress,zeros,fabs,allclose,ones 5 5 from anuga.utilities.polygon import inside_polygon,read_polygon 6 6 from os import sep 7 7 from time import localtime, strftime, gmtime 8 9 def create_sts_boundary_order_file(order_filename,stsfilename,verbose=False): 8 from anuga.shallow_water.data_manager import urs2sts,create_sts_boundary 9 import os 10 11 def create_sts_boundary_order_file(urs_filename,order_filename,sts_filename,verbose=False): 10 12 """ 11 13 Note This is not a robust algorithm. Be Careful when applying that … … 13 15 follows the path it is supposed too. 14 16 """ 15 fid = NetCDFFile(stsfilename+'.sts', 'r') #Open existing file for read 16 x = fid.variables['x'][:]+fid.xllcorner #x-coordinates of vertices 17 y = fid.variables['y'][:]+fid.yllcorner #y-coordinates of vertices 18 coordinates=transpose(asarray([x.tolist(),y.tolist()])) 17 from anuga.shallow_water.data_manager import read_mux2_py 18 times, y, x, elevation, quantity, starttime = read_mux2_py([urs_filename],weights=ones(1,Float)) 19 19 20 20 #find indices of the southernmost gauges … … 60 60 61 61 #So far i cannot tell if the wrong point is closer. 62 63 boundary=ensure_numeric(boundary) 64 from anuga.coordinate_transforms import redfearn,convert_from_latlon_to_utm 65 boundary_utm,zone=convert_from_latlon_to_utm(longitudes=list(boundary[:,0]),latitudes=list(boundary[:,1])) 66 62 67 d="," 63 68 fid=open(order_filename,'w') 64 header= "index,longitude,latitude\n"69 header='index, longitude, latitude\n' 65 70 fid.write(header) 66 71 line=str(west_index)+d+str(x[west_index])+d+\ … … 72 77 fid.write(line) 73 78 fid.close() 74 return boundary 75 76 77 #read in polyline boundary 78 from anuga.shallow_water.data_manager import urs2sts,create_sts_boundary 79 urs_name='polyline' 80 #base_name=urs_name 81 tide=0.35 82 base_name='tide_polyline' 83 #base_name='most_polyline' 84 import os 85 if os.path.exists(base_name+'.sts'): 86 print 'sts boundary file already created.' 87 else: 88 print 'creatin sts file' 89 urs2sts(urs_name,base_name,mean_stage=tide,verbose=False) 90 91 order_filename='sts_order.txt' 92 boundary=create_sts_boundary_order_file(order_filename,base_name,verbose=False) 93 urs_boundary=create_sts_boundary(order_filename,base_name,lat_long=False) 94 assert allclose(boundary.tolist(),urs_boundary) 95 96 #Read in large domain boundary 97 dir='mesh_polygons' 98 extent = 'extent.csv' 99 bp = read_polygon(dir+sep+extent) 100 101 #Now order of boundary is correct clip sts boundary to small region for 102 #this particular scenario 103 indices=inside_polygon(urs_boundary, bp, closed=True, verbose=False) 104 bounding_polygon=[] 105 for i in indices[:-2]: 106 #disregard last two entries because they are not on boundary 107 bounding_polygon.append(urs_boundary[i]) 108 109 #Append clipped sts boundary to large domain boundary 110 bounding_polygon.extend(bp[2:len(bp)]) 111 112 ############################### 113 # Domain definitions 114 ############################### 79 return boundary,boundary_utm 80 81 ###################### 82 # Domain definitions # 83 ###################### 115 84 116 85 # Bathymetry and topography filenames … … 129 98 extent = 'extent.csv' 130 99 patong_bay_polygon = read_polygon(dir+sep+'patong_bay_polygon.csv') 100 101 tide=0.35 102 103 ###################################### 104 # Create urs boundary from mux2files # 105 ###################################### 106 urs_filename='polyline' 107 base_name='tide_polyline' 108 order_filename='boxingday_boundary_order.txt' 109 110 # Create ordering file 111 # Usually this would be provided before hand 112 boundary,boundary_utm=create_sts_boundary_order_file(urs_filename+'_waveheight-z-mux2',order_filename,base_name,verbose=False) 113 114 # Create ordered sts file 115 if not os.path.exists(base_name+'.sts'): 116 print 'creating sts file' 117 urs2sts(urs_filename,basename_out=base_name, 118 ordering_filename=order_filename, 119 mean_stage=tide, 120 verbose=False) 121 else: 122 print 'sts file exists' 123 124 # Read in boundary from ordered sts file 125 urs_boundary=create_sts_boundary(base_name) 126 127 # Checks that the boundary read from the sts file is the same as the one 128 # defined by the function create_sts_boundary_order_file 129 assert allclose(boundary_utm,urs_boundary) 130 131 ############################################################# 132 # Add urs boundary segment to user defined boundary polygon # 133 ############################################################# 134 135 # Read in specific user defined boundary 136 dir='mesh_polygons' 137 extent = 'extent.csv' 138 user_boundary_polygon = read_polygon(dir+sep+extent) 139 140 # The following is specific to this scenario 141 indices=inside_polygon(urs_boundary, user_boundary_polygon, closed=True, verbose=False) 142 bounding_polygon=[] 143 for i in indices[:-2]: 144 #disregard last two entries because they are not on boundary 145 bounding_polygon.append(urs_boundary[i]) 146 147 # Append clipped sts boundary to user defined domain boundary 148 bounding_polygon.extend(user_boundary_polygon[2:len(user_boundary_polygon)]) 131 149 132 150 ############################### 133 # Interior region definitions 151 # Interior region definitions # 134 152 ############################### 135 153 … … 141 159 patong = read_polygon(dir+sep+'patong.csv') 142 160 bay = read_polygon(dir+sep+'bay.csv') 161 162 ########################################## 163 # Plot urs boundary and internal regions # 164 ########################################## 143 165 144 166 plot=False … … 156 178 show() 157 179 180 181 ####################### 182 # For MOST SIMULATION # 183 ####################### 158 184 east = 97.7 159 185 west = 96.7
Note: See TracChangeset
for help on using the changeset viewer.