pywr.recorders.AnnualCountIndexThresholdRecorder

class pywr.recorders.AnnualCountIndexThresholdRecorder(model, list parameters, unicode name, int threshold, *args, **kwargs)

For each scenario, count the number of times a list of parameters exceeds a threshold in each year.

If multiple parameters exceed in one timestep then it is only counted once. The recorder also allows for exclusion of months and for the inclusion of a range of dates within a calendar year to which the parameter exceedence is counted. Both the exclusion of months and the inclusion of dates can simultaneously be provided, where the intersection of excluded months with a range of dates will result in the day not counting any exceedences.

Output from data property has shape: (years, scenario combinations)

Parameters:
modelpywr.core.Model
parameterslist

List of pywr.core.IndexParameter to record against

namestr

The name of the recorder

thresholdint

Threshold to compare parameters against

exclude_monthslist or None

Optional list of month numbers to exclude from the count.

include_from_month, include_from_dayint or None

Optional start date to specify a range of dates to include in the count. If intended to be used, both arguments must be supplied, otherwise the recorder will assume that this is not used and default to the 1st Jan. Period to count is inclusive of the start date.

include_to_month, include_to_dayint or None

Optional end date to specify a range of dates to include in the count. If intended to be used, both arguments must be supplied, otherwise the recorder will assume that this is not used and default to the 31st Dec. Period to count is inclusive of the end date.

__init__(*args, **kwargs)

Methods

__init__(*args, **kwargs)

after(self)

aggregated_value(self)

before(self)

finish(self)

is_constraint_violated(self)

Returns true if the value from this Recorder violates its constraint bounds.

load(cls, model, data)

register(cls)

reset(self)

setup(self)

to_dataframe(self)

Return a pandas.DataFrame of the recorder data

unregister(cls)

values(self)

Compute a value for each scenario using temporal_agg_func.

Attributes

agg_func

children

comment

comment: unicode

constraint_lower_bounds

constraint_upper_bounds

data

epsilon

epsilon: 'double'

exclude_months

exclude_months: list

ignore_nan

ignore_nan: 'bool'

include_from_day

include_from_day: object

include_from_month

include_from_month: object

include_to_day

include_to_day: object

include_to_month

include_to_month: object

is_constraint

Returns true if either upper or lower constraint bounds is defined.

is_double_bounded_constraint

Returns true if upper and lower constraint bounds are both defined and not-equal to one another.

is_equality_constraint

Returns true if upper and lower constraint bounds are both defined and equal to one another.

is_lower_bounded_constraint

Returns true if lower constraint bounds is defined and upper constraint bounds is not.

is_objective

is_upper_bounded_constraint

Returns true if upper constraint bounds is defined and lower constraint bounds is not.

model

name

parameters

parameters: list

parents

tags

tags: dict

temporal_agg_func

threshold

threshold: 'int'