Changeset 6223


Ignore:
Timestamp:
Jan 21, 2009, 4:37:45 PM (15 years ago)
Author:
ole
Message:

Various cleanup

Location:
anuga_core/source/anuga
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/fit_interpolate/interpolate.py

    r6194 r6223  
    794794
    795795        if verbose is True:
    796             print 'Interpolation_function: thinning'
     796            print 'Interpolation_function: thinning by %d' % time_thinning
    797797
    798798           
     
    915915                self.precomputed_values[name] = num.zeros((p, m), num.Float)
    916916
     917            if verbose is True:
     918                print 'Build interpolator'
     919
     920               
    917921            # Build interpolator
    918             if verbose:
    919                 if triangles is not None and vertex_coordinates is not None:
     922            if triangles is not None and vertex_coordinates is not None:
     923                if verbose:               
    920924                    msg = 'Building interpolation matrix from source mesh '
    921925                    msg += '(%d vertices, %d triangles)' \
    922926                           % (vertex_coordinates.shape[0],
    923927                              triangles.shape[0])
    924                 elif triangles is None and vertex_coordinates is not None:
    925                     msg = 'Building interpolation matrix from source points'
     928                    print msg
    926929               
    927                 print msg
    928 
    929             # FIXME(Ole): This one is no longer needed for STS files
    930             interpol = Interpolate(vertex_coordinates,
    931                                    triangles,
    932                                    verbose=verbose)
     930                # This one is no longer needed for STS files
     931                interpol = Interpolate(vertex_coordinates,
     932                                       triangles,
     933                                       verbose=verbose)               
     934               
     935            elif triangles is None and vertex_coordinates is not None:
     936                if verbose:
     937                    msg = 'Interpolation from STS file'
     938                    print msg
     939
     940
    933941
    934942            if verbose:
  • anuga_core/source/anuga/utilities/polygon.py

    r6189 r6223  
    661661    """
    662662
    663     def __init__(self, regions, default=0.0, geo_reference=None):
     663    def __init__(self,
     664                 regions,
     665                 default=0.0,
     666                 geo_reference=None):
    664667
    665668        try:
     
    702705        for polygon, value in regions:
    703706            P = geo_reference.change_points_geo_ref(polygon)
    704             self.regions.append( (P, value) )
     707            self.regions.append((P, value))
    705708
    706709
     
    714717        assert len(y) == N
    715718
    716         points = num.concatenate( (num.reshape(x, (N, 1)),
    717                                    num.reshape(y, (N, 1))), axis=1 )
     719        points = num.concatenate((num.reshape(x, (N, 1)),
     720                                  num.reshape(y, (N, 1))), axis=1)
    718721
    719722        if callable(self.default):
     
    735738                    z[i] = value
    736739
     740        if len(z) == 0:
     741            msg = 'Warning: points provided to Polygon function did not fall within'
     742            msg += 'its regions'
     743            msg += 'x in [%.2f, %.2f], y in [%.2f, %.2f]' % (min(x), max(x),
     744                                                             min(y), max(y))
     745            print msg
     746
     747           
    737748        return z
    738749
Note: See TracChangeset for help on using the changeset viewer.