Example #1
0
 def test_get_coastlines_all_pass(self):
     '''Check get_coastlines function over whole earth'''
     coast = get_coastlines(resolution=110)
     tot_bounds = coast.total_bounds
     self.assertEqual((134, 1), coast.shape)
     self.assertAlmostEqual(tot_bounds[0], -180)
     self.assertAlmostEqual(tot_bounds[1], -85.60903777)
     self.assertAlmostEqual(tot_bounds[2], 180.00000044)
     self.assertAlmostEqual(tot_bounds[3], 83.64513)
Example #2
0
 def test_get_coastlines_pass(self):
     '''Check get_coastlines function in defined extent'''
     bounds = (-100, -55, -20, 35)
     coast = get_coastlines(bounds, resolution=110)
     ex_box = box(bounds[0], bounds[1], bounds[2], bounds[3])
     self.assertEqual(coast.shape[0], 14)
     self.assertTrue(coast.total_bounds[2] < 0)
     for row, line in coast.iterrows():
         if not ex_box.intersects(line.geometry):
             self.assertEqual(1, 0)
Example #3
0
    def test_get_coastlines_all_pass(self):
        '''Check get_coastlines function over whole earth'''
        coast = get_coastlines(resolution=110)
        self.assertEqual((5128, 2), coast.shape)

        self.assertEqual(-78.59566741324154, coast[0][0])
        self.assertEqual(73.60000000000001, coast[-1][0])

        self.assertEqual(-163.7128956777287, coast[0][1])
        self.assertEqual(-106.6, coast[-1][1])
Example #4
0
    def test_get_coastlines_pass(self):
        '''Check get_coastlines function in defined extent'''
        extent = (-100, 95, -55, 35)
        coast = get_coastlines(extent, resolution=110)

        for lat_val, lon_val in coast:
            if lon_val < extent[0] or lon_val > extent[1]:
                self.assertTrue(False)
            if lat_val < extent[2] or lat_val > extent[3]:
                self.assertTrue(False)

        self.assertEqual((1234, 2), coast.shape)