pywr.parameters.AbstractThresholdParameter

class pywr.parameters.AbstractThresholdParameter(model, threshold, values=None, *args, predicate=None, ratchet=False, **kwargs)

Base class for parameters returning one of two values depending on other state.

Parameters:
thresholddouble or Parameter

Threshold to compare the value of the recorder to

valuesiterable of doubles

If the predicate evaluates False the zeroth value is returned, otherwise the first value is returned.

predicatestring

One of {“LT”, “GT”, “EQ”, “LE”, “GE”}.

ratchetbool

If true the parameter behaves like a ratchet. Once it is triggered first it stays in the triggered position (default=False).

Methods

value(timestep, scenario_index)

Returns a value from the values attribute, using the index.

index(timestep, scenario_index)

Returns 1 if the predicate evaluates True, else 0.

Notes

On the first day of the model run the recorder will not have a value for the previous day. In this case the predicate evaluates to True.

__init__(*args, **kwargs)

Methods

__init__(*args, **kwargs)

after(self)

before(self)

finish(self)

get_all_indices(self)

get_all_values(self)

get_constant_value(self)

Return a constant value.

get_double_lower_bounds(self)

get_double_upper_bounds(self)

get_double_variables(self)

get_index(self, ScenarioIndex scenario_index)

get_integer_lower_bounds(self)

get_integer_upper_bounds(self)

get_integer_variables(self)

get_value(self, ScenarioIndex scenario_index)

index(self, Timestep timestep, ...)

Returns 1 if the predicate evalutes True, else 0

load(cls, model, data)

register(cls)

reset(self)

set_double_variables(self, double[)

set_integer_variables(self, int[)

setup(self)

unregister(cls)

value(self, Timestep timestep, ...)

Returns a value from the values attribute, using the index

Attributes

children

comment

comment: unicode

double_size

double_size: 'int'

integer_size

integer_size: 'int'

is_constant

is_variable

is_variable: 'bool'

model

name

parents

ratchet

ratchet: 'bool'

size

tags

tags: dict

threshold