How to use the pywr.recorders.assert_rec function in pywr

To help you get started, we’ve selected a few pywr examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pywr / pywr / tests / test_parameters_transient.py View on Github external
        @assert_rec(model, parameter_stage1_on, name='stage1_on_rec')
        def expected_func(timestep, scenario_index):
            if timestep.year < 2027:
                return 0
            else:
                return 1
github pywr / pywr / tests / test_control_curves.py View on Github external
        @assert_rec(m, p)
        def expected_func(timestep, scenario_index):
            v = s.initial_volume
            if v >= 80.0:
                expected = 0
            else:
                expected = 1
            return expected
github pywr / pywr / tests / test_parameters.py View on Github external
        @assert_rec(model, p)
        def expected_func(timestep, scenario_index):
            x = p1.get_value(scenario_index)
            y = p2.get_value(scenario_index)
            return func(np.array([x,y]))
github pywr / pywr / tests / test_control_curves.py View on Github external
        @assert_rec(m, s.cost)
        def expected_func(timestep, scenario_index):
            v = s.initial_volume
            if v >= 80.0:
                expected = 1.0
            elif v >= 60:
                expected = 0.7
            else:
                expected = 0.4
            return expected
github pywr / pywr / tests / test_parameters_transient.py View on Github external
        @assert_rec(model, p)
        def expected_func(timestep, scenario_index):
            if model.timestepper.current.datetime < pandas.to_datetime(date):
                return before.get_value(scenario_index)
            else:
                return after.get_value(scenario_index)
github pywr / pywr / tests / test_core.py View on Github external
    @assert_rec(model, ts)
    def expected(timestep, scenario_index):
        return ts.dataframe.loc[timestep.datetime]
github pywr / pywr / tests / test_parameters_transient.py View on Github external
        @assert_rec(model, parameter)
        def expected_func(timestep, scenario_index):
            if timestep.year < 2030:
                return 1
            else:
                if scenario_index.global_id < 5:
                    return 2
                else:
                    return 3
github pywr / pywr / tests / test_parameters.py View on Github external
        @assert_rec(model, p1)
        def expected_func(timestep, scenario_index):
            return 0.5 + np.pi*x + 2.5*y+ 0.3*x*y
        model.setup()
github pywr / pywr / tests / test_parameters.py View on Github external
        @assert_rec(model, p)
        def expected(timestep, scenario_index):
            return (timestep.month - 1) * 0.8
github pywr / pywr / tests / test_parameters.py View on Github external
        @assert_rec(m, p)
        def expected_func(timestep, scenario_index):
            return expected_values[timestep.index]