Re: [UrbanSim-Users] invoking computation on a new variable

From: Travis Kriplean <travis_at_cs.washington.edu>
Date: Thu, 20 Dec 2007 11:53:09 -0800

Galen,

If you've created the variable in the same way as, say,
urbansim.gridcell.population, you can just define an indicator such as:

from opus_core.configurations.dataset_pool_configuration import
DatasetPoolConfiguration
from opus_core.indicator_framework.core.source_data import SourceData
from opus_core.indicator_framework.image_types.table import Table

source_data = SourceData(
    cache_directory = [your cache directory],
    years = [2000, 2010],
    dataset_pool_configuration = DatasetPoolConfiguration(
          package_order=['chittenden','urbansim','opus_core'],
          package_order_exceptions={},
          ),
)

table = Table(
        source_data = source_data,
        dataset_name = 'gridcell',
        attribute = 'chittenden.gridcell.roads_sqft',
        output_type = 'csv'
        ),

table.create()

The resulting indicator should then be available in the indicators
directory in your cache directory.

The indicator framework takes care of all the dataset loading and
compute_variable stuff for you. If you DO want to learn how to do that,
though, you are on the right track. You'll basically have to set the
simulation cache directory and the simulation run year in order to
obtain the proper dataset. Then you can call compute_variable over that.

Travis

Galen Justus Wilkerson wrote:
> The following page describes how to compute a variable:
>
> http://www.urbansim.org/docs/opus-userguide/node75.html
>
> I'm just trying to understand when I would call this, and what
> packages I need to load beforehand.
>
> So, I have created a variable "roads_sqft", which is dependent on our
> chittenden.gridcell variable "percent_roads" that is stored in the
> cache.
>
> Just gradually understanding all of this-
>
> At the moment, I'm trying to invoke this within an indicator script,
> then make a map of roads_sqft, similar to the examples in
> "make_indicators_example.py".
>
>
> Looks like I just need to load the appropriate dataset and set
> dataset_pool, then call something like:
>
> gridcell.compute_variables("chittenden.gridcell.roads_sqft",
> dataset_pool=dataset_pool)
>
>
> thanks for any help,
> Galen
>
>
>
> _______________________________________________
> Users mailing list
> Users_at_urbansim.org
> http://www.urbansim.org/mailman/listinfo/users
Received on Thu Dec 20 2007 - 11:53:12 PST

This archive was generated by hypermail 2.2.0 : Thu Dec 20 2007 - 11:53:13 PST