Changeset 6438


Ignore:
Timestamp:
Mar 3, 2009, 1:16:59 PM (15 years ago)
Author:
ole
Message:

Fixed bug in ensure_numeric where input was always copied irrespective of type.

Then fixed snowball bugs by copying input to ensure_numeric where appropriate.

Thanks Ross

Location:
anuga_core/source/anuga
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/coordinate_transforms/geo_reference.py

    r6149 r6438  
    77#and unit test
    88
     9
    910import types, sys
     11import copy
    1012from anuga.utilities.numerical_tools import ensure_numeric
    1113from anuga.utilities.anuga_exceptions import ANUGAError, TitleError, ParsingError, \
     
    192194        If the points do not have a geo ref, assume 'absolute' values
    193195        """
    194 
     196        import copy
     197       
    195198        is_list = False
    196199        if type(points) == types.ListType:
    197200            is_list = True
    198201
    199         points = ensure_numeric(points, num.Float)
     202        points = ensure_numeric(copy.copy(points), num.Float)
    200203       
    201204        if len(points.shape) == 1:
     
    256259            is_list = True
    257260
    258         points = ensure_numeric(points, num.Float)
     261        points = ensure_numeric(copy.copy(points), num.Float)
    259262        if len(points.shape) == 1:
    260263            #One point has been passed
  • anuga_core/source/anuga/geospatial_data/geospatial_data.py

    r6166 r6438  
    14601460    """
    14611461
     1462    import copy
    14621463    # Input check
    14631464    if isinstance(points, basestring):
     
    14701471        assert geo_reference == None, msg
    14711472    else:
    1472         points = ensure_numeric(points, num.Float)
     1473        points = ensure_numeric(copy.copy(points), num.Float)
    14731474
    14741475    # Sort of geo_reference and convert points
     
    15071508    """
    15081509
     1510    import copy
    15091511    # Input check
    15101512    if isinstance(points, Geospatial_data):
  • anuga_core/source/anuga/utilities/numerical_tools.py

    r6436 r6438  
    254254    else:
    255255        if type(A) == num.ArrayType:
    256             if A.typecode == typecode:
     256            if A.typecode() == typecode:
    257257                return A
    258258            else:
Note: See TracChangeset for help on using the changeset viewer.