# Path: rvic/core/convolution_wrapper.py
# SHAREDOBJECT = 'rvic_convolution' + sysconfig.get_config_var('SO')
# LIBPATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../'))


import pytest
import numpy as np
from rvic.core.convolution_wrapper import rvic_convolve
                  time_length,
                  xsize,
                  source2outlet_ind,
                  source_y_ind,
                  source_x_ind,
                  source_time_offset,
                  unit_hydrograph,
                  aggrunin,
                  ring)
    assert ring.sum() == 4
    np.testing.assert_almost_equal(ring.sum(axis=1),
                                   unit_hydrograph.sum(axis=1))
    np.testing.assert_almost_equal(ring.sum(axis=0),
                                   [4])


def test_convolution_wraper_1_source_1_outlet():
    n_sources = 1
    n_outlets = 1
    time_length = 6
    ysize = 10
    xsize = 10
    source2outlet_ind = np.array([0, 0, 1, 1], dtype=np.int32)
    source_y_ind = np.array([2], dtype=np.int32)
    source_x_ind = np.array([5], dtype=np.int32)
    source_time_offset = np.zeros(n_sources, dtype=np.int32)
    unit_hydrograph = np.array([[0., 0.25, 0.5, 0.25, 0., 0.]]).T
    aggrunin = np.ones((ysize, xsize), dtype=np.float64)
    ring = np.zeros((time_length, n_outlets))


# Path: rvic/core/convolution_wrapper.py
# SHAREDOBJECT = 'rvic_convolution' + sysconfig.get_config_var('SO')
# LIBPATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../'))


# Path: tests/unit/test_convolution_wrapper.py
import pytest
import numpy as np
from rvic.core.convolution_wrapper import rvic_convolve

                  time_length,
                  xsize,
                  source2outlet_ind,
                  source_y_ind,
                  source_x_ind,
                  source_time_offset,
                  unit_hydrograph,
                  aggrunin,
                  ring)
    assert ring.sum() == 4
    np.testing.assert_almost_equal(ring.sum(axis=1),
                                   unit_hydrograph.sum(axis=1))
    np.testing.assert_almost_equal(ring.sum(axis=0),
                                   [4])


def test_convolution_wraper_1_source_1_outlet():
    n_sources = 1
    n_outlets = 1
    time_length = 6
    ysize = 10
    xsize = 10
    source2outlet_ind = np.array([0, 0, 1, 1], dtype=np.int32)
    source_y_ind = np.array([2], dtype=np.int32)
    source_x_ind = np.array([5], dtype=np.int32)
    source_time_offset = np.zeros(n_sources, dtype=np.int32)
    unit_hydrograph = np.array([[0., 0.25, 0.5, 0.25, 0., 0.]]).T
    aggrunin = np.ones((ysize, xsize), dtype=np.float64)
    ring = np.zeros((time_length, n_outlets))


    rvic_convolve(n_sources,