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)
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)
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)