Ignore:
Timestamp:
Jan 18, 2006, 1:18:37 PM (18 years ago)
Author:
duncan
Message:

add verbose setting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/pyvolution/smf.py

    r2210 r2219  
    5151                  gravity=9.8, gamma=1.85, \
    5252                  massco=1, dragco=1, frictionco=0, psi=0, \
    53                   dx=None, kappa=3.0, kappad=0.8, zsmall=0.01):
     53                  dx=None, kappa=3.0, kappad=0.8, zsmall=0.01,
     54                  verbose=False):
    5455
    5556    from math import sin, tan, radians, pi, sqrt, exp
     
    8586
    8687    #a few temporary print statements
    87     print '\nThe slide ...'
    88     print '\tLength: ', length
    89     print '\tDepth: ', depth
    90     print '\tSlope: ', slope
    91     print '\tWidth: ', width
    92     print '\tThickness: ', thickness
    93     print '\tx0: ', x0
    94     print '\ty0: ', y0
    95     print '\tAlpha: ', alpha
    96     print '\tAcceleration: ', a0
    97     print '\tTerminal velocity: ', ut
    98     print '\tChar time: ', t0
    99     print '\tChar distance: ', s0
    100     print '\nThe tsunami ...'
    101     print '\tWavelength: ', w
    102     print '\t2D amplitude: ', a2D
    103     print '\t3D amplitude: ', a3D
     88    if verbose is True:
     89        print '\nThe slide ...'
     90        print '\tLength: ', length
     91        print '\tDepth: ', depth
     92        print '\tSlope: ', slope
     93        print '\tWidth: ', width
     94        print '\tThickness: ', thickness
     95        print '\tx0: ', x0
     96        print '\ty0: ', y0
     97        print '\tAlpha: ', alpha
     98        print '\tAcceleration: ', a0
     99        print '\tTerminal velocity: ', ut
     100        print '\tChar time: ', t0
     101        print '\tChar distance: ', s0
     102        print '\nThe tsunami ...'
     103        print '\tWavelength: ', w
     104        print '\t2D amplitude: ', a2D
     105        print '\t3D amplitude: ', a3D
    104106
    105107    #keep an eye on some of the assumptions built into the maths
    106108
    107109    if ((slope < 5) or (slope > 30)):
    108         print 'WARNING: slope out of range (5 - 30 degrees) ', slope
     110        if verbose is True:
     111            print 'WARNING: slope out of range (5 - 30 degrees) ', slope
    109112    if ((depth/length < 0.06) or (depth/length > 1.5)):
    110         print  'WARNING: d/b out of range (0.06 - 1.5) ', depth/length
     113        if verbose is True:
     114            print  'WARNING: d/b out of range (0.06 - 1.5) ', depth/length
    111115    if ((thickness/length < 0.008) or (thickness/length > 0.2)):
    112         print 'WARNING: T/b out of range (0.008 - 0.2) ', thickness/length
     116        if verbose is True:
     117            print 'WARNING: T/b out of range (0.008 - 0.2) ', thickness/length
    113118    if ((gamma < 1.46) or (gamma > 2.93)):
    114         print 'WARNING: gamma out of range (1.46 - 2.93) ', gamma
     119        if verbose is True:
     120            print 'WARNING: gamma out of range (1.46 - 2.93) ', gamma
    115121
    116122    return Double_gaussian(a3D=a3D, wavelength=w, width=width, \
     
    171177                  gravity=9.8, gamma=1.85, \
    172178                  massco=1, dragco=1, frictionco=0, \
    173                   dx=None, kappa=3.0, kappad=0.8, zsmall=0.01):
     179                  dx=None, kappa=3.0, kappad=0.8, zsmall=0.01,
     180                  verbose=False):
    174181
    175182    from math import sin, radians, sqrt
     
    207214
    208215    #a few temporary print statements
    209     print '\nThe slump ...'
    210     print '\tLength: ', length
    211     print '\tDepth: ', depth
    212     print '\tSlope: ', slope
    213     print '\tWidth: ', width
    214     print '\tThickness: ', thickness
    215     print '\tRadius: ', radius
    216     print '\tDphi: ', dphi
    217     print '\tx0: ', x0
    218     print '\ty0: ', y0
    219     print '\tAlpha: ', alpha
    220     print '\tAcceleration: ', a0
    221     print '\tMaximum velocity: ', um
    222     print '\tChar time: ', t0
    223     print '\tChar distance: ', s0
    224     print '\nThe tsunami ...'
    225     print '\tWavelength: ', w
    226     print '\t2D amplitude: ', a2D
    227     print '\t3D amplitude: ', a3D
     216    if verbose is True:
     217        print '\nThe slump ...'
     218        print '\tLength: ', length
     219        print '\tDepth: ', depth
     220        print '\tSlope: ', slope
     221        print '\tWidth: ', width
     222        print '\tThickness: ', thickness
     223        print '\tRadius: ', radius
     224        print '\tDphi: ', dphi
     225        print '\tx0: ', x0
     226        print '\ty0: ', y0
     227        print '\tAlpha: ', alpha
     228        print '\tAcceleration: ', a0
     229        print '\tMaximum velocity: ', um
     230        print '\tChar time: ', t0
     231        print '\tChar distance: ', s0
     232        print '\nThe tsunami ...'
     233        print '\tWavelength: ', w
     234        print '\t2D amplitude: ', a2D
     235        print '\t3D amplitude: ', a3D
    228236
    229237    #keep an eye on some of the assumptions built into the maths
    230238
    231     if ((slope < 10) or (slope > 30)):
    232         print 'WARNING: slope out of range (10 - 30 degrees) ', slope
    233     if ((depth/length < 0.34) or (depth/length > 0.5)):
    234         print  'WARNING: d/b out of range (0.34 - 0.5) ', depth/length
    235     if ((thickness/length < 0.10) or (thickness/length > 0.15)):
    236         print 'WARNING: T/b out of range (0.10 - 0.15) ', thickness/length
    237     if ((radius/length < 1.0) or (radius/length > 2.0)):
    238         print 'WARNING: R/b out of range (1 - 2) ', radius/length
    239     if ((dphi < 0.10) or (dphi > 0.52)):
    240         print 'WARNING: del_phi out of range (0.10 - 0.52) ', dphi
    241     if ((gamma < 1.46) or (gamma > 2.93)):
    242         print 'WARNING: gamma out of range (1.46 - 2.93) ', gamma
     239    if ((slope < 10) or (slope > 30)):       
     240        if verbose is True:
     241            print 'WARNING: slope out of range (10 - 30 degrees) ', slope
     242    if ((depth/length < 0.34) or (depth/length > 0.5)):     
     243        if verbose is True:
     244            print  'WARNING: d/b out of range (0.34 - 0.5) ', depth/length
     245    if ((thickness/length < 0.10) or (thickness/length > 0.15)):     
     246        if verbose is True:
     247            print 'WARNING: T/b out of range (0.10 - 0.15) ', thickness/length
     248    if ((radius/length < 1.0) or (radius/length > 2.0)):     
     249        if verbose is True:
     250            print 'WARNING: R/b out of range (1 - 2) ', radius/length
     251    if ((dphi < 0.10) or (dphi > 0.52)):     
     252        if verbose is True:
     253            print 'WARNING: del_phi out of range (0.10 - 0.52) ', dphi
     254    if ((gamma < 1.46) or (gamma > 2.93)):     
     255        if verbose is True:
     256            print 'WARNING: gamma out of range (1.46 - 2.93) ', gamma
    243257
    244258    return Double_gaussian(a3D=a3D, wavelength=w, width=width, \
Note: See TracChangeset for help on using the changeset viewer.