Changeset 1062


Ignore:
Timestamp:
Mar 11, 2005, 12:14:59 PM (20 years ago)
Author:
duncan
Message:

added a hack to util to stop acos(1.0) and acos(-1.0) causing an error. confused as to why it was causing an error.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/ga/storm_surge/pyvolution/util.py

    r1056 r1062  
    2020        theta = acos(v1)
    2121    except ValueError, e:
    22         print 'Angle acos(%s) failed: %s' %(str(v1), e)         
    23         raise ValueError, e
    24 
     22        print 'WARNING Angle acos(%s) failed: %s' %(str(v1), e)
     23
     24        #FIXME, hack to avoid acos(1.0) Value error
     25        # why is it happening?
     26        # is it catching something we should avoid?
     27        s = 1e-6
     28        if (v1+s >  1.0) and (v1-s < 1.0) :
     29            theta = 0.0
     30        elif (v1+s >  -1.0) and (v1-s < -1.0):
     31            theta = 3.1415926535897931
     32        print "WARNING, setting theta to ", theta   
    2533    if v2 < 0:
    2634        #Quadrant 3 or 4
Note: See TracChangeset for help on using the changeset viewer.