Esempio n. 1
0
def test_pair_arrays():
    a1, a2, a3 = (1, 2), (3, 4), (5, 6)
    b1, b2, b3 = (10, 20), (30, 40), (50, 60)
    a = np.array([a1, a2, a3])
    b = np.array([b1, b2, b3])
    result = pair_arrays(a, b)
    expected = np.array([[(1, 10), (2, 20)], [(3, 30), (4, 40)],
                         [(5, 50), (6, 60)]])
    np.testing.assert_almost_equal(result, expected, decimal=3)
Esempio n. 2
0
 def get_angles(self):
     angles = self.nc.variables.get('angle')
     if not angles:
         # FIXME: Get rid of pair_arrays.
         center_lon, center_lat = self.get_cell_center_lat_lon()
         cell_centers = pair_arrays(center_lon, center_lat)
         centers_start = cell_centers[..., :-1, :]
         centers_end = cell_centers[..., 1:, :]
         angles = calculate_angle_from_true_east(centers_start, centers_end)
     return angles