Changeset 8249
- Timestamp:
- Nov 15, 2011, 11:37:36 PM (13 years ago)
- Location:
- trunk/anuga_core/source/anuga
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_core/source/anuga/damage_modelling/inundation_damage.py
r8125 r8249 141 141 in the specified directory. 142 142 """ 143 143 144 quantities = ['stage', 'elevation', 'xmomentum', 'ymomentum'] 144 145 points = ensure_absolute(points) … … 161 162 raise IOError, msg 162 163 from os import sep 164 163 165 for this_sww_file in interate_over: 164 166 callable_sww = file_function(dir+sep+this_sww_file, … … 167 169 verbose=verbose, 168 170 use_cache=use_cache) 169 171 170 172 for point_i, point in enumerate(points): 171 173 for time in callable_sww.get_time(): 172 174 quantity_values = callable_sww(time,point_i) 173 174 175 w = quantity_values[0] 175 176 z = quantity_values[1] 176 177 uh = quantity_values[2] 177 178 vh = quantity_values[3] 178 179 180 #print w,z,uh,vh 181 if w == NAN or z == NAN or uh == NAN or vh == NAN: 182 continue 183 179 184 # -ground_floor_height is the minimum value. 180 185 depth = w - z - ground_floor_height … … 182 187 if depth > max_depths[point_i]: 183 188 max_depths[point_i] = depth 184 if w == NAN or z == NAN or uh == NAN or vh == NAN: 185 continue 189 186 190 momentum = sqrt(uh*uh + vh*vh) 187 191 if momentum > max_momentums[point_i]: 188 192 max_momentums[point_i] = momentum 193 194 189 195 return max_depths, max_momentums 190 196 -
trunk/anuga_core/source/anuga/damage_modelling/test_inundation_damage.py
r7796 r8249 578 578 points_are_lats_longs=True) 579 579 points_ab = spat.get_data_points( absolute = True) 580 580 581 deps, _ = calc_max_depth_and_momentum(sww_file, 581 582 points_ab, -
trunk/anuga_core/source/anuga/file
-
Property
svn:ignore
set to
.python_cache
-
Property
svn:ignore
set to
-
trunk/anuga_core/source/anuga/file/test_mux.py
r7766 r8249 117 117 def delete_mux(self, files): 118 118 for file in files: 119 os.remove(file) 119 try: 120 os.remove(file) 121 except: 122 pass 120 123 121 124 def write_mux2(self, lat_long_points, time_step_count, time_step, -
trunk/anuga_core/source/anuga/file/test_urs.py
r7766 r8249 101 101 102 102 def test_URS_points_northern_hemisphere(self): 103 103 104 104 LL_LAT = 8.0 105 105 LL_LONG = 97.0 … … 130 130 # export_csv=True, 131 131 # verbose=self.verbose) 132 132 133 133 geo=calculate_boundary_points(poly_lat_long, 134 134 ZONE, … … 138 138 isSouthHemisphere=False, 139 139 verbose=self.verbose) 140 140 141 141 results = frozenset(geo.get_data_points(as_lat_long=True, 142 142 isSouthHemisphere=False)) 143 143 144 #print 'results',results 144 145 … … 160 161 if not found: 161 162 assert False 162 163 163 164 164 def covered_in_other_tests_test_URS_points_needed_poly1(self): -
trunk/anuga_core/source/anuga/file/urs.py
r8143 r8249 199 199 200 200 """ 201 201 202 202 msg = "grid_spacing can not be zero" 203 203 assert not grid_spacing == 0, msg … … 207 207 # List of segments. Each segment is two points. 208 208 segs = [i and [a[i-1], a[i]] or [a[len(a)-1], a[0]] for i in range(len(a))] 209 209 210 210 211 # convert the segs to Lat's and longs. … … 213 214 lat_long_set = frozenset() 214 215 for seg in segs: 216 215 217 points_lat_long = points_needed(seg, ll_lat, ll_long, grid_spacing, 216 218 lat_amount, long_amount, zone, 217 219 isSouthHemisphere) 220 218 221 lat_long_set |= frozenset(points_lat_long) 222 219 223 220 224 if lat_long_set == frozenset([]): … … 276 280 for index_lat in range(first_row_lat, last_row_lat + 1): 277 281 for index_long in range(first_row_long, last_row_long + 1): 282 278 283 lat = ll_lat + index_lat*grid_spacing 279 284 long = ll_long + index_long*grid_spacing 285 280 286 281 287 #filter here to keep good points … … 283 289 points_lat_long.append((lat, long)) #must be hashable 284 290 291 285 292 # Now that we have these points, lets throw ones out that are too far away 293 286 294 return points_lat_long 287 295 … … 302 310 x2_1 = x2-x1 303 311 y2_1 = y2-y1 304 try: 305 d = abs((x2_1)*(y1-y0)-(x1-x0)*(y2_1))/sqrt( \ 306 (x2_1)*(x2_1)+(y2_1)*(y2_1)) 307 except ZeroDivisionError: 308 if sqrt((x2_1)*(x2_1)+(y2_1)*(y2_1)) == 0 \ 309 and abs((x2_1)*(y1-y0)-(x1-x0)*(y2_1)) == 0: 310 return True 311 else: 312 return False 313 314 return d <= max_distance 315 316 317 312 313 314 num = (x2_1)*(x2_1)+(y2_1)*(y2_1) 315 if sqrt(num) == 0 and abs(num) == 0: 316 return True 317 else: 318 d = abs((x2_1)*(y1-y0)-(x1-x0)*(y2_1))/num 319 return d <= max_distance 320 321 322 323 -
trunk/anuga_core/source/anuga/file_conversion
-
Property
svn:ignore
set to
.python_cache
-
Property
svn:ignore
set to
-
trunk/anuga_core/source/anuga/file_conversion/dem2pts.py
r8150 r8249 240 240 241 241 if upper_index == lower_index + newcols: 242 points[lower_index:upper_index, :] = tpoints 243 elevation[lower_index:upper_index] = telev 242 # Seems to be an error with the windows version of 243 # Netcdf. The following gave errors 244 #points[lower_index:upper_index, :] = tpoints 245 #elevation[lower_index:upper_index] = telev 246 # so used the following 247 for index in range(newcols): 248 points[index+lower_index, :] = tpoints[index,:] 249 elevation[index+lower_index] = telev[index] 244 250 245 251 assert global_index == nopoints, 'index not equal to number of points'
Note: See TracChangeset
for help on using the changeset viewer.