Changeset 5349


Ignore:
Timestamp:
May 21, 2008, 10:32:42 AM (16 years ago)
Author:
duncan
Message:

Minor fixes/ comments

Location:
anuga_core/source/anuga
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/abstract_2d_finite_volumes/test_quantity.py

    r4957 r5349  
    884884        os.remove(pts_file)
    885885       
    886     def verbose_test_set_values_from_UTM_pts(self):
     886    def test_set_values_from_UTM_pts(self):
    887887        quantity = Quantity(self.mesh_onslow)
    888888
     889        VERBOSE = False # Change this to True to see output
    889890        #Get (enough) datapoints
    890891        data_points = [[-21.5, 114.5],[-21.4, 114.6],[-21.45,114.65],
     
    941942        #Check that values can be set from file
    942943        quantity.set_values_from_file(pts_file, att, 0,
    943                                       'vertices', None, verbose = True,
     944                                      'vertices', None, verbose = VERBOSE,
    944945                                      max_read_lines=2)
    945946        answer = linear_function(quantity.domain.get_vertex_coordinates())
     
    949950
    950951        #Check that values can be set from file
    951         quantity.set_values(filename = pts_file,
     952        quantity.set_values(filename = pts_file, verbose = VERBOSE,
    952953                            attribute_name = att, alpha = 0)
    953954        answer = linear_function(quantity.domain.get_vertex_coordinates())
     
    961962        assert allclose(quantity.vertex_values.flat, answer)
    962963
     964        #Check that values can be block read from a text file
     965        quantity.set_values_from_file(txt_file, att, 0,
     966                                      'vertices', None, verbose = VERBOSE,
     967                                      max_read_lines=2)
     968       
    963969        #Cleanup
    964970        import os
     
    23482354    #print "restricted test"
    23492355    #suite = unittest.makeSuite(Test_Quantity,'verbose_test_set_values_from_UTM_pts')
    2350     runner = unittest.TextTestRunner()
     2356    runner = unittest.TextTestRunner() #verbosity=2)
    23512357    runner.run(suite)
  • anuga_core/source/anuga/abstract_2d_finite_volumes/util.py

    r5327 r5349  
    1919from anuga.geospatial_data.geospatial_data import ensure_absolute
    2020from math import sqrt, atan, degrees
    21 
     21from exceptions import IOError
    2222
    2323
     
    179179    try:
    180180        fid = open(filename)
    181     except Exception, e:
     181    except IOError, e:
    182182        msg = 'File "%s" could not be opened: Error="%s"'\
    183183                  %(filename, e)
    184         raise msg
     184        raise IOError, msg # So IOErrors can be caught
    185185
    186186    line = fid.readline()
  • anuga_core/source/anuga/fit_interpolate/fit.py

    r4884 r5349  
    22
    33   Implements a penalised least-squares fit.
     4   putting point data onto the mesh.
    45
    56   The penalty term (or smoothing term) is controlled by the smoothing
  • anuga_core/source/anuga/fit_interpolate/test_fit.py

    r4859 r5349  
    11#!/usr/bin/env python
     2
     3"""
     4Note, fitting/blocking is also tested in
     5test_quantity.test_set_values_from_UTM_pts.
     6"""
    27
    38#TEST
  • anuga_core/source/anuga/geospatial_data/geospatial_data.py

    r5253 r5349  
    728728        file pointer position
    729729        """
    730 
    731730        from Scientific.IO.NetCDF import NetCDFFile
    732        
     731        #print "Starting to block"
    733732        #FIXME - what to do if the file isn't there
    734733
     
    739738        if self.max_read_lines is None:
    740739            self.max_read_lines = MAX_READ_LINES
    741        
    742740        if self.file_name[-4:] == ".pts":
    743741           
     
    833831            # Assume the file is a csv file
    834832            try:
     833                #print "self.max_read_lines", self.max_read_lines
    835834                pointlist, att_dict, geo_ref, self.file_pointer = \
    836835                   _read_csv_file_blocking( self.file_pointer,
Note: See TracChangeset for help on using the changeset viewer.