Ignore:
Timestamp:
Nov 15, 2011, 11:37:36 PM (13 years ago)
Author:
steve
Message:

Got rid of those annoying double_scalar warnings in the windows code (just divide by zero warnings)

Location:
trunk/anuga_core/source/anuga/file
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/source/anuga/file

    • Property svn:ignore set to
      .python_cache
  • trunk/anuga_core/source/anuga/file/test_mux.py

    r7766 r8249  
    117117    def delete_mux(self, files):
    118118        for file in files:
    119             os.remove(file)
     119            try:
     120                os.remove(file)
     121            except:
     122                pass
    120123       
    121124    def write_mux2(self, lat_long_points, time_step_count, time_step,
  • trunk/anuga_core/source/anuga/file/test_urs.py

    r7766 r8249  
    101101       
    102102    def test_URS_points_northern_hemisphere(self):
    103                
     103
    104104        LL_LAT = 8.0
    105105        LL_LONG = 97.0
     
    130130#                                   export_csv=True,
    131131#                                   verbose=self.verbose)
    132        
     132
    133133        geo=calculate_boundary_points(poly_lat_long,
    134134                                  ZONE,
     
    138138                                  isSouthHemisphere=False,
    139139                                  verbose=self.verbose)
    140        
     140
    141141        results = frozenset(geo.get_data_points(as_lat_long=True,
    142142                                                isSouthHemisphere=False))
     143
    143144        #print 'results',results
    144145
     
    160161            if not found:
    161162                assert False
    162        
    163163
    164164    def covered_in_other_tests_test_URS_points_needed_poly1(self):
  • trunk/anuga_core/source/anuga/file/urs.py

    r8143 r8249  
    199199
    200200    """
    201 
     201   
    202202    msg = "grid_spacing can not be zero"
    203203    assert not grid_spacing == 0, msg
     
    207207    # List of segments.  Each segment is two points.
    208208    segs = [i and [a[i-1], a[i]] or [a[len(a)-1], a[0]] for i in range(len(a))]
     209
    209210
    210211    # convert the segs to Lat's and longs.
     
    213214    lat_long_set = frozenset()
    214215    for seg in segs:
     216
    215217        points_lat_long = points_needed(seg, ll_lat, ll_long, grid_spacing,
    216218                                        lat_amount, long_amount, zone,
    217219                                        isSouthHemisphere)
     220
    218221        lat_long_set |= frozenset(points_lat_long)
     222
    219223
    220224    if lat_long_set == frozenset([]):
     
    276280    for index_lat in range(first_row_lat, last_row_lat + 1):
    277281        for index_long in range(first_row_long, last_row_long + 1):
     282
    278283            lat = ll_lat + index_lat*grid_spacing
    279284            long = ll_long + index_long*grid_spacing
     285
    280286
    281287            #filter here to keep good points
     
    283289                points_lat_long.append((lat, long)) #must be hashable
    284290
     291
    285292    # Now that we have these points, lets throw ones out that are too far away
     293
    286294    return points_lat_long
    287295       
     
    302310    x2_1 = x2-x1
    303311    y2_1 = y2-y1
    304     try:
    305         d = abs((x2_1)*(y1-y0)-(x1-x0)*(y2_1))/sqrt( \
    306             (x2_1)*(x2_1)+(y2_1)*(y2_1))
    307     except ZeroDivisionError:
    308         if sqrt((x2_1)*(x2_1)+(y2_1)*(y2_1)) == 0 \
    309            and abs((x2_1)*(y1-y0)-(x1-x0)*(y2_1)) == 0:
    310             return True
    311         else:
    312             return False
    313 
    314     return d <= max_distance
    315 
    316 
    317 
     312
     313
     314    num = (x2_1)*(x2_1)+(y2_1)*(y2_1)
     315    if sqrt(num) == 0 and abs(num) == 0:
     316        return True
     317    else:
     318        d = abs((x2_1)*(y1-y0)-(x1-x0)*(y2_1))/num
     319        return d <= max_distance
     320
     321
     322
     323
Note: See TracChangeset for help on using the changeset viewer.