Changeset 2516
- Timestamp:
- Mar 9, 2006, 5:05:54 PM (19 years ago)
- Location:
- inundation
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/pyvolution/data_manager.py
r2515 r2516 55 55 56 56 from coordinate_transforms.geo_reference import Geo_reference 57 57 58 58 59 def make_filename(s): … … 2549 2550 from Numeric import array 2550 2551 from config import time_format 2551 from util import ensure_numeric 2552 from utilities.numerical_tools import ensure_numeric 2553 2552 2554 2553 2555 -
inundation/pyvolution/domain.py
r2502 r2516 9 9 10 10 from mesh import Mesh 11 from generic_boundary_conditions import * 11 from generic_boundary_conditions import Boundary 12 from generic_boundary_conditions import File_boundary 13 from generic_boundary_conditions import Dirichlet_boundary 14 from generic_boundary_conditions import Time_boundary 15 from generic_boundary_conditions import Transmissive_boundary 16 12 17 import types 13 18 -
inundation/pyvolution/least_squares.py
r2509 r2516 28 28 from utilities.sparse import Sparse, Sparse_CSR 29 29 from utilities.cg_solve import conjugate_gradient, VectorShapeError 30 from utilities.numerical_tools import ensure_numeric, mean, gradient 31 30 32 31 33 from coordinate_transforms.geo_reference import Geo_reference … … 34 36 35 37 36 from utilities.numerical_tools import gradient 38 37 39 38 40 DEFAULT_ALPHA = 0.001 … … 321 323 322 324 """ 323 from pyvolution.util import ensure_numeric324 325 325 326 #Convert input to Numeric arrays … … 441 442 442 443 from pyvolution.quad import build_quadtree 443 from utilities.numerical_tools import ensure_numeric444 444 from utilities.polygon import inside_polygon 445 445 … … 678 678 """ 679 679 680 from util import ensure_numeric681 680 682 681 #Convert input to Numeric arrays … … 849 848 850 849 #Convert input to Numeric arrays 851 from pyvolution.util import ensure_numeric852 850 z = ensure_numeric(z, Float) 853 851 … … 894 892 895 893 #Convert input to Numeric arrays 896 from util import ensure_numeric897 894 z = ensure_numeric(z, Float) 898 895 … … 989 986 990 987 991 from util import mean, ensure_numeric992 988 from config import time_format 993 989 import types -
inundation/pyvolution/quantity.py
r2502 r2516 285 285 msg = 'Indices must be a list or None' 286 286 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) 287 295 288 296 … … 610 618 611 619 from Numeric import Float 612 from util import ensure_numeric620 from utilities.numerical_tools import ensure_numeric 613 621 from least_squares import fit_to_mesh 614 622 from coordinate_transforms.geo_reference import Geo_reference -
inundation/pyvolution/shallow_water.py
r2494 r2516 55 55 56 56 57 from domain import * 58 from region import *# 59 60 Generic_Domain = Domain #Rename 57 from domain import Domain as Generic_Domain 58 from generic_boundary_conditions import Boundary 59 from generic_boundary_conditions import File_boundary 60 from generic_boundary_conditions import Dirichlet_boundary 61 from generic_boundary_conditions import Time_boundary 62 from generic_boundary_conditions import Transmissive_boundary 63 64 from utilities.numerical_tools import gradient, mean 65 66 61 67 62 68 #Shallow water domain … … 94 100 95 101 #Reduction operation for get_vertex_values 96 from util import mean97 102 self.reduction = mean 98 103 #self.reduction = min #Looks better near steep slopes … … 1095 1100 """ 1096 1101 1097 from util import gradient1098 1102 from Numeric import zeros, Float, array, sum 1099 1103 -
inundation/pyvolution/test_all.py
r2502 r2516 81 81 82 82 #Attempt to compile all extensions 83 execfile('..' + sep + 'utilities' + sep + 'compile.py')83 #execfile('..' + sep + 'utilities' + sep + 'compile.py') 84 84 85 85 #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') 89 89 90 90 #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') 94 94 95 95 #os.system('python compile.py') -
inundation/pyvolution/test_shallow_water.py
r2305 r2516 6 6 from config import g, epsilon 7 7 from Numeric import allclose, array, zeros, ones, Float, take 8 from utilities.numerical_tools import mean 9 8 10 from shallow_water import * 9 11 … … 2943 2945 domain1 = Domain(points, vertices, boundary) 2944 2946 2945 from util import mean2946 2947 domain1.reduction = mean 2947 2948 domain1.smooth = False #Exact result … … 3062 3063 domain1 = Domain(points, vertices, boundary) 3063 3064 3064 from util import mean3065 3065 domain1.reduction = mean 3066 3066 domain1.smooth = True #To mimic MOST output -
inundation/pyvolution/util.py
r2508 r2516 6 6 7 7 8 #FIXME: Deprecate this shortcut9 from utilities.numerical_tools import ensure_numeric10 11 8 import utilities.polygon 12 9 from warnings import warn 13 10 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 warning50 from utilities.numerical_tools import gradient, gradient2, gradient_python #No warning51 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, just73 x y [attributes]74 separated by whitespace75 76 Format can be either ASCII or NetCDF77 78 Return list of points, list of attributes and79 attribute names if present otherwise None80 """81 print "read_xya is obsolete. Use import_points_file from load_mesh.loadASCII"82 #FIXME: Probably obsoleted by similar function in load_ASCII83 #FIXME: Name read_data_points (or see 'load' in pylab)84 85 86 from load_mesh.loadASCII import import_points_file87 88 points_dict = import_points_file(filename)89 return points_dict['pointlist'], points_dict['attributelist']90 91 92 93 94 #Normal util stuff95 11 96 12 def angle(v): … … 324 240 from Scientific.IO.NetCDF import NetCDFFile 325 241 from Numeric import array, zeros, Float, alltrue, concatenate, reshape 326 from util import ensure_numeric242 from utilities.numerical_tools import ensure_numeric 327 243 328 244 #Open NetCDF file … … 545 461 546 462 547 548 549 550 551 552 553 463 #################################### 464 ####OBSOLETE STUFF 465 466 467 def 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 476 def 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 484 def 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 493 def 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 503 def 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 512 def 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 520 def 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 167 167 from utilities import compile 168 168 if compile.can_use_C_extension('util_ext.c'): 169 from util_ext import gradient, gradient2 #, point_on_line169 from util_ext import gradient, gradient2 170 170 else: 171 171 gradient = gradient_python -
inundation/utilities/test_numerical_tools.py
r2509 r2516 181 181 for i in range(4): 182 182 #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]) 186 185 187 186 #print a_ref, b_ref
Note: See TracChangeset
for help on using the changeset viewer.