Esempio n. 1
0
def get_multiyear_data(project_fc, project_type, base_df, analysis_year):
    
    ilut_val_fields = [p.col_pop_ilut, p.col_du, p.col_emptot, p.col_k12_enr, p.col_empind, p.col_persntrip_res] \
                  + p.ilut_ptrip_mode_fields    

    fc_pcl_pt = p.parcel_pt_fc_yr(year)
    fc_pcl_poly = p.parcel_poly_fc_yr(year)
    fc_modelhwylinks = p.model_links_fc(year)

    year_dict = {}
    # get data on pop, job, k12 totals
    # point_sum(fc_pclpt, fc_project, project_type, val_fields, buffdist, case_field=None, case_excs_list=[])
    ilut_buff_vals = lu_pt_buff.point_sum(fc_pcl_pt, project_fc, project_type, ilut_val_fields,
                                          p.ilut_sum_buffdist, case_field=None, case_excs_list=[])

    ilut_indjob_share = {"{}_jobshare".format(p.col_empind): ilut_buff_vals[p.col_empind] / ilut_buff_vals[p.col_emptot]}
    ilut_buff_vals.update(ilut_indjob_share)

    ilut_mode_split = {"{}_share".format(modetrp): ilut_buff_vals[modetrp] / ilut_buff_vals[p.col_persntrip_res]
                       for modetrp in p.ilut_ptrip_mode_fields}
    ilut_buff_vals.update(ilut_mode_split)

    # cleanup to remove non-percentage mode split values, if we want to keep output CSV from getting too long.
    # for trip_numcol in p.ilut_ptrip_mode_fields: del ilut_buff_vals[trip_numcol]

    # job + du total
    job_du_tot = {"SUM_JOB_DU": ilut_buff_vals[p.col_du] + ilut_buff_vals[p.col_emptot]}

    # model-based vehicle occupancy
    veh_occ_data = link_occ.get_linkoccup_data(project_fc, project_type, fc_modelhwylinks)

    # land use diversity index
    mix_index_data = mixidx.get_mix_idx(fc_pcl_pt, project_fc, project_type)

    # housing type mix
    housing_mix_data = lu_pt_buff.point_sum(fc_pcl_pt, project_fc, project_type, [p.col_du], p.du_mix_buffdist,
                                            p.col_housing_type, case_excs_list=['Other'])

    # acres of "natural resources" (land use type = forest or agriculture)
    nat_resources_data = urbn.nat_resources(project_fc, project_type, fc_pcl_poly, year)

    # combine into dict
    for d in [ilut_buff_vals, job_du_tot, veh_occ_data, mix_index_data, housing_mix_data, nat_resources_data]:
        year_dict.update(d)

    # make dict into dataframe
    df_year_out = pd.DataFrame.from_dict(year_dict, orient='index')
    
    return df_year_out
Esempio n. 2
0
                                                   fc_modelhwylinks)

        # land use diversity index
        mix_index_data = mixidx.get_mix_idx(fc_pcl_pt, project_fc,
                                            project_type)

        # housing type mix
        housing_mix_data = lu_pt_buff.point_sum(fc_pcl_pt,
                                                project_fc,
                                                project_type, [p.col_du],
                                                p.du_mix_buffdist,
                                                p.col_housing_type,
                                                case_excs_list=['Other'])

        # acres of "natural resources" (land use type = forest or agriculture)
        nat_resources_data = urbn.nat_resources(project_fc, fc_pcl_poly, year)

        # combine into dict
        for d in [
                ilut_buff_vals, job_du_tot, veh_occ_data, mix_index_data,
                housing_mix_data, nat_resources_data
        ]:
            year_dict.update(d)

        # make dict into dataframe
        df_year = pd.DataFrame.from_dict(year_dict, orient='index')

        # if it's base year, then append values to bottom of outdf_base,
        # if it's future year, then left-join the values to the outdf.
        # table has metrics as rows; years as columns (and will also append
        if year == min(analysis_years):
Esempio n. 3
0
                                               p.model_links_fc)

    # land use diversity index
    mix_index_data = mixidx.get_mix_idx(p.parcel_pt_fc, project_fc,
                                        p.ptype_arterial)

    # housing type mix
    housing_mix_data = lu_pt_buff.point_sum(p.parcel_pt_fc,
                                            project_fc,
                                            project_type, [p.col_du],
                                            p.du_mix_buffdist,
                                            p.col_housing_type,
                                            case_excs_list=['Other'])

    # acres of "natural resources" (land use type = forest or agriculture)
    nat_resources_data = urbn.nat_resources(project_fc, p.parcel_poly_fc, 2016)

    # combine all together-----------------------------------------------------------

    out_dict = {
        "project_name": proj_name,
        "project_type": project_type,
        'project_aadt': adt,
        'project_pci': pci,
        'project_speedlim': project_speedlim
    }
    for d in [
            accdata, collision_data, complete_street_score, truck_route_pct,
            pct_adt_truck, ag_acres, intersxn_data, npmrds_data,
            ilut_buff_vals, job_du_dens, ej_data, veh_occ_data, transit_data,
            mix_index_data, housing_mix_data, bikeway_data, infill_status,
Esempio n. 4
0
def get_multiyear_data(fc_tripshedpoly, projtyp, base_df, analysis_year):
    print("getting multi-year data for {}...".format(analysis_year))
    ilut_val_fields = [params.col_pop_ilut, params.col_du, params.col_emptot, params.col_k12_enr, params.col_empind, params.col_persntrip_res] \
                  + params.ilut_ptrip_mode_fields

    fc_pcl_pt = params.parcel_pt_fc_yr(analysis_year)
    fc_pcl_poly = params.parcel_poly_fc_yr(analysis_year)

    year_dict = {}
    # get data on pop, job, k12 totals
    # point_sum(fc_pclpt, fc_tripshedpoly, projtyp, val_fields, buffdist, case_field=None, case_excs_list=[])
    ilut_buff_vals = LandUseBuffCalcs(fc_pcl_pt,
                                      fc_tripshedpoly,
                                      projtyp,
                                      ilut_val_fields,
                                      params.ilut_sum_buffdist,
                                      case_field=None,
                                      case_excs_list=[]).point_sum()

    ilut_indjob_share = {
        "{}_jobshare".format(params.col_empind):
        ilut_buff_vals[params.col_empind] / ilut_buff_vals[params.col_emptot]
    }
    ilut_buff_vals.update(ilut_indjob_share)

    ilut_mode_split = {
        "{}_share".format(modetrp):
        ilut_buff_vals[modetrp] / ilut_buff_vals[params.col_persntrip_res]
        for modetrp in params.ilut_ptrip_mode_fields
    }
    ilut_buff_vals.update(ilut_mode_split)

    # cleanup to remove non-percentage mode split values, if we want to keep output CSV from getting too long.
    # for trip_numcol in params.ilut_ptrip_mode_fields: del ilut_buff_vals[trip_numcol]

    # job + du total
    job_du_tot = {
        "SUM_JOB_DU":
        ilut_buff_vals[params.col_du] + ilut_buff_vals[params.col_emptot]
    }

    # land use diversity index
    mix_index_data = mixidx.get_mix_idx(fc_pcl_pt, fc_tripshedpoly, projtyp)

    # housing type mix
    housing_mix_data = LandUseBuffCalcs(fc_pcl_pt,
                                        fc_tripshedpoly,
                                        projtyp, [params.col_du],
                                        params.du_mix_buffdist,
                                        params.col_housing_type,
                                        case_excs_list=['Other']).point_sum()

    # acres of "natural resources" (land use type = forest or agriculture)
    nat_resources_data = urbn.nat_resources(fc_tripshedpoly, projtyp,
                                            fc_pcl_poly, analysis_year)
    # combine into dict
    for d in [
            ilut_buff_vals, job_du_tot, mix_index_data, housing_mix_data,
            nat_resources_data
    ]:
        year_dict.update(d)

    # make dict into dataframe
    df_year_out = pd.DataFrame.from_dict(year_dict, orient='index')

    return df_year_out