Changeset 3260


Ignore:
Timestamp:
Jun 30, 2006, 10:19:24 AM (18 years ago)
Author:
duncan
Message:

bringing interpolate_sww back to life

Location:
inundation
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • inundation/pyvolution/interpolate_sww.py

    r2924 r3260  
    11""" Interpolation of a sww file.
    22
    3 THIS FILE IS OBSOLETE
    4 
    5 Used to interpolate height information from sww files.
     3Used to interpolate height and other information from sww files.
    64
    75When using as a stand alone application,
     
    2624
    2725from Numeric import transpose
    28 from least_squares import Interpolation
     26from fit_interpolate.interpolate import Interpolate
    2927
    3028DEFAULT_QUANTITY = "depth"
    3129
    3230def  interpolate_sww2xya(sww_file, quantity_name,point_file_in,
    33                          point_file_out, display_errors = True):
     31                         point_file_out, verbose = True):
    3432    """
    3533    This function catches exceptions.
     
    4038        interp.write_depth_xya(point_file_out)
    4139    except IOError,e: #need to convert key error to ioerror
    42         if display_errors:
     40        if verbose:
    4341            print "Could not load bad file. ", e
    4442        import sys; sys.exit()
     
    6361        # Refactor when necessary. - DSG
    6462
    65         print "Obsolete."
    6663        x, y, volumes, time, quantity = self.read_sww(file_name, quantity_name)
    6764        vertex_coordinates = transpose([x,y])
     
    8784            print vertex_coordinates
    8885            print "****************************"
    89        
    90         self.interp = Interpolation(vertex_coordinates, volumes, alpha=0)
     86        self.vertex_coordinates = vertex_coordinates
     87        self.volumes = volumes
    9188        self.time = time
    9289
     
    105102        from load_mesh.loadASCII import import_points_file
    106103       
     104        interp = Interpolate(self.vertex_coordinates, self.volumes)
    107105        point_dict = import_points_file(file_name)
    108106        self.point_coordinates = point_dict['pointlist']
    109         self.interp.build_interpolation_matrix_A(self.point_coordinates)
    110         self.interpolated_quantity_raw = self.interp.interpolate(transpose(self.quantity))
     107        self.interpolated_quantity_raw = interp.interpolate(transpose(self.quantity),
     108                                                            point_coordinates = self.point_coordinates)
     109        #self.interpolated_quantity_raw = self.interp.interpolate(transpose(self.quantity))
    111110        self.interpolated_quantity = {}
    112111        for i,time_slice in enumerate(self.time):
  • inundation/pyvolution/test_interpolate_sww.py

    r1814 r3260  
    138138
    139139    def test_interpolate_sww(self):
    140         """Not reaa unit test, rather a system test for
    141         """
     140        ### Not really a unit test, rather a system test for
     141        ### 
    142142
    143143        import time, os
     
    231231        try:
    232232            interpolate_sww2xya('??ffd??', 'stage','yeah','yeah.x',
    233                                 display_errors = False)
     233                                verbose = False)
    234234        except SystemExit:  pass
    235235        else:
     
    252252        try:
    253253            interpolate_sww2xya(sww_file, 'stage','yeah','yeah.x',
    254                                 display_errors = False)
     254                                verbose = False)
    255255           
    256256        except SystemExit:  pass
     
    282282            interpolate_sww2xya(self.domain.filename,
    283283                                'stage','yeah','yeah.x',
    284                                 display_errors = False)
     284                                verbose = False)
    285285        except SystemExit:  pass
    286286        else:
  • inundation/test_all.py

    r3097 r3260  
    1919                 'test_advection.py', # removing this test for a bit
    2020                 #'test_mesh.py', # bug fixing
    21                  'test_interpolate_sww.py' # this test is obsolete
    2221                 ]
    2322                 #'test_calculate_region.py', 'test_calculate_point.py']
Note: See TracChangeset for help on using the changeset viewer.