next up previous index
Next: Interaction Variables Up: Variable Concept Previous: Dataset Pool   Index


Invoking Computation

Computation of a variable is invoked using the Dataset method compute_variables() passing the variable name in its fully-qualified form and a dataset pool if other datasets are required for this variable:
>>> locations.compute_variables("urbansim.gridcell.is_in_wetland",
                                  dataset_pool=dataset_pool)
urbansim.gridcell.is_in_wetland..........................................0.0 sec
array([1, 0, 0, 1, 0, 1, 0, 0, 0], type=bool8)

The method returns the resulting values of the variable. The compute_variables method also accepts a list of variables to be computed. In this case it returns values of the last variable in the list.

In addition, within the dataset, the variable can be accessed using its un-qualified name. Thus, the un-qualified names of variables including the primary attributes must be unique.

>>> locations.get_attribute("is_in_wetland")
array([1, 0, 0, 1, 0, 1, 0, 0, 0], type=bool8)


next up previous index
Next: Interaction Variables Up: Variable Concept Previous: Dataset Pool   Index
info (at) urbansim.org