Changeset 9163
- Timestamp:
- Jun 16, 2014, 8:05:48 PM (10 years ago)
- Location:
- trunk/anuga_core/source/anuga/utilities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_core/source/anuga/utilities/argparsing.py
r8465 r9163 4 4 __author__="steve" 5 5 __date__ ="$10/07/2012 1:18:38 PM$" 6 7 8 9 10 def create_standard_parser(): 11 """ Creates a standard argument parser""" 12 13 14 #from anuga.validation_utilities.parameters import cfl as default_cfl 15 from anuga.validation_utilities.parameters import alg as default_alg 16 17 import argparse 18 parser = argparse.ArgumentParser(description='validation parse') 19 20 #parser.add_argument('-cfl', type=float, default=default_cfl, 21 # help='cfl condition') 22 23 parser.add_argument('-ft', '--finaltime', type=float, default=-1.0, 24 help='finaltime') 25 26 parser.add_argument('-ys', '--yieldstep', type=float, default=-1.0, 27 help='yieldstep') 28 29 parser.add_argument('-alg', type=str, default = default_alg, 30 help='flow algorithm') 31 32 parser.add_argument('-np', type=int, default = 1, 33 help='number of processors to be used') 34 35 parser.add_argument('-v', '--verbose', nargs='?', type=bool, const=True, default=False, 36 help='turn on verbosity') 37 38 return parser 6 39 7 40 … … 15 48 """ 16 49 17 import argparse 18 parser = argparse.ArgumentParser(description='validation parse') 19 parser.add_argument('-cfl', type=float, default=1.0, 20 help='cfl condition') 21 parser.add_argument('-alg', type=str, default = "1_5", 22 help='flow algorithm') 50 parser = create_standard_parser() 51 23 52 args = parser.parse_args() 24 53 25 54 cfl = args.cfl 26 55 alg = args.alg 56 verbose= args.v 57 np = args.np 27 58 28 59 29 60 return alg, cfl 30 61 31 32 33 34 def run_validation_script(script):35 36 alg, cfl = parse_standard_args()37 38 39 import os40 cmd = 'python %s -alg %s -cfl %s '% (script,alg,cfl)41 print 'Running: '+cmd42 try:43 os.system( cmd )44 except:45 print 'Failed running '+ script +' in '+os.getcwd()46 pass47 62 48 63 -
trunk/anuga_core/source/anuga/utilities/plot_utils.py
r9162 r9163 446 446 newkey=varkey_c.replace('_c','') 447 447 tmp = fid.variables[newkey][:] 448 tmp=(tmp[:,vols0]+tmp[:,vols1]+tmp[:,vols2])/3.0 448 try: # array contain time slides 449 tmp=(tmp[:,vols0]+tmp[:,vols1]+tmp[:,vols2])/3.0 450 except: 451 tmp=(tmp[vols0]+tmp[vols1]+tmp[vols2])/3.0 449 452 var_cent=getInds(tmp, timeSlices=timeSlices, absMax=absMax) 450 453 else:
Note: See TracChangeset
for help on using the changeset viewer.