Exemplo n.º 1
0
def scheduled_development_events(buildings, development_projects,
                                 demolish_events, summary, year, parcels,
                                 mapping, years_per_iter, parcels_geography,
                                 building_sqft_per_job, vmt_fee_categories,
                                 static_parcels):
    # first demolish
    demolish = demolish_events.to_frame().\
        query("%d <= year_built < %d" % (year, year + years_per_iter))
    print("Demolishing/building %d buildings" % len(demolish))
    l1 = len(buildings)
    buildings = utils._remove_developed_buildings(
        buildings.to_frame(buildings.local_columns),
        demolish,
        unplace_agents=["households", "jobs"])
    orca.add_injectable(
        'static_parcels',
        np.append(static_parcels, demolish.loc[demolish.action == 'build',
                                               'parcel_id']))
    orca.add_table("buildings", buildings)
    buildings = orca.get_table("buildings")
    print("Demolished %d buildings" % (l1 - len(buildings)))
    print("    (this number is smaller when parcel has no existing buildings)")

    # then build
    dps = development_projects.to_frame().\
        query("%d <= year_built < %d" % (year, year + years_per_iter))

    if len(dps) == 0:
        return

    new_buildings = utils.scheduled_development_events(
        buildings,
        dps,
        remove_developed_buildings=False,
        unplace_agents=['households', 'jobs'])
    new_buildings["form"] = new_buildings.building_type.map(
        mapping['building_type_map']).str.lower()
    new_buildings["job_spaces"] = new_buildings.non_residential_sqft / \
        new_buildings.building_type.fillna("OF").map(building_sqft_per_job)
    new_buildings["job_spaces"] = new_buildings.job_spaces.\
        fillna(0).astype('int')
    new_buildings["geom_id"] = parcel_id_to_geom_id(new_buildings.parcel_id)
    new_buildings["SDEM"] = True
    new_buildings["subsidized"] = False

    new_buildings["zone_id"] = misc.reindex(parcels.zone_id,
                                            new_buildings.parcel_id)
    new_buildings["vmt_res_cat"] = misc.reindex(vmt_fee_categories.res_cat,
                                                new_buildings.zone_id)
    del new_buildings["zone_id"]
    new_buildings["pda"] = parcels_geography.pda_id.loc[
        new_buildings.parcel_id].values
    new_buildings["juris_trich"] = parcels_geography.juris_trich.loc[
        new_buildings.parcel_id].values

    summary.add_parcel_output(new_buildings)
Exemplo n.º 2
0
def scheduled_development_events(buildings, development_projects, summary, year):
    dps = development_projects.to_frame().query("year_built == %d" % year)

    if len(dps) == 0:
        return

    new_buildings = utils.scheduled_development_events(buildings, dps,
                                       remove_developed_buildings=True,
                                       unplace_agents=['households', 'jobs'])

    summary.add_parcel_output(new_buildings)
Exemplo n.º 3
0
def scheduled_development_events(buildings, development_projects, summary,
                                 year):
    dps = development_projects.to_frame().query("year_built == %d" % year)

    if len(dps) == 0:
        return

    new_buildings = utils.scheduled_development_events(
        buildings,
        dps,
        remove_developed_buildings=True,
        unplace_agents=['households', 'jobs'])

    summary.add_parcel_output(new_buildings)
Exemplo n.º 4
0
def scheduled_development_events(buildings, development_projects,
                                 demolish_events, summary, year, parcels,
                                 settings, years_per_iter, parcels_geography,
                                 building_sqft_per_job, vmt_fee_categories):

    # first demolish
    demolish = demolish_events.to_frame().\
        query("%d <= year_built < %d" % (year, year + years_per_iter))
    print "Demolishing/building %d buildings" % len(demolish)
    l1 = len(buildings)
    buildings = utils._remove_developed_buildings(
        buildings.to_frame(buildings.local_columns),
        demolish,
        unplace_agents=["households", "jobs"])
    orca.add_table("buildings", buildings)
    buildings = orca.get_table("buildings")
    print "Demolished %d buildings" % (l1 - len(buildings))
    print "    (this number is smaller when parcel has no existing buildings)"

    # then build
    dps = development_projects.to_frame().\
        query("%d <= year_built < %d" % (year, year + years_per_iter))

    if len(dps) == 0:
        return

    new_buildings = utils.scheduled_development_events(
        buildings, dps,
        remove_developed_buildings=False,
        unplace_agents=['households', 'jobs'])
    new_buildings["form"] = new_buildings.building_type.map(
        settings['building_type_map']).str.lower()
    new_buildings["job_spaces"] = new_buildings.non_residential_sqft / \
        new_buildings.building_type.fillna("OF").map(building_sqft_per_job)
    new_buildings["job_spaces"] = new_buildings.job_spaces.\
        fillna(0).astype('int')
    new_buildings["geom_id"] = parcel_id_to_geom_id(new_buildings.parcel_id)
    new_buildings["SDEM"] = True
    new_buildings["subsidized"] = False

    new_buildings["zone_id"] = misc.reindex(
        parcels.zone_id, new_buildings.parcel_id)
    new_buildings["vmt_res_cat"] = misc.reindex(
        vmt_fee_categories.res_cat, new_buildings.zone_id)
    del new_buildings["zone_id"]
    new_buildings["pda"] = parcels_geography.pda_id.loc[
        new_buildings.parcel_id].values

    summary.add_parcel_output(new_buildings)
Exemplo n.º 5
0
def scheduled_development_events(buildings, development_projects,
                                 demolish_events, summary, year, parcels,
                                 mapping, years_per_iter, parcels_geography,
                                 building_sqft_per_job, vmt_fee_categories,
                                 static_parcels, base_year):
    # first demolish
    # 6/3/20: current approach is to grab projects from the simulation year
    # and previous four years, however the base year is treated differently,
    # eg 2015 pulls 2015-2010
    # this should be improved in the future so that the base year
    # also runs SDEM, eg 2015 pulls 2015-2014, while 2010 pulls 2010 projects
    if year == (base_year + years_per_iter):
        demolish = demolish_events.to_frame().\
            query("%d <= year_built <= %d" % (year - years_per_iter, year))
    else:
        demolish = demolish_events.to_frame().\
            query("%d < year_built <= %d" % (year - years_per_iter, year))
    print("Demolishing/building %d buildings" % len(demolish))
    l1 = len(buildings)
    buildings = utils._remove_developed_buildings(
        buildings.to_frame(buildings.local_columns),
        demolish,
        unplace_agents=["households", "jobs"])
    orca.add_injectable('static_parcels',
                        np.append(static_parcels,
                                  demolish.loc[demolish.action == 'build',
                                               'parcel_id']))
    orca.add_table("buildings", buildings)
    buildings = orca.get_table("buildings")
    print("Demolished %d buildings" % (l1 - len(buildings)))
    print("    (this number is smaller when parcel has no existing buildings)")

    # then build
    # 6/3/20: current approach is to grab projects from the simulation year
    # and previous four years, however the base year is treated differently,
    # eg 2015 pulls 2015-2010
    # this should be improved in the future so that the base year
    # also runs SDEM, eg 2015 pulls 2015-2014, while 2010 pulls 2010 projects
    if year == (base_year + years_per_iter):
        dps = development_projects.to_frame().\
            query("%d <= year_built <= %d" % (year - years_per_iter, year))
    else:
        dps = development_projects.to_frame().\
            query("%d < year_built <= %d" % (year - years_per_iter, year))

    if len(dps) == 0:
        return

    new_buildings = utils.scheduled_development_events(
        buildings, dps,
        remove_developed_buildings=False,
        unplace_agents=['households', 'jobs'])
    new_buildings["form"] = new_buildings.building_type.map(
        mapping['building_type_map']).str.lower()
    new_buildings["job_spaces"] = new_buildings.non_residential_sqft / \
        new_buildings.building_type.fillna("OF").map(building_sqft_per_job)
    new_buildings["job_spaces"] = new_buildings.job_spaces.\
        fillna(0).astype('int')
    new_buildings["geom_id"] = parcel_id_to_geom_id(new_buildings.parcel_id)
    new_buildings["SDEM"] = True
    new_buildings["subsidized"] = False

    new_buildings["zone_id"] = misc.reindex(
        parcels.zone_id, new_buildings.parcel_id)
    new_buildings["vmt_res_cat"] = misc.reindex(
        vmt_fee_categories.res_cat, new_buildings.zone_id)
    new_buildings["vmt_nonres_cat"] = misc.reindex(
        vmt_fee_categories.nonres_cat, new_buildings.zone_id)
    del new_buildings["zone_id"]

    # add PBA40 geographies
    new_buildings["pda_pba40"] = parcels_geography.pda_id_pba40.loc[
        new_buildings.parcel_id].values

    # add Horizon geographies
    new_buildings["juris_trich"] = parcels_geography.juris_trich.loc[
        new_buildings.parcel_id].values

    # add Draft Blueprint geographies
    new_buildings["pda_pba50"] = parcels_geography.pda_id_pba50.loc[
        new_buildings.parcel_id].values
    new_buildings["tra_id"] = parcels_geography.tra_id.loc[
        new_buildings.parcel_id].values
    new_buildings["ppa_id"] = parcels_geography.ppa_id.loc[
        new_buildings.parcel_id].values
    new_buildings["sesit_id"] = parcels_geography.sesit_id.loc[
        new_buildings.parcel_id].values
    new_buildings["coc_id"] = parcels_geography.coc_id.loc[
        new_buildings.parcel_id].values
    new_buildings["juris_tra"] = parcels_geography.juris_tra.loc[
        new_buildings.parcel_id].values
    new_buildings["juris_ppa"] = parcels_geography.juris_ppa.loc[
        new_buildings.parcel_id].values
    new_buildings["juris_sesit"] = parcels_geography.juris_sesit.loc[
        new_buildings.parcel_id].values
    new_buildings["juris_coc"] = parcels_geography.juris_coc.loc[
        new_buildings.parcel_id].values

    summary.add_parcel_output(new_buildings)
Exemplo n.º 6
0
def scheduled_development_events(buildings, development_projects,
                                 demolish_events, summary, year, parcels,
                                 settings, years_per_iter, parcels_geography,
                                 building_sqft_per_job, vmt_fee_categories):

    # first demolish
    demolish = demolish_events.to_frame().\
        query("%d <= year_built < %d" % (year, year + years_per_iter))
    print "Demolishing/building %d buildings" % len(demolish)
    l1 = len(buildings)
    buildings = utils._remove_developed_buildings(
        buildings.to_frame(buildings.local_columns),
        demolish,
        unplace_agents=["households", "jobs"])
    orca.add_table("buildings", buildings)
    buildings = orca.get_table("buildings")
    print "Demolished %d buildings" % (l1 - len(buildings))
    print "    (this number is smaller when parcel has no existing buildings)"

    # then build
    dps = development_projects.to_frame().\
        query("%d <= year_built < %d" % (year, year + years_per_iter))

    if len(dps) == 0:
        return

    new_buildings = utils.scheduled_development_events(
        buildings, dps,
        remove_developed_buildings=False,
        unplace_agents=['households', 'jobs'])
    new_buildings["form"] = new_buildings.building_type.map(
        settings['building_type_map']).str.lower()
    new_buildings["job_spaces"] = new_buildings.nres_sqft / \
        new_buildings.building_type.fillna("OF").map(building_sqft_per_job)
    new_buildings["job_spaces"] = new_buildings.job_spaces.\
        fillna(0).astype('int')
    new_buildings["geom_id"] = parcel_id_to_geom_id(new_buildings.parcel_id)
    new_buildings["SDEM"] = True
    new_buildings["subsidized"] = False

    new_buildings["zone_id"] = misc.reindex(
        parcels.zone_id, new_buildings.parcel_id)
    new_buildings["vmt_res_cat"] = misc.reindex(
        vmt_fee_categories.res_cat, new_buildings.zone_id)
    del new_buildings["zone_id"]
    new_buildings["pda"] = parcels_geography.pda_id.loc[
        new_buildings.parcel_id].values
    # Added to make topsheet work. Sketchy though, since only rows added in
    # this function's summary.add_parcel_output. Other functions that do this
    # will just have a NaN in this column. Consider changing.
    if 'total_sqft' not in new_buildings.columns:
        new_buildings['total_sqft'] = misc.reindex(
                parcels.total_sqft, new_buildings.PARCEL_ID)
    if 'superdistrict' not in new_buildings.columns:
        new_buildings['superdistrict'] = misc.reindex(
                parcels.superdistrict, new_buildings.PARCEL_ID)
    if 'juris' not in new_buildings.columns:
        new_buildings['juris'] = misc.reindex(
                parcels.juris, new_buildings.PARCEL_ID)

    summary.add_parcel_output(new_buildings)