Ejemplo n.º 1
0
def get_singleyr_data(fc_tripshedpoly, projtyp, adt, out_dict={}):
    print("getting accessibility data for base...")
    accdata = acc.get_acc_data(fc_tripshedpoly, p.accdata_fc, projtyp, get_ej=False)
        
    print("getting ag acreage data for base...")
    ag_acres = luac.get_lutype_acreage(fc_tripshedpoly, projtyp, p.parcel_poly_fc, p.lutype_ag)
    
    # total job + du density (base year only, for state-of-good-repair proj eval only)
    print("getting ILUT data for base...")
    job_du_dens = lu_pt_buff.point_sum_density(p.parcel_pt_fc, fc_tripshedpoly, projtyp, 
                                               [p.col_emptot, p.col_du], p.ilut_sum_buffdist)
    comb_du_dens = sum(list(job_du_dens.values()))
    job_du_dens['job_du_perNetAcre'] = comb_du_dens

    # get EJ data
    print("getting EJ data for base...")
    ej_data = lu_pt_buff.point_sum(p.parcel_pt_fc, fc_tripshedpoly, projtyp, [p.col_pop_ilut],
                                            p.ilut_sum_buffdist, p.col_ej_ind, case_excs_list=[])
    
    ej_flag_dict = {0: "Pop_NonEJArea", 1: "Pop_EJArea"}  # rename keys from 0/1 to more human-readable names
    ej_data = utils.rename_dict_keys(ej_data, ej_flag_dict)
    ej_data["Pct_PopEJArea"] = ej_data["Pop_EJArea"] / sum(list(ej_data.values()))
    
    accdata_ej = acc.get_acc_data(fc_tripshedpoly, p.accdata_fc, projtyp, get_ej=True)  # EJ accessibility data
    ej_data.update(accdata_ej)

    # for base dict, add items that only have a base year value (no future year values)
    for d in [accdata, ag_acres, job_du_dens, ej_data]:
        out_dict_base.update(d)

    outdf = pd.DataFrame.from_dict(out_dict_base, orient='index')
    
    return outdf
Ejemplo n.º 2
0
def get_singleyr_data(fc_project, projtyp, adt, posted_speedlim, out_dict={}):
    
    pcl_pt_fc = p.parcel_pt_fc_yr(2016)
    pcl_poly_fc = p.parcel_poly_fc_yr(2016)
    
    accdata = acc.get_acc_data(fc_project, p.accdata_fc, projtyp, get_ej=False)
    
    collision_data = coll.get_collision_data(fc_project, projtyp, p.collisions_fc, adt)

    complete_street_score = {'complete_street_score': -1} if projtyp == p.ptype_fwy else \
        cs.complete_streets_idx(pcl_pt_fc, fc_project, projtyp, posted_speedlim, p.trn_svc_fc)
        
    truck_route_pct = {'pct_proj_STAATruckRoutes': 1} if projtyp == p.ptype_fwy else \
        linex.get_line_overlap(fc_project, p.freight_route_fc, p.freight_route_fc) # all freeways are STAA truck routes
        
    ag_acres = luac.get_lutype_acreage(fc_project, projtyp, pcl_poly_fc, p.lutype_ag)
    
    pct_adt_truck = {"pct_truck_aadt": -1} if projtyp != p.ptype_fwy else truck_fwy.get_tmc_truck_data(fc_project, projtyp)
    
    intersxn_data = intsxn.intersection_density(fc_project, p.intersections_base_fc, projtyp)
    
    npmrds_data = npmrds.get_npmrds_data(fc_project, projtyp)
    
    transit_data = trnsvc.transit_svc_density(fc_project, p.trn_svc_fc, projtyp)
    
    bikeway_data = bnmi.get_bikeway_mileage_share(fc_project, p.ptype_sgr)
    
    infill_status = urbn.projarea_infill_status(fc_project, p.comm_types_fc)
    
    
    # total job + du density (base year only, for state-of-good-repair proj eval only)
    job_du_dens = lu_pt_buff.point_sum_density(pcl_pt_fc, fc_project, projtyp, 
                                               [p.col_emptot, p.col_du], p.ilut_sum_buffdist)
    comb_du_dens = sum(list(job_du_dens.values()))
    job_du_dens['job_du_perNetAcre'] = comb_du_dens

    # get EJ data
    ej_data = lu_pt_buff.point_sum(pcl_pt_fc, fc_project, projtyp, [p.col_pop_ilut],
                                            p.ilut_sum_buffdist, p.col_ej_ind, case_excs_list=[])
    
    ej_flag_dict = {0: "Pop_NonEJArea", 1: "Pop_EJArea"}  # rename keys from 0/1 to more human-readable names
    ej_data = utils.rename_dict_keys(ej_data, ej_flag_dict)
    ej_data["Pct_PopEJArea"] = ej_data["Pop_EJArea"] / sum(list(ej_data.values()))
    
    accdata_ej = acc.get_acc_data(fc_project, p.accdata_fc, projtyp, get_ej=True)  # EJ accessibility data
    ej_data.update(accdata_ej)

    # for base dict, add items that only have a base year value (no future year values)
    for d in [accdata, collision_data, complete_street_score, truck_route_pct, pct_adt_truck, ag_acres, intersxn_data,
              npmrds_data, transit_data, bikeway_data, infill_status, job_du_dens, ej_data]:
        out_dict_base.update(d)

    outdf = pd.DataFrame.from_dict(out_dict_base, orient='index')
    
    return outdf
Ejemplo n.º 3
0
def get_poly_avg(input_poly_fc):
    # as of 11/26/2019, each of these outputs are dictionaries
    accdata = acc.get_acc_data(input_poly_fc, p.accdata_fc, p.ptype_area_agg, get_ej=False)
    collision_data = coll.get_collision_data(input_poly_fc, p.ptype_area_agg, p.collisions_fc, 0)
    mix_data = mixidx.get_mix_idx(p.parcel_pt_fc, input_poly_fc, p.ptype_area_agg)
    intsecn_dens = intsxn.intersection_density(input_poly_fc, p.intersections_base_fc, p.ptype_area_agg)
    bikeway_covg = bufnet.get_bikeway_mileage_share(input_poly_fc, p.ptype_area_agg)
    tran_stop_density = trn_svc.transit_svc_density(input_poly_fc, p.trn_svc_fc, p.ptype_area_agg)

    emp_ind_wtot = lubuff.point_sum(p.parcel_pt_fc, input_poly_fc, p.ptype_area_agg, [p.col_empind, p.col_emptot], 0)
    emp_ind_pct = {'emp_ind_pct': emp_ind_wtot[p.col_empind] / emp_ind_wtot[p.col_emptot]}

    pop_x_ej = lubuff.point_sum(p.parcel_pt_fc, input_poly_fc, p.ptype_area_agg, [p.col_pop_ilut], 0, p.col_ej_ind)
    pop_tot = sum(pop_x_ej.values())
    pct_pop_ej = {'pct_ej_pop': pop_x_ej[1] / pop_tot}

    job_pop_dens = lubuff.point_sum_density(p.parcel_pt_fc, input_poly_fc, p.ptype_area_agg, \
                                            [p.col_du, p.col_emptot], 0)
    total_dens = {"job_du_dens_ac": sum(job_pop_dens.values())}

    out_dict = {}
    for d in [accdata, collision_data, mix_data, intsecn_dens, bikeway_covg, tran_stop_density, pct_pop_ej,\
              emp_ind_pct, total_dens]:
        out_dict.update(d)

    return out_dict
Ejemplo n.º 4
0
def get_poly_avg(input_poly_fc):
    # as of 11/26/2019, each of these outputs are dictionaries
    pcl_pt_data = params.parcel_pt_fc_yr()
    
    accdata = acc.get_acc_data(input_poly_fc, params.accdata_fc, params.ptype_area_agg, get_ej=False)
    collision_data = coll.get_collision_data(input_poly_fc, params.ptype_area_agg, params.collisions_fc, 0)
    mix_data = mixidx.get_mix_idx(pcl_pt_data, input_poly_fc, params.ptype_area_agg)
    intsecn_dens = intsxn.intersection_density(input_poly_fc, params.intersections_base_fc, params.ptype_area_agg)
    bikeway_covg = bufnet.get_bikeway_mileage_share(input_poly_fc, params.ptype_area_agg)
    tran_stop_density = trn_svc.transit_svc_density(input_poly_fc, params.trn_svc_fc, params.ptype_area_agg)

    emp_ind_wtot = lubuff.point_sum(pcl_pt_data, input_poly_fc, params.ptype_area_agg, [params.col_empind, params.col_emptot], 0)
    emp_ind_pct = {'EMPIND_jobshare': emp_ind_wtot[params.col_empind] / emp_ind_wtot[params.col_emptot] \
                   if emp_ind_wtot[params.col_emptot] > 0 else 0}

    pop_x_ej = lubuff.point_sum(pcl_pt_data, input_poly_fc, params.ptype_area_agg, [params.col_pop_ilut], 0, params.col_ej_ind)
    pop_tot = sum(pop_x_ej.values())
    key_yes_ej = max(list(pop_x_ej.keys()))
    pct_pop_ej = {'Pct_PopEJArea': pop_x_ej[key_yes_ej] / pop_tot if pop_tot > 0 else 0}

    job_pop_dens = lubuff.point_sum_density(pcl_pt_data, input_poly_fc, params.ptype_area_agg, \
                                            [params.col_du, params.col_emptot], 0)
        
    # total_dens = {"job_du_perNetAcre": sum(job_pop_dens.values())}

    out_dict = {}
    for d in [accdata, collision_data, mix_data, intsecn_dens, bikeway_covg, tran_stop_density, pct_pop_ej,\
              emp_ind_pct, job_pop_dens]:
        out_dict.update(d)

    return out_dict
Ejemplo n.º 5
0
    output_csv = r'Q:\ProjectLevelPerformanceAssessment\PPAv2\PPA2_0_code\PPA2\ProjectValCSVs\PPA_{}_{}.csv'.format(
        os.path.basename(project_fc), time_sufx)

    project_ctype = get_proj_ctype(project_fc, p.comm_types_fc)
    out_dict_base = {
        "project_name": proj_name,
        "project_type": project_type,
        'project_aadt': adt,
        'project_pci': pci,
        'project_speedlim': project_speedlim,
        "project_communtype": project_ctype
    }

    # metrics that only have base year value ------------------------------------
    accdata = acc.get_acc_data(project_fc,
                               p.accdata_fc,
                               project_type,
                               get_ej=False)

    collision_data = coll.get_collision_data(project_fc, project_type,
                                             p.collisions_fc, adt)

    complete_street_score = {'complete_street_score': -1} if project_type == p.ptype_fwy else \
        cs.complete_streets_idx(p.parcel_pt_fc, project_fc, project_type, project_speedlim, p.trn_svc_fc)

    truck_route_pct = {'pct_proj_STAATruckRoutes': 1} if project_type == p.ptype_fwy else \
        linex.get_line_overlap(project_fc, p.freight_route_fc, p.freight_route_fc) # all freeways are STAA truck routes

    ag_acres = luac.get_lutype_acreage(project_fc, p.parcel_poly_fc,
                                       p.lutype_ag)

    pct_adt_truck = {