out_number = out_integer + decimal_part return out_number def add_percent_sign(input): output = str(input) + " %" return output # datafile = 'D:/soundcat/soundcat/outputs/daysim_outputs.h5' # datafile = 'R:/JOE/summarize/daysim_outputs.h5' datafile = "Q:/soundcast/outputs/daysim_outputs.h5" guidefile = "Q:/soundcast/scripts/summarize/inputs/CatVarDict.xlsx" districtfile = "Q:/soundcast/scripts/summarize/inputs/TAZ_TAD_County.csv" urbcen = "Q:/soundcast/scripts/summarize/inputs/parcels_in_urbcens.csv" data = h5toDF.convert(datafile, guidefile, "Results") zone_district = get_districts(districtfile) parcels_regional_centers = pd.DataFrame.from_csv(urbcen) HHPer = pd.merge( data["Household"][["hhno", "hhparcel"]], data["Person"][["pwpcl", "hhno", "psexpfac", "pno"]], on="hhno" ) hh_center = pd.merge( HHPer[["hhno", "pno", "hhparcel", "psexpfac"]], parcels_regional_centers, "outer", left_on="hhparcel", right_index=True, ) hh_center = hh_center.dropna(subset=["NAME"]) center_populations = hh_center[["NAME", "psexpfac"]].groupby("NAME").sum()["psexpfac"]
return merge_trip_hh # Get the data SURVEY_DAYS = 2 zone_district = pd.DataFrame.from_csv(model_dir + districtfile, index_col=None) #Model Outputs trip_variables = [ 'otaz', 'dtaz', 'travtime', 'travcost', 'travdist', 'pno', 'mode', 'tour_id', 'opcl', 'dpcl', 'dorp', 'dpurp' ] hh_variables = ['hhno', 'hhincome', 'hhvehs', 'hhtaz'] person_variables = ['hhno', 'pno', 'pagey', 'pgend', 'id'] outputs = h5toDF.convert(model_dir + h5_results_file, model_dir + guidefile, 'outputs') trips_output = get_variables_trips(outputs, trip_variables, hh_variables, person_variables) trips_output = pd.merge(trips_output, zone_district, left_on='dtaz', right_on='TAZ') bikes_output = trips_output.loc[(trips_output['mode'] == 'Bike')] #Household Survey trip_variables_survey = [ 'otaz', 'dtaz', 'travtime', 'travcost', 'travdist', 'pno', 'mode', 'opcl', 'dpcl', 'dorp', 'dpurp', 'hhno', 'trexpfac' ] person_variables_survey = ['hhno', 'pno', 'pagey', 'pgend'] survey = h5toDF.convert(model_dir + h5_comparison_file, model_dir + guidefile,
out_integer = ','.join(integer_list) out_number = out_integer + decimal_part return out_number def add_percent_sign(input): output = str(input) + ' %' return output #datafile = 'D:/soundcat/soundcat/outputs/daysim_outputs.h5' #datafile = 'R:/JOE/summarize/daysim_outputs.h5' datafile = 'Q:/soundcast/outputs/daysim_outputs.h5' guidefile = 'Q:/soundcast/scripts/summarize/inputs/CatVarDict.xlsx' districtfile = 'Q:/soundcast/scripts/summarize/inputs/TAZ_TAD_County.csv' urbcen = 'Q:/soundcast/scripts/summarize/inputs/parcels_in_urbcens.csv' data = h5toDF.convert(datafile, guidefile, 'Results') zone_district = get_districts(districtfile) parcels_regional_centers = pd.DataFrame.from_csv(urbcen) HHPer = pd.merge(data['Household'][['hhno', 'hhparcel']], data['Person'][['pwpcl', 'hhno', 'psexpfac', 'pno']], on = 'hhno') hh_center = pd.merge(HHPer[['hhno', 'pno', 'hhparcel', 'psexpfac']], parcels_regional_centers, 'outer', left_on = 'hhparcel', right_index = True) hh_center = hh_center.dropna(subset = ['NAME']) center_populations = hh_center[['NAME', 'psexpfac']].groupby('NAME').sum()['psexpfac'] total_population = pd.Series(data = hh_center['psexpfac'].sum(), index = ['Total']) center_populations = center_populations.append(total_population) work_center = pd.merge(HHPer[['hhno', 'pwpcl']], parcels_regional_centers, 'outer', left_on = 'pwpcl', right_index = True) work_center = work_center.dropna(subset = ['NAME'])
out_number = out_integer + decimal_part return out_number def add_percent_sign(input): output = str(input) + ' %' return output #datafile = 'D:/soundcat/soundcat/outputs/daysim_outputs.h5' #datafile = 'R:/JOE/summarize/daysim_outputs.h5' datafile = 'Q:/soundcast/outputs/daysim_outputs.h5' guidefile = 'Q:/soundcast/scripts/summarize/inputs/CatVarDict.xlsx' districtfile = 'Q:/soundcast/scripts/summarize/inputs/TAZ_TAD_County.csv' urbcen = 'Q:/soundcast/scripts/summarize/inputs/parcels_in_urbcens.csv' data = h5toDF.convert(datafile, guidefile, 'Results') zone_district = get_districts(districtfile) parcels_regional_centers = pd.DataFrame.from_csv(urbcen) HHPer = pd.merge(data['Household'][['hhno', 'hhparcel']], data['Person'][['pwpcl', 'hhno', 'psexpfac', 'pno']], on='hhno') hh_center = pd.merge(HHPer[['hhno', 'pno', 'hhparcel', 'psexpfac']], parcels_regional_centers, 'outer', left_on='hhparcel', right_index=True) hh_center = hh_center.dropna(subset=['NAME']) center_populations = hh_center[['NAME', 'psexpfac']].groupby('NAME').sum()['psexpfac'] total_population = pd.Series(data=hh_center['psexpfac'].sum(), index=['Total'])
merge_hh_person.reset_index() merge_trip_hh = pd.merge(trip_data, merge_hh_person, 'inner', on =('hhno', 'pno')) return merge_trip_hh # Get the data SURVEY_DAYS =2 zone_district = pd.DataFrame.from_csv(model_dir+districtfile, index_col = None) #Model Outputs trip_variables = ['otaz', 'dtaz', 'travtime', 'travcost', 'travdist', 'pno', 'mode', 'tour_id', 'opcl', 'dpcl', 'dorp', 'dpurp'] hh_variables = ['hhno', 'hhincome', 'hhvehs', 'hhtaz'] person_variables = ['hhno', 'pno', 'pagey', 'pgend', 'id'] outputs = h5toDF.convert(model_dir + h5_results_file,model_dir+guidefile, 'outputs') trips_output = get_variables_trips(outputs, trip_variables, hh_variables, person_variables) trips_output = pd.merge(trips_output, zone_district, left_on = 'dtaz', right_on = 'TAZ') bikes_output = trips_output.loc[(trips_output['mode']=='Bike')] #Household Survey trip_variables_survey = ['otaz', 'dtaz', 'travtime', 'travcost', 'travdist', 'pno', 'mode', 'opcl', 'dpcl', 'dorp', 'dpurp', 'hhno', 'trexpfac'] person_variables_survey = ['hhno', 'pno', 'pagey', 'pgend'] survey = h5toDF.convert(model_dir +h5_comparison_file, model_dir+guidefile, 'survey') trips_survey = get_variables_trips_survey(survey, trip_variables_survey , person_variables_survey, hh_variables) trips_survey = pd.merge(trips_survey, zone_district, left_on = 'dtaz', right_on = 'TAZ') bikes_survey = trips_survey.loc[(trips_survey['mode']=='Bike')] bike_survey_geo = pd.merge(bikes_output, zone_district, left_on = 'dtaz', right_on = 'TAZ') #Do some summaries###########