예제 #1
0
 def test_rebin_data_2d(self):
     test_var = self.nc.variables["2d_array"]
     obj = CloudnetArray(test_var, "test_name")
     time = np.array([1, 2, 3, 4, 5])
     time_new = np.array([2.1, 4.1])
     obj.rebin_data(time, time_new)
     result = np.array([[2.5, 2.5, 2.5, 1], [4.5, 4.5, 4.5, 1]])
     assert_array_equal(obj.data, result)
def test_rebin_data(fake_nc_file):
    nc = netCDF4.Dataset(fake_nc_file)
    test_var = nc.variables['2d_array']
    obj = CloudnetArray(test_var, 'test_name')
    time = np.array([1, 2, 3, 4, 5])
    time_new = np.array([2.1, 4.1])
    obj.rebin_data(time, time_new)
    result = np.array([[2.5, 2.5, 2.5, 1], [4.5, 4.5, 4.5, 1]])
    assert_array_equal(obj.data, result)