Esempio n. 1
0
    def in_development_URS_points_needed(self):
        ll_lat = -21.51667
        ll_long = 114.51667
        grid_spacing = 2./60.
        lat_amount = 15
        long_amount = 15

       
        boundary_polygon = [[250000,7660000],[280000,7660000],
                             [280000,7630000],[250000,7630000]]
        calculate_boundary_points('a_test_example',boundary_polygon,
                                  ll_lat, ll_long, grid_spacing, 
                                  lat_amount, long_amount,
                                  verbose=self.verbose)
Esempio n. 2
0
    def in_development_URS_points_needed(self):
        ll_lat = -21.51667
        ll_long = 114.51667
        grid_spacing = 2./60.
        lat_amount = 15
        long_amount = 15

       
        boundary_polygon = [[250000,7660000],[280000,7660000],
                             [280000,7630000],[250000,7630000]]
        calculate_boundary_points('a_test_example',boundary_polygon,
                                  ll_lat, ll_long, grid_spacing, 
                                  lat_amount, long_amount,
                                  verbose=self.verbose)
Esempio n. 3
0
    def test_URS_points_needed_and_urs_ungridded2sww(self):
        # This doesn't actually check anything
        #  
        ll_lat = -21.5
        ll_long = 114.5
        grid_spacing = 1./60.
        lat_amount = 30
        long_amount = 30
        time_step_count = 2
        time_step = 400
        tide = -200000
        zone = 50

        boundary_polygon = [[250000,7660000],[280000,7660000],
                             [280000,7630000],[250000,7630000]]
        geo=urs.calculate_boundary_points(boundary_polygon, zone,
                              ll_lat, ll_long, grid_spacing, 
                              lat_amount, long_amount,
                              verbose=self.verbose)
        lat_long = geo.get_data_points(as_lat_long=True)
        base_name, files = self.write_mux(lat_long,
                                          time_step_count, time_step)
        urs_ungridded2sww(base_name, mean_stage=tide,
                          verbose=self.verbose)
        self.delete_mux(files)
        os.remove( base_name + '.sww')
Esempio n. 4
0
    def test_URS_points_needed(self):

        ll_lat = -21.5
        ll_long = 114.5
        grid_spacing = 1. / 60.
        lat_amount = 30
        long_amount = 30
        zone = 50

        boundary_polygon = [[250000, 7660000], [280000, 7660000],
                            [280000, 7630000], [250000, 7630000]]
        geo = calculate_boundary_points(boundary_polygon,
                                        zone,
                                        ll_lat,
                                        ll_long,
                                        grid_spacing,
                                        lat_amount,
                                        long_amount,
                                        verbose=self.verbose)
        # to test this geo, can info from it be transfered onto the boundary
        # poly?
        #Maybe see if I can fit the data to the polygon - have to represent
        # the poly as points though.
        #geo.export_points_file("results.txt", as_lat_long=True)
        results = frozenset(geo.get_data_points(as_lat_long=True))
        #print 'results',results

        # These are a set of points that have to be in results
        points = []
        for i in range(18):
            lat = -21.0 - 8. / 60 - grid_spacing * i
            points.append((lat, degminsec2decimal_degrees(114, 35, 0)))
            points.append((lat, degminsec2decimal_degrees(114, 36, 0)))
            points.append((lat, degminsec2decimal_degrees(114, 52, 0)))
            points.append((lat, degminsec2decimal_degrees(114, 53, 0)))
        geo_answer = Geospatial_data(data_points=points,
                                     points_are_lats_longs=True)
        #geo_answer.export_points_file("answer.txt", as_lat_long=True)
        answer = frozenset(points)

        outs = answer.difference(results)
        #print "outs", outs
        # This doesn't work.  Though visualising the results shows that
        # it is correct.
        #assert answer.issubset(results)
        # this is why;
        #point (-21.133333333333333, 114.58333333333333)
        #result (-21.133333332232368, 114.58333333300342)

        for point in points:
            found = False
            for result in results:
                if num.allclose(point, result):
                    found = True
                    break
            if not found:
                assert False
Esempio n. 5
0
    def test_URS_points_needed(self):
        
        ll_lat = -21.5
        ll_long = 114.5
        grid_spacing = 1./60.
        lat_amount = 30
        long_amount = 30
        zone = 50

        boundary_polygon = [[250000,7660000],[280000,7660000],
                             [280000,7630000],[250000,7630000]]
        geo=calculate_boundary_points(boundary_polygon, zone, 
                              ll_lat, ll_long, grid_spacing, 
                              lat_amount, long_amount,
                              verbose=self.verbose)
        # to test this geo, can info from it be transfered onto the boundary
        # poly?
        #Maybe see if I can fit the data to the polygon - have to represent
        # the poly as points though.
        #geo.export_points_file("results.txt", as_lat_long=True)
        results = frozenset(geo.get_data_points(as_lat_long=True))
        #print 'results',results

        # These are a set of points that have to be in results
        points = []
        for i in range(18):
            lat = -21.0 - 8./60 - grid_spacing * i
            points.append((lat,degminsec2decimal_degrees(114,35,0))) 
            points.append((lat,degminsec2decimal_degrees(114,36,0))) 
            points.append((lat,degminsec2decimal_degrees(114,52,0))) 
            points.append((lat,degminsec2decimal_degrees(114,53,0)))
        geo_answer = Geospatial_data(data_points=points,
                                     points_are_lats_longs=True) 
        #geo_answer.export_points_file("answer.txt", as_lat_long=True)  
        answer = frozenset(points)
        
        outs = answer.difference(results)
        #print "outs", outs
        # This doesn't work.  Though visualising the results shows that
        # it is correct.
        #assert answer.issubset(results)
        # this is why;
        #point (-21.133333333333333, 114.58333333333333)
        #result (-21.133333332232368, 114.58333333300342)
        
        for point in points:
            found = False
            for result in results:
                if num.allclose(point, result):
                    found = True
                    break
            if not found:
                assert False
Esempio n. 6
0
    def test_URS_points_northern_hemisphere(self):

        LL_LAT = 8.0
        LL_LONG = 97.0
        GRID_SPACING = 2.0/60.0
        LAT_AMOUNT = 2
        LONG_AMOUNT = 2
        ZONE = 47

        # 
        points = []
        for i in range(2):
            for j in range(2):
                points.append((degminsec2decimal_degrees(8,1+i*2,0),
                               degminsec2decimal_degrees(97,1+i*2,0)))
        #print "points", points
        geo_poly = Geospatial_data(data_points=points,
                                     points_are_lats_longs=True)
        poly_lat_long = geo_poly.get_data_points(as_lat_long=False,
                                       isSouthHemisphere=False)
        #print "seg_lat_long",  poly_lat_long
        
      #   geo=URS_points_needed_to_file('test_example_poly3', poly_lat_long,
#                                   ZONE,
#                                   LL_LAT, LL_LONG,
#                                   GRID_SPACING,
#                                   LAT_AMOUNT, LONG_AMOUNT,
#                                   isSouthernHemisphere=False,
#                                   export_csv=True,
#                                   verbose=self.verbose)

        geo=calculate_boundary_points(poly_lat_long,
                                  ZONE,
                                  LL_LAT, LL_LONG,
                                  GRID_SPACING,
                                  LAT_AMOUNT, LONG_AMOUNT,
                                  isSouthHemisphere=False,
                                  verbose=self.verbose)

        results = frozenset(geo.get_data_points(as_lat_long=True,
                                                isSouthHemisphere=False))

        #print 'results',results

        # These are a set of points that have to be in results
        points = [] 
        for i in range(2):
            for j in range(2):
                points.append((degminsec2decimal_degrees(8,i*2,0),
                               degminsec2decimal_degrees(97,i*2,0)))
        #print "answer points", points
        answer = frozenset(points)
        
        for point in points:
            found = False
            for result in results:
                if num.allclose(point, result):
                    found = True
                    break
            if not found:
                assert False
Esempio n. 7
0
    def test_URS_points_northern_hemisphere(self):

        LL_LAT = 8.0
        LL_LONG = 97.0
        GRID_SPACING = 2.0 / 60.0
        LAT_AMOUNT = 2
        LONG_AMOUNT = 2
        ZONE = 47

        #
        points = []
        for i in range(2):
            for j in range(2):
                points.append((degminsec2decimal_degrees(8, 1 + i * 2, 0),
                               degminsec2decimal_degrees(97, 1 + i * 2, 0)))
        #print "points", points
        geo_poly = Geospatial_data(data_points=points,
                                   points_are_lats_longs=True)
        poly_lat_long = geo_poly.get_data_points(as_lat_long=False,
                                                 isSouthHemisphere=False)
        #print "seg_lat_long",  poly_lat_long

        #   geo=URS_points_needed_to_file('test_example_poly3', poly_lat_long,
        #                                   ZONE,
        #                                   LL_LAT, LL_LONG,
        #                                   GRID_SPACING,
        #                                   LAT_AMOUNT, LONG_AMOUNT,
        #                                   isSouthernHemisphere=False,
        #                                   export_csv=True,
        #                                   verbose=self.verbose)

        geo = calculate_boundary_points(poly_lat_long,
                                        ZONE,
                                        LL_LAT,
                                        LL_LONG,
                                        GRID_SPACING,
                                        LAT_AMOUNT,
                                        LONG_AMOUNT,
                                        isSouthHemisphere=False,
                                        verbose=self.verbose)

        results = frozenset(
            geo.get_data_points(as_lat_long=True, isSouthHemisphere=False))

        #print 'results',results

        # These are a set of points that have to be in results
        points = []
        for i in range(2):
            for j in range(2):
                points.append((degminsec2decimal_degrees(8, i * 2, 0),
                               degminsec2decimal_degrees(97, i * 2, 0)))
        #print "answer points", points
        answer = frozenset(points)

        for point in points:
            found = False
            for result in results:
                if num.allclose(point, result):
                    found = True
                    break
            if not found:
                assert False