Ignore:
Timestamp:
Mar 21, 2006, 10:58:32 AM (18 years ago)
Author:
duncan
Message:

get interpolate tests running in test_all

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/fit_interpolate/interpolate.py

    r2504 r2563  
    1919
    2020import time
     21import os
     22from warnings import warn
    2123
    2224from Numeric import zeros, array, Float, Int, dot, transpose, concatenate, \
     
    2830from coordinate_transforms.geo_reference import Geo_reference
    2931from pyvolution.quad import build_quadtree
    30 from utilities.numerical_tools import ensure_numeric
     32from utilities.numerical_tools import ensure_numeric, mean
    3133from utilities.polygon import inside_polygon
    3234
     
    160162                    A[i,j] = sigmas[j]
    161163            else:
    162                 print 'Could not find triangle for point', x
     164                # Hack so this message only appears when the test is
     165                #run in fit_interpoate directory.
     166                #Error message reminds me to do something
     167                #with points outside the polygon
     168                if os.getcwd()[-15:] == "fit_interpolate":
     169                    print 'Could not find triangle for point', x
    163170        return A
    164171
     
    258265
    259266
    260      # FIXME: What is a good start_blocking_count value?
     267     # FIXME: What is a good start_blocking_len value?
    261268    def interpolate(self, f, point_coordinates = None,
    262269                    start_blocking_len = 500000, verbose=False):
     
    298305                #There are no good point_coordinates. import sys; sys.exit()
    299306                msg = 'ERROR (interpolate.py): No point_coordinates inputted'
    300                 raise msg
     307                raise Exception(msg)
     308           
    301309           
    302310        if point_coordinates is not None:
     
    342350
    343351
    344 class Interpolation_interface:
     352class Interpolation_function:
    345353    """Interpolation_interface - creates callable object f(t, id) or f(t,x,y)
    346354    which is interpolated from time series defined at vertices of
     
    394402
    395403
    396         from util import mean, ensure_numeric
     404        #from util import mean, ensure_numeric
    397405        from config import time_format
    398406        import types
     
    532540                if x is None or y is None:
    533541                    msg = 'Either point_id or x and y must be specified'
    534                     raise msg
     542                    raise Exception(msg)
    535543            else:
    536544                if self.interpolation_points is None:
     
    538546                          'with a list of interpolation points before parameter ' +\
    539547                          'point_id can be used'
    540                     raise msg
     548                    raise Exception(msg)
    541549
    542550
    543551        msg = 'Time interval [%s:%s]' %(self.T[0], self.T[1])
    544552        msg += ' does not match model time: %s\n' %t
    545         if t < self.T[0]: raise msg
    546         if t > self.T[-1]: raise msg
     553        if t < self.T[0]: raise Exception(msg)
     554        if t > self.T[-1]: raise Exception(msg)
    547555
    548556        oldindex = self.index #Time index
     
    698706def read_sww(file_name):
    699707    """
     708    obsolete - Nothing should be calling this
     709   
    700710    Read in an sww file.
    701711   
Note: See TracChangeset for help on using the changeset viewer.