UDST / developer

Redesigned UrbanSim developer/pro forma models
https://udst.github.io/developer/
BSD 3-Clause "New" or "Revised" License
3 stars 5 forks source link

Make developer workflow consistent with other Urbansim models #11

Closed pksohn closed 7 years ago

pksohn commented 7 years ago

As a modeler, I should be able to use the developer model in a consistent manner with other urbansim models. Consistent with #10.

Overview

Current workflow is as follows:

dev = developer.Developer(feasibility.to_frame())

target_units = dev.\
    compute_units_to_build(len(agents),
                           buildings[supply_fname].sum(),
                           target_vacancy)

new_buildings = dev.pick(forms,
                         target_units,
                         parcel_size,
                         ave_unit_size,
                         total_units,
                         max_parcel_size=max_parcel_size,
                         drop_after_build=True,
                         residential=residential,
                         bldg_sqft_per_job=bldg_sqft_per_job)

if year is not None:
    new_buildings["year_built"] = year

if form_to_btype_callback is not None:
    new_buildings["building_type_id"] = new_buildings["form"].\
        apply(form_to_btype_callback)

all_buildings = dev.merge(buildings.to_frame(buildings.local_columns),
                          new_buildings[buildings.local_columns])

sim.add_table("buildings", all_buildings)

I would like to make this consistent with calls to other urbansim models in utils.py, such as hedonic_simulate. The function could look something like this:

cfg = misc.config(cfg)
feasibility = orca.get_table('feasibility').to_frame()
buildings = orca.get_table('buildings').to_frame()
new_buildings, all_buildings = developer.pick(feasibility, buildings, cfg)
orca.add_table('buildings', all_buildings)

Details

Very similar to #10. Essentially moving all these steps into the Developer class. A couple of specifics:

pksohn commented 7 years ago

Calling this pretty good for now. We'll continue to iterate on this.