Changeset 9163


Ignore:
Timestamp:
Jun 16, 2014, 8:05:48 PM (10 years ago)
Author:
steve
Message:

small update to plot_utils which deals with latest version of numpy

Location:
trunk/anuga_core/source/anuga/utilities
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/source/anuga/utilities/argparsing.py

    r8465 r9163  
    44__author__="steve"
    55__date__ ="$10/07/2012 1:18:38 PM$"
     6
     7
     8
     9
     10def 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
    639
    740
     
    1548    """
    1649
    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   
    2352    args = parser.parse_args()
    2453
    2554    cfl = args.cfl
    2655    alg = args.alg
     56    verbose= args.v
     57    np = args.np
    2758
    2859
    2960    return alg, cfl
    3061
    31 
    32 
    33 
    34 def run_validation_script(script):
    35 
    36     alg, cfl = parse_standard_args()
    37 
    38 
    39     import os
    40     cmd = 'python %s -alg %s -cfl %s '% (script,alg,cfl)
    41     print 'Running: '+cmd
    42     try:
    43         os.system( cmd )
    44     except:
    45         print 'Failed running '+ script +' in '+os.getcwd()
    46         pass
    4762
    4863
  • trunk/anuga_core/source/anuga/utilities/plot_utils.py

    r9162 r9163  
    446446            newkey=varkey_c.replace('_c','')
    447447            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
    449452            var_cent=getInds(tmp, timeSlices=timeSlices, absMax=absMax)
    450453        else:
Note: See TracChangeset for help on using the changeset viewer.