urbansim / urbansim_parcels

New version of urbansim_defaults for compatibility with new developer model
0 stars 1 forks source link

Add SF parcel model, make compatible with new pro forma model #1

Closed pksohn closed 7 years ago

pksohn commented 7 years ago

This is a large PR with two main pieces: 1) Adding the SF example parcel model, which is a mashup of urbansim_parcels and sanfran_urbansim, and 2) Making the parcel model compatible with the new pro forma model in the developer repo.

Adding the SF parcel model

I've added several new files that are directly copied from sanfran_urbansim:

These two were modified from jupyter notebooks in sanfran_urbansim but are more or less the same:

This was brought over from urbansim_parcels and made compatible with the sanfran_urbansim data and specifications. It contains most of the same things as assumptions.py from sanfran_urbansim but changed to YAML format.

The major changes are in these files. You'll see a variety of modified or added model steps, variable definitions, etc. If I haven't talked specifically about the change in the next section, it's probably just me cobbling things together between urbansim_defaults and sanfran_urbansim to work with the SF data:

Compatibility with the new developer model

There are some key changes I've made in the pro forma model to work with the new format:

utils.py

The bulk of the changes are here.

models.py

In feasibility step, now loading pro forma configs directly from an injectable called proforma, which is registered from proforma.yaml (see settings.yaml section below).

settings.yaml

You don't actually have to refer to the code here. Just note that urbansim_defaults assumed there were some pro forma related configs in this file. In the new version, I want all pro forma related configs to live in proforma.yaml.

datasources.py

New injectable to load proforma.yaml. Note that if there is no file there, it registers None which will later instantiate the SqftProForma object from defaults.

variables.py

See the callback functions. These are called in the new prepare_parcels_for_feasibility and lookup_by_form functions in utils.py.