Documentation for the UE Solver¶
Conversions¶
-
ue_solver.conversions.networkx_to_geojson(graph_f, geojson_outf, simple_geom=False)[source]¶ Converts graph_f (a networkx graph) into a pandas DataFrame, then converts the DataFrame into a geoJSON file
Parameters:
-
ue_solver.conversions.df_to_geoJson(df, geojson_fileout, with_flow=False)[source]¶ Converts a pandas DataFrame to a geoJSON file
Parameters: - df (DataFrame) – Input DataFrame
- geojson_outf (str) – File path of out file
-
ue_solver.conversions.graph_to_network_file(graph, filepath)[source]¶ - Writes networkx traffic graph to a text file according to the FW program requirements.
- Format is ‘~ Init/Term/Cap/Length/FreeFlowTime/B=0.15/Power=4/Speed limit/Toll/Type;’ tab delineated, with meta-data.
Parameters: - g (networkx) – Input road network
- filepath (str) – Filepath where graph will be saved
Modify network¶
-
ue_solver.modify_network.label_road_network(input_shp, road_network_geojson, attributes, geojson_outf, rename_attributes = None)[source]¶ Generalized function of append_city_names. Allows user to specify which attributes to keep from the input shape file. Spatial join shape file with network, so that network file now has identifying labels
Parameters: - input_shp (str) – filepath for generalized shapefile for cities, neighborhoods, from any state
- road_network_geojson (str) – filepath for input geoJSON network file
- attributes ([str]) – either string or array of strings, selected attributes that will be joined
- geojson_outf (str) – filepath for output file with identifying labels
- rename_attributes ([str]) – either string or array of strings (should match attributes), can be used if user would like to rename the attributes to more user-friendly names
-
ue_solver.modify_network.update_capacity(attr_dict, percent_cap, geojson_inf, geojson_outf, graph_f=None)[source]¶ Parameters: - attr_dict (dict) – list of values that will be changed, example: {‘county’: [‘Alameda’, ‘Berkeley’, ‘Emeryville’]}
- percent_cap (float) – percent of existing capacity roads will now have
- geojson_in (str) – filepath network geoJSON file
- geojson_out (str) – filepath save locations of modified network geoJSON file
- graph_f (str) – path of updated networkx or None if don’t want to save networkx graph
Process results¶
-
ue_solver.process_results.results_to_geojson(results_f, geojson_inf, geojson_outf)[source]¶ Results file is merged with the network geojson file based on the init and term ids of each link. Saves geojson with merged results.
Parameters:
-
ue_solver.process_results.geoj_vmt_vht_delay(results_geoj, cities_aggregate_output_file, output_summary, totalODflow = 0, min_speed = 0, save_path = 0)[source]¶ Calculates VMT, VHT, and delay from results_geoj
Parameters: - results_geoj (str) – filepath for results geoJSON
- cities_aggregate_output_file (str) – placeholder
- output_summary (str) – placeholder
- totalODflow (float) – total demand (number of passengers)
- min_speed (float) – force speed to min_speed if link speed < min_speed
- save_path (str) – filepath to save plot to