source: branches/inundation-numpy-branch/pyvolution/check_sww_tsh.py @ 7077

Last change on this file since 7077 was 3514, checked in by duncan, 19 years ago

Hi all,
I'm doing a change in the anuga structure, moving the code to

\anuga_core\source\anuga

After you have done an svn update, the PYTHONPATH has to be changed to;
PYTHONPATH = anuga_core/source/

This is part of changes required to make installation of anuga quicker and reducing the size of our sandpits.

If any imports are broken, try fixing them. With adding anuga. to them for example. If this seems to have really broken things, email/phone me.

Cheers
Duncan

File size: 1.9 KB
Line 
1
2######################
3# Module imports
4import sys
5from os import sep, path
6
7import anuga.pyvolution.data_manager
8from load_mesh.loadASCII import import_mesh_file
9from shallow_water import Domain
10from pmesh2domain import pmesh_to_domain_instance
11
12def check_sww_tsh(sww_file, tsh_file, verbose = False):
13    [xmin, xmax, ymin, ymax, stagemin, stagemax] =  \
14           data_manager.extent_sww(sww_file)
15    if verbose == True:print "Extent of ", sww_file
16    if verbose == True:print "xmin", xmin
17    if verbose == True:print "xmax", xmax
18    if verbose == True:print "ymin", ymin
19    if verbose == True:print "ymax", ymax
20    if verbose == True:print "stagemin", stagemin
21    if verbose == True:print "stagemax", stagemax
22   
23    domain = pmesh_to_domain_instance(tsh_file, Domain)
24    [tsh_xmin, tsh_xmax, tsh_ymin, tsh_ymax] =  domain.get_extent()
25    if verbose == True:print "Extent of ", tsh_file
26    if verbose == True:print "tsh_xmin", tsh_xmin
27    if verbose == True:print "tsh_xmax", tsh_xmax
28    if verbose == True:print "tsh_ymin", tsh_ymin
29    if verbose == True:print "tsh_ymax", tsh_ymax
30    is_subset = xmin < tsh_xmin and xmax > tsh_xmax and  \
31                ymin < tsh_ymin and ymax > tsh_ymax
32    if verbose == True:
33        if is_subset:
34            print "tsh within sww"
35        else:
36            print "WARNING: tsh NOT within sww"
37       
38 
39#-------------------------------------------------------------
40if __name__ == "__main__":
41    """
42    Load in a mesh and data points with attributes.
43    Fit the attributes to the mesh.
44    Save a new mesh file.
45    """
46    import os, sys
47    usage = "usage: %s *.sww *.tsh" %os.path.basename(sys.argv[0])
48
49    if len(sys.argv) < 3:
50        print usage
51    else:
52        sww_file = sys.argv[1]
53        tsh_file = sys.argv[2]
54        check_sww_tsh(sww_file, tsh_file, verbose = True)
Note: See TracBrowser for help on using the repository browser.