Changeset 4586
- Timestamp:
- Jul 4, 2007, 4:36:57 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/shallow_water/data_manager.py
r4567 r4586 1650 1650 #print "basename_in",basename_in 1651 1651 #print "base",base 1652 1653 iterate_over = get_all_swwfiles(dir,base,verbose) 1652 1654 1653 1655 if dir == "": 1654 1656 dir = "." # Unix compatibility 1655 dir_ls = os.listdir(dir)1656 iterate_over = [x[:-4] for x in dir_ls if base in x and x[-4:] == '.sww']1657 1658 if len(iterate_over) == 0:1659 msg = 'No files of the base name %s.'\1660 %(basename_in)1661 raise IOError, msg1662 1657 1663 1658 files_out = [] 1664 # print 'sww_file',sww_file 1659 #print 'sww_file',iterate_over 1665 1660 for sww_file in iterate_over: 1666 1661 for quantity in quantities: … … 5614 5609 return maximal_runup, maximal_runup_location 5615 5610 5611 def get_all_swwfiles(look_in_dir='',base_name='',verbose=False): 5612 ''' 5613 Finds all the sww files in a "look_in_dir" which contains a "base_name" 5614 5615 Returns: a list of strings 5616 ''' 5617 5618 if look_in_dir == "": 5619 look_in_dir = "." # Unix compatibility 5620 5621 dir_ls = os.listdir(look_in_dir) 5622 #print 'dir_ls',dir_ls, base 5623 iterate_over = [x[:-4] for x in dir_ls if base_name in x and x[-4:] == '.sww'] 5624 if len(iterate_over) == 0: 5625 msg = 'No files of the base name %s'\ 5626 %(base_name) 5627 raise IOError, msg 5628 if verbose: print 'iterate over %s' %(iterate_over) 5629 5630 #print 'iter',iterate_over 5631 # files_out = [] 5632 #print 'sww_file',sww_file 5633 # for sww_file in iterate_over: 5634 return iterate_over 5635 5616 5636 5617 5637 #-------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.