Changeset 3452
- Timestamp:
- Aug 4, 2006, 2:26:23 PM (19 years ago)
- Location:
- inundation
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/damage/inundation_damage.py
r3399 r3452 31 31 from pyvolution.util import file_function 32 32 from geospatial_data.geospatial_data import ensure_absolute 33 from utilities.numerical_tools import INF33 from utilities.numerical_tools import NAN 34 34 from anuga_config import epsilon 35 35 depth_epsilon = epsilon … … 132 132 if depth > max_depths[point_i]: 133 133 max_depths[point_i] = depth 134 if w == INF or z == INF or uh == INF or vh == INF:134 if w == NAN or z == NAN or uh == NAN or vh == NAN: 135 135 continue 136 136 momentum = sqrt(uh*uh + vh*vh) -
inundation/fit_interpolate/general_fit_interpolate.py
r3085 r3452 30 30 from coordinate_transforms.geo_reference import Geo_reference 31 31 from pyvolution.quad import build_quadtree 32 from utilities.numerical_tools import ensure_numeric , mean, INF32 from utilities.numerical_tools import ensure_numeric 33 33 from utilities.polygon import in_and_outside_polygon 34 34 from geospatial_data.geospatial_data import Geospatial_data, \ -
inundation/fit_interpolate/interpolate.py
r3445 r3452 33 33 from coordinate_transforms.geo_reference import Geo_reference 34 34 from pyvolution.quad import build_quadtree 35 from utilities.numerical_tools import ensure_numeric, mean, INF35 from utilities.numerical_tools import ensure_numeric, mean, NAN 36 36 from utilities.polygon import in_and_outside_polygon 37 37 from geospatial_data.geospatial_data import Geospatial_data, ensure_absolute … … 201 201 #print "z", z 202 202 for i in self.outside_poly_indices: 203 z[i] = INF203 z[i] = NAN 204 204 return z 205 205 … … 330 330 depth = w - z 331 331 332 if w == INF or z == INF or uh == INF or vh == INF:333 velocity = INF332 if w == NAN or z == NAN or uh == NAN or vh == NAN: 333 velocity = NAN 334 334 else: 335 335 momentum = sqrt(uh*uh + vh*vh) … … 598 598 #Linear temporal interpolation 599 599 if ratio > 0: 600 if Q0 == INF and Q1 == INF:600 if Q0 == NAN and Q1 == NAN: 601 601 q[i] = Q0 602 602 else: -
inundation/fit_interpolate/test_interpolate.py
r3437 r3452 21 21 from coordinate_transforms.geo_reference import Geo_reference 22 22 from shallow_water import Domain, Transmissive_boundary 23 from utilities.numerical_tools import mean, INF23 from utilities.numerical_tools import mean, NAN 24 24 from data_manager import get_dataobject 25 25 from geospatial_data.geospatial_data import Geospatial_data … … 523 523 524 524 z = interp.interpolate(f, point_coords) #, verbose=True) 525 answer = array([ [ INF, INF, INF, INF]]) # (-1,-1)525 answer = array([ [NAN, NAN, NAN, NAN]]) # (-1,-1) 526 526 527 527 #print "***********" … … 1135 1135 t = time[0] 1136 1136 for j in range(50): #t in [1, 6] 1137 self.failUnless(I(t, 5) == INF, 'Fail!')1137 self.failUnless(I(t, 5) == NAN, 'Fail!') 1138 1138 t += 0.1 1139 1139 … … 1343 1343 2*linear_function(point_coords) ] 1344 1344 answer = transpose(answer) 1345 answer[2,:] = [ INF, INF]1346 answer[3,:] = [ INF, INF]1347 answer[11,:] = [ INF, INF]1345 answer[2,:] = [NAN, NAN] 1346 answer[3,:] = [NAN, NAN] 1347 answer[11,:] = [NAN, NAN] 1348 1348 #print "z",z 1349 1349 #print "answer _ fixed",answer -
inundation/pyvolution/test_util.py
r2934 r3452 11 11 from data_manager import timefile2netcdf 12 12 13 from utilities.numerical_tools import INF13 from utilities.numerical_tools import NAN 14 14 15 15 def test_function(x, y): … … 621 621 q1 = F(t+60, point_id=id) 622 622 623 if q0 == INF:623 if q0 == NAN: 624 624 actual = q0 625 625 else: … … 632 632 print "actual", actual 633 633 #print 634 if q0 == INF:634 if q0 == NAN: 635 635 self.failUnless( q == actual, 'Fail!') 636 636 else: … … 792 792 q1 = F(t+60, point_id=id) 793 793 794 if q0 == INF:794 if q0 == NAN: 795 795 actual = q0 796 796 else: … … 803 803 #print "actual", actual 804 804 #print 805 if q0 == INF:805 if q0 == NAN: 806 806 self.failUnless( q == actual, 'Fail!') 807 807 else: … … 836 836 q1 = F(t+60, point_id=id) 837 837 838 if q0 == INF:838 if q0 == NAN: 839 839 actual = q0 840 840 else: … … 849 849 print "actual", actual 850 850 #print 851 if q0 == INF:851 if q0 == NAN: 852 852 self.failUnless( q == actual, 'Fail!') 853 853 else: -
inundation/utilities/numerical_tools.py
r3103 r3452 14 14 15 15 # Getting an infinite number to use when using Numeric 16 INF = (array([1])/0.)[0] 17 16 #INF = (array([1])/0.)[0] 17 18 NAN = (array([1])/0.)[0] 19 # Note, INF is used instead of NAN (Not a number), since Numeric has no NAN 20 # if we use a package that has NAN, this should be updated to use NAN. 18 21 19 22
Note: See TracChangeset
for help on using the changeset viewer.