next up previous index
Next: Optional Method dependencies() Up: Implementation Previous: Creating a Variable Object   Index


Required Method compute()

Each variable class has a required method compute() which defines how to compute this variable.

It takes as an argument an object of class DatasetPool which maintains a 'pool' of additional datasets that this variable needs for its computation (see Section 24.7.1). Note that this method is called from the dataset method compute_variables() (see Section 24.1.4), and its dataset_pool argument is passed from there.

The implementation of the compute() method can assume that all variables that are listed in the dependencies() method (see below) are already computed and accessible by the dataset method get_attribute().

The compute() method should return a numpy array of the size of number of elements in the ``owner'' dataset.


next up previous index
Next: Optional Method dependencies() Up: Implementation Previous: Creating a Variable Object   Index
info (at) urbansim.org