source: anuga_core/source/anuga/shallow_water/check_sww_tsh.py @ 5612

Last change on this file since 5612 was 3565, checked in by ole, 16 years ago

Moved obsolete code and examples to their appropriate locations

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 anuga.pyvolution.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.