pywr.recorders.TablesRecorder

class pywr.recorders.TablesRecorder(model, h5file, nodes=None, parameters=None, where='/', time='/time', routes_flows=None, routes='/routes', scenarios='/scenarios', **kwargs)

A recorder that saves to PyTables CArray

This Recorder creates a CArray for every node passed to the constructor. Each CArray stores the data for all scenarios on the specific node. This is useful for analysis of Node statistics across multiple scenarios.

__init__(model, h5file, nodes=None, parameters=None, where='/', time='/time', routes_flows=None, routes='/routes', scenarios='/scenarios', **kwargs)
Parameters:
model : pywr.model.Model

The model to record nodes from.

h5file : tables.File or filename

The tables file handle or filename to attach the CArray objects to. If a filename is given the object will open and close the file handles.

nodes : iterable or None

Nodes to save in the tables database. Can be an iterable of Node objects or node names. It can also be a iterable of tuples with a node specific where keyword as the first item and a Node object or name as the second item. If an iterable of tuples is provided then the node specific where keyword is used in preference to the where keyword (see below).

parameters : iterable or None

Parameters to save. Similar to the nodes keyword, except refers to Parameter objects or names thereof.

where : string

Default path to create the CArrays inside the database.

time : string

Default full node path to save a time tables.Table. If None no table is created.

scenarios : string

Default full node path to save a scenarios tables.Table. If None no table is created.

routes_flows : string

Relative (to where) node path to save the routes flow CArray. If None (default) no array is created.

routes : string

Full node path to save the routes tables.Table. If None not table is created.

filter_kwds : dict

Filter keywords to pass to tables.open_file when opening a file.

mode : string

Model argument to pass to tables.open_file. Defaults to ‘w’

metadata : dict

Dict of user defined attributes to save on the root node (root._v_attrs)

create_directories : bool

If a file path is given and create_directories is True then attempt to make the intermediate directories. This uses os.makedirs() underneath.

Methods

__init__(model, h5file[, nodes, parameters, …])
Parameters:
after() Save data to the tables
aggregated_value
before
finish()
load(model, data)
register
reset()
setup() Setup the tables
unregister
values

Attributes

agg_func
children
comment
epsilon
ignore_nan
is_constraint
is_objective
model
name
parents