Changeset 3452


Ignore:
Timestamp:
Aug 4, 2006, 2:26:23 PM (19 years ago)
Author:
duncan
Message:

In numerical_tools, changing INF name to NAN.

Location:
inundation
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • inundation/damage/inundation_damage.py

    r3399 r3452  
    3131from pyvolution.util import file_function
    3232from geospatial_data.geospatial_data import ensure_absolute
    33 from utilities.numerical_tools import INF
     33from utilities.numerical_tools import NAN
    3434from anuga_config import epsilon
    3535depth_epsilon = epsilon
     
    132132            if depth > max_depths[point_i]:
    133133                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:
    135135                continue
    136136            momentum = sqrt(uh*uh + vh*vh)
  • inundation/fit_interpolate/general_fit_interpolate.py

    r3085 r3452  
    3030from coordinate_transforms.geo_reference import Geo_reference
    3131from pyvolution.quad import build_quadtree
    32 from utilities.numerical_tools import ensure_numeric, mean, INF
     32from utilities.numerical_tools import ensure_numeric
    3333from utilities.polygon import in_and_outside_polygon
    3434from geospatial_data.geospatial_data import Geospatial_data, \
  • inundation/fit_interpolate/interpolate.py

    r3445 r3452  
    3333from coordinate_transforms.geo_reference import Geo_reference
    3434from pyvolution.quad import build_quadtree
    35 from utilities.numerical_tools import ensure_numeric, mean, INF
     35from utilities.numerical_tools import ensure_numeric, mean, NAN
    3636from utilities.polygon import in_and_outside_polygon
    3737from geospatial_data.geospatial_data import Geospatial_data, ensure_absolute
     
    201201        #print "z", z
    202202        for i in self.outside_poly_indices:
    203             z[i] = INF
     203            z[i] = NAN
    204204        return z
    205205
     
    330330            depth = w - z
    331331             
    332             if w == INF or z == INF or uh == INF or vh == INF:
    333                 velocity = INF
     332            if w == NAN or z == NAN or uh == NAN or vh == NAN:
     333                velocity = NAN
    334334            else:
    335335                momentum = sqrt(uh*uh + vh*vh)
     
    598598            #Linear temporal interpolation   
    599599            if ratio > 0:
    600                 if Q0 == INF and Q1 == INF:
     600                if Q0 == NAN and Q1 == NAN:
    601601                    q[i]  = Q0
    602602                else:
  • inundation/fit_interpolate/test_interpolate.py

    r3437 r3452  
    2121from coordinate_transforms.geo_reference import Geo_reference
    2222from shallow_water import Domain, Transmissive_boundary
    23 from utilities.numerical_tools import mean, INF
     23from utilities.numerical_tools import mean, NAN
    2424from data_manager import get_dataobject
    2525from geospatial_data.geospatial_data import Geospatial_data
     
    523523
    524524        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)
    526526
    527527        #print "***********"
     
    11351135        t = time[0]
    11361136        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!')
    11381138            t += 0.1 
    11391139           
     
    13431343                  2*linear_function(point_coords) ]
    13441344        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]
    13481348        #print "z",z
    13491349        #print "answer _ fixed",answer
  • inundation/pyvolution/test_util.py

    r2934 r3452  
    1111from data_manager import timefile2netcdf
    1212
    13 from utilities.numerical_tools import INF
     13from utilities.numerical_tools import NAN
    1414
    1515def test_function(x, y):
     
    621621                    q1 = F(t+60, point_id=id)
    622622
    623                 if q0 == INF:
     623                if q0 == NAN:
    624624                    actual = q0
    625625                else:
     
    632632                print "actual", actual
    633633                #print
    634                 if q0 == INF:
     634                if q0 == NAN:
    635635                     self.failUnless( q == actual, 'Fail!')
    636636                else:
     
    792792                    q1 = F(t+60, point_id=id)
    793793
    794                 if q0 == INF:
     794                if q0 == NAN:
    795795                    actual = q0
    796796                else:
     
    803803                #print "actual", actual
    804804                #print
    805                 if q0 == INF:
     805                if q0 == NAN:
    806806                     self.failUnless( q == actual, 'Fail!')
    807807                else:
     
    836836                    q1 = F(t+60, point_id=id)
    837837
    838                 if q0 == INF:
     838                if q0 == NAN:
    839839                    actual = q0
    840840                else:
     
    849849                print "actual", actual
    850850                #print
    851                 if q0 == INF:
     851                if q0 == NAN:
    852852                     self.failUnless( q == actual, 'Fail!')
    853853                else:
  • inundation/utilities/numerical_tools.py

    r3103 r3452  
    1414
    1515# Getting an infinite number to use when using Numeric
    16 INF = (array([1])/0.)[0]
    17 
     16#INF = (array([1])/0.)[0]
     17
     18NAN = (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.
    1821
    1922
Note: See TracChangeset for help on using the changeset viewer.