Skip to content

Guide to existing models

sablanchard edited this page Jun 15, 2018 · 10 revisions

Background Reading

  • Official Documentation: definitely read through this in detail. It'll tell you exactly what the models do.
  • Adventures in CRE: skim some of the materials here. Helpful to check out some of the spreadsheets to see how pro forma analysis is typically done.

Code exploration

The easiest way to run a full parcel urbansim model is to clone the sanfran_urbansim repository, since it includes all of the data in the repo. This is a simplified, working-out-of-the-box implementation of an Urbansim parcel model. It may be a little outdated at this point, but is an easy way to get up and running.

To avoid some annoying errors, make sure you pip install orca and make sure you're on numpy >1.8 and <1.12

Workflow

  • To get use out of an urbansim model, you would typically want to estimate coefficients using the steps in Estimation.ipynb, then run a simulation using those settings, using steps in Simulation.ipynb.
  • The Orca steps in the simulation notebook that you want to pay attention to are "feasibility", "residential_developer", and "nonresidential_developer".
  • These steps are defined in models.py, which calls functions in utils.py.
  • The run_feasibility function is the interface to the core SqftProForma code, and returns a dataframe that is fed into run_developer, which is similarly the interface to the Developer model.

Exploring the code

I recommend following the full workflow above step-by-step in one of two ways:

  • Create a new jupyter notebook, run all of the steps from Simulation.ipynb until feasibility, then copy code from the core SqftProForma and Developer models. I can send my notebooks for this.
  • Copy the code from the simulation notebook into a Python script, then set a breakpoint on the feasibility step and step through using the PyCharm debugger (which allows you to view DataFrames).

Latest changes

Now check out recent changes:

  • Major updates to how configurations are handled in the Pro Forma module (PR here).
  • Changes to the urbansim_parcel model (PR here, pay more attention to the second part that has to do with pro forma)
  • More updates to the pro forma model, based on the above bullet (PR)