Changeset 2516


Ignore:
Timestamp:
Mar 9, 2006, 5:05:54 PM (18 years ago)
Author:
ole
Message:

Lots of clean up of obsolete stuff

Location:
inundation
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • inundation/pyvolution/data_manager.py

    r2515 r2516  
    5555
    5656from coordinate_transforms.geo_reference import Geo_reference
     57
    5758
    5859def make_filename(s):
     
    25492550    from Numeric import array
    25502551    from config import time_format
    2551     from util import ensure_numeric
     2552    from utilities.numerical_tools import ensure_numeric   
     2553
    25522554
    25532555
  • inundation/pyvolution/domain.py

    r2502 r2516  
    99
    1010from mesh import Mesh
    11 from generic_boundary_conditions import *
     11from generic_boundary_conditions import Boundary
     12from generic_boundary_conditions import File_boundary
     13from generic_boundary_conditions import Dirichlet_boundary
     14from generic_boundary_conditions import Time_boundary
     15from generic_boundary_conditions import Transmissive_boundary
     16
    1217import types
    1318
  • inundation/pyvolution/least_squares.py

    r2509 r2516  
    2828from utilities.sparse import Sparse, Sparse_CSR
    2929from utilities.cg_solve import conjugate_gradient, VectorShapeError
     30from utilities.numerical_tools import ensure_numeric, mean, gradient
     31
    3032
    3133from coordinate_transforms.geo_reference import Geo_reference
     
    3436
    3537
    36 from utilities.numerical_tools import gradient
     38
    3739
    3840DEFAULT_ALPHA = 0.001
     
    321323
    322324        """
    323         from pyvolution.util import ensure_numeric
    324325
    325326        #Convert input to Numeric arrays
     
    441442
    442443        from pyvolution.quad import build_quadtree
    443         from utilities.numerical_tools import ensure_numeric
    444444        from utilities.polygon import inside_polygon
    445445       
     
    678678        """
    679679
    680         from util import ensure_numeric
    681680
    682681        #Convert input to Numeric arrays
     
    849848
    850849        #Convert input to Numeric arrays
    851         from pyvolution.util import ensure_numeric
    852850        z = ensure_numeric(z, Float)
    853851
     
    894892
    895893            #Convert input to Numeric arrays
    896             from util import ensure_numeric
    897894            z = ensure_numeric(z, Float)
    898895
     
    989986
    990987
    991         from util import mean, ensure_numeric
    992988        from config import time_format
    993989        import types
  • inundation/pyvolution/quantity.py

    r2502 r2516  
    285285        msg = 'Indices must be a list or None'
    286286        assert type(indices) in [ListType, NoneType, ArrayType], msg
     287
     288
     289        if not(points is None and values is None and data_georef is None):
     290            from warnings import warn
     291           
     292            msg = 'Using points, values or data_georef with set_quantity '
     293            msg += 'is obsolete. Please use a Geospatial_data object instead.'
     294            warn(msg, DeprecationWarning)
    287295
    288296
     
    610618
    611619        from Numeric import Float
    612         from util import ensure_numeric
     620        from utilities.numerical_tools import ensure_numeric
    613621        from least_squares import fit_to_mesh
    614622        from coordinate_transforms.geo_reference import Geo_reference
  • inundation/pyvolution/shallow_water.py

    r2494 r2516  
    5555
    5656
    57 from domain import *
    58 from region import *#
    59 
    60 Generic_Domain = Domain #Rename
     57from domain import Domain as Generic_Domain
     58from generic_boundary_conditions import Boundary
     59from generic_boundary_conditions import File_boundary
     60from generic_boundary_conditions import Dirichlet_boundary
     61from generic_boundary_conditions import Time_boundary
     62from generic_boundary_conditions import Transmissive_boundary
     63
     64from utilities.numerical_tools import gradient, mean
     65
     66
    6167
    6268#Shallow water domain
     
    94100
    95101        #Reduction operation for get_vertex_values
    96         from util import mean
    97102        self.reduction = mean
    98103        #self.reduction = min  #Looks better near steep slopes
     
    10951100    """
    10961101
    1097     from util import gradient
    10981102    from Numeric import zeros, Float, array, sum
    10991103
  • inundation/pyvolution/test_all.py

    r2502 r2516  
    8181
    8282    #Attempt to compile all extensions
    83     execfile('..' + sep + 'utilities' + sep + 'compile.py')
     83    #execfile('..' + sep + 'utilities' + sep + 'compile.py')
    8484
    8585    #FIXME: Temporary measure
    86     os.chdir('..' + sep + 'utilities')
    87     execfile('compile.py')
    88     os.chdir('..' + sep + 'pyvolution')   
     86    #os.chdir('..' + sep + 'utilities')
     87    #execfile('compile.py')
     88    #os.chdir('..' + sep + 'pyvolution')   
    8989   
    9090    #FIXME: Temporary measure
    91     os.chdir('..' + sep + 'triangle')
    92     execfile('compile.py')
    93     os.chdir('..' + sep + 'pyvolution')   
     91    #os.chdir('..' + sep + 'triangle')
     92    #execfile('compile.py')
     93    #os.chdir('..' + sep + 'pyvolution')   
    9494   
    9595    #os.system('python compile.py')
  • inundation/pyvolution/test_shallow_water.py

    r2305 r2516  
    66from config import g, epsilon
    77from Numeric import allclose, array, zeros, ones, Float, take
     8from utilities.numerical_tools import mean
     9
    810from shallow_water import *
    911
     
    29432945        domain1 = Domain(points, vertices, boundary)
    29442946
    2945         from util import mean
    29462947        domain1.reduction = mean
    29472948        domain1.smooth = False  #Exact result
     
    30623063        domain1 = Domain(points, vertices, boundary)
    30633064
    3064         from util import mean
    30653065        domain1.reduction = mean
    30663066        domain1.smooth = True #To mimic MOST output
  • inundation/pyvolution/util.py

    r2508 r2516  
    66
    77
    8 #FIXME: Deprecate this shortcut
    9 from utilities.numerical_tools import ensure_numeric
    10 
    118import utilities.polygon
    129from warnings import warn
    1310
    14 def point_on_line(*args, **kwargs):
    15     """Temporary Interface to new location"""
    16 
    17     msg = 'point_on_line has moved from util.py.  '
    18     msg += 'Please use "from utilities.polygon import point_on_line"'
    19     warn(msg, DeprecationWarning)
    20 
    21     return utilities.polygon.point_on_line(*args, **kwargs)     
    22    
    23 def inside_polygon(*args, **kwargs):
    24     """Temporary Interface to new location"""
    25 
    26     print 'inside_polygon has moved from util.py.  ',
    27     print 'Please use "from utilities.polygon import inside_polygon"'
    28 
    29     return utilities.polygon.inside_polygon(*args, **kwargs)   
    30    
    31 def outside_polygon(*args, **kwargs):
    32     """Temporary Interface to new location"""
    33 
    34     print 'outside_polygon has moved from util.py.  ',
    35     print 'Please use "from utilities.polygon import outside_polygon"'
    36 
    37     return utilities.polygon.outside_polygon(*args, **kwargs)   
    38 
    39 
    40 def separate_points_by_polygon(*args, **kwargs):
    41     """Temporary Interface to new location"""
    42 
    43     print 'separate_points_by_polygon has moved from util.py.  ',
    44     print 'Please use "from utilities.polygon import separate_points_by_polygon"'
    45 
    46     return utilities.polygon.separate_points_by_polygon(*args, **kwargs)   
    47 
    48 
    49 from utilities.polygon import Polygon_function #No warning
    50 from utilities.numerical_tools import gradient, gradient2, gradient_python #No warning
    51 
    52 
    53 
    54 def read_polygon(*args, **kwargs):
    55     """Temporary Interface to new location"""
    56 
    57     print 'read_polygon has moved from util.py.  ',
    58     print 'Please use "from utilities.polygon import read_polygon"'
    59 
    60     return utilities.polygon.read_polygon(*args, **kwargs)   
    61 
    62 
    63 def populate_polygon(*args, **kwargs):
    64     """Temporary Interface to new location"""
    65 
    66     print 'populate_polygon has moved from util.py.  ',
    67     print 'Please use "from utilities.polygon import populate_polygon"'
    68 
    69     return utilities.polygon.populate_polygon(*args, **kwargs)   
    70 
    71 def read_xya(filename):
    72     """Read simple xya file, possibly with a header in the first line, just
    73     x y [attributes]
    74     separated by whitespace
    75 
    76     Format can be either ASCII or NetCDF
    77 
    78     Return list of points, list of attributes and
    79     attribute names if present otherwise None
    80     """
    81     print "read_xya is obsolete.  Use import_points_file from load_mesh.loadASCII"
    82     #FIXME: Probably obsoleted by similar function in load_ASCII
    83     #FIXME: Name read_data_points (or see 'load' in pylab)
    84 
    85    
    86     from load_mesh.loadASCII import import_points_file
    87 
    88     points_dict = import_points_file(filename)
    89     return points_dict['pointlist'], points_dict['attributelist']
    90 
    91    
    92 
    93 
    94 #Normal util stuff
    9511
    9612def angle(v):
     
    324240    from Scientific.IO.NetCDF import NetCDFFile
    325241    from Numeric import array, zeros, Float, alltrue, concatenate, reshape
    326     from util import ensure_numeric   
     242    from utilities.numerical_tools import ensure_numeric   
    327243
    328244    #Open NetCDF file
     
    545461
    546462
    547 
    548 
    549 
    550 
    551 
    552 
    553 
     463####################################
     464####OBSOLETE STUFF
     465
     466
     467def point_on_line(*args, **kwargs):
     468    """Temporary Interface to new location"""
     469
     470    msg = 'point_on_line has moved from util.py.  '
     471    msg += 'Please use "from utilities.polygon import point_on_line"'
     472    warn(msg, DeprecationWarning)
     473
     474    return utilities.polygon.point_on_line(*args, **kwargs)     
     475   
     476def inside_polygon(*args, **kwargs):
     477    """Temporary Interface to new location"""
     478
     479    print 'inside_polygon has moved from util.py.  ',
     480    print 'Please use "from utilities.polygon import inside_polygon"'
     481
     482    return utilities.polygon.inside_polygon(*args, **kwargs)   
     483   
     484def outside_polygon(*args, **kwargs):
     485    """Temporary Interface to new location"""
     486
     487    print 'outside_polygon has moved from util.py.  ',
     488    print 'Please use "from utilities.polygon import outside_polygon"'
     489
     490    return utilities.polygon.outside_polygon(*args, **kwargs)   
     491
     492
     493def separate_points_by_polygon(*args, **kwargs):
     494    """Temporary Interface to new location"""
     495
     496    print 'separate_points_by_polygon has moved from util.py.  ',
     497    print 'Please use "from utilities.polygon import separate_points_by_polygon"'
     498
     499    return utilities.polygon.separate_points_by_polygon(*args, **kwargs)   
     500
     501
     502
     503def read_polygon(*args, **kwargs):
     504    """Temporary Interface to new location"""
     505
     506    print 'read_polygon has moved from util.py.  ',
     507    print 'Please use "from utilities.polygon import read_polygon"'
     508
     509    return utilities.polygon.read_polygon(*args, **kwargs)   
     510
     511
     512def populate_polygon(*args, **kwargs):
     513    """Temporary Interface to new location"""
     514
     515    print 'populate_polygon has moved from util.py.  ',
     516    print 'Please use "from utilities.polygon import populate_polygon"'
     517
     518    return utilities.polygon.populate_polygon(*args, **kwargs)   
     519
     520def read_xya(filename):
     521    """Read simple xya file, possibly with a header in the first line, just
     522    x y [attributes]
     523    separated by whitespace
     524
     525    Format can be either ASCII or NetCDF
     526
     527    Return list of points, list of attributes and
     528    attribute names if present otherwise None
     529    """
     530    print "read_xya is obsolete.  Use import_points_file from load_mesh.loadASCII"
     531    #FIXME: Probably obsoleted by similar function in load_ASCII
     532    #FIXME: Name read_data_points (or see 'load' in pylab)
     533
     534   
     535    from load_mesh.loadASCII import import_points_file
     536
     537    points_dict = import_points_file(filename)
     538    return points_dict['pointlist'], points_dict['attributelist']
     539
     540   
     541
     542
  • inundation/utilities/numerical_tools.py

    r2508 r2516  
    167167from utilities import compile
    168168if compile.can_use_C_extension('util_ext.c'):
    169     from util_ext import gradient, gradient2#, point_on_line
     169    from util_ext import gradient, gradient2
    170170else:
    171171    gradient = gradient_python
  • inundation/utilities/test_numerical_tools.py

    r2509 r2516  
    181181        for i in range(4):
    182182            #Gradient of fitted pwl surface
    183             from util import gradient_python
    184             a_ref, b_ref = gradient(x0, y0, x1, y1, x2, y2,
    185                                     q0[i], q1[i], q2[i])
     183            a_ref, b_ref = gradient_python(x0, y0, x1, y1, x2, y2,
     184                                           q0[i], q1[i], q2[i])
    186185
    187186            #print a_ref, b_ref
Note: See TracChangeset for help on using the changeset viewer.