-
Notifications
You must be signed in to change notification settings - Fork 0
HN Module
ccai-cmap edited this page Jul 27, 2025
·
97 revisions
The HN module refers to a_HN.py. This file contains the HighwayNetwork class, which describes the attributes and methods for a HighwayNetwork object. It is meant to work ONLY with highway data. It does not contain functionality for working with bus data.
15 attributes are defined. There are 8 final attributes which do not change, and 7 which get updated by the methods.
-
in_folder: the absolute path to the
mfhrn_programs/inputfolder. -
mhn_in_folder: the absolute path to the
mfhrn_programs/input/1_MHNfolder. -
in_gdb: the absolute path to
mfhrn_programs/input/1_MHN/MHN.gdb. -
mhn_out_folder: the absolute path to the
mfhrn_programs/output/1_MHNfolder. (The actual folder does not necessarily exist yet. This is just the path.) -
years_list: a list of the years that were passed into
years.csv(located in the input folder). - hwy_files: a list of names of the files in the MHN gdb which have to do solely with the highway network.
- bus_files: a list of names of the files in the MHN gdb which have to do with the bus network.
- rel_classes: a list of the names of the relationship classes in the MHN gdb.
- current_gdb: this describes the absolute path to the gdb which is currently being worked with.
- base_year: starts off as the actual base year of the MHN, and changes as updates are applied. (For example, it starts off at 2015, and after a year of changes have been applied, it changes to 2016).
- hwylink_df: a pandas dataframe representation of the hwynet/hwynet_arc feature class in the current gdb, with geometry dropped.
- hwynode_df: a pandas dataframe representation of the hwynet/hwynet_node feature class in the current gdb, with geometry dropped.
- hwyproj_df: a pandas dataframe represention of the hwyproj_coding table in the current gdb.
- hwyproj_years_df: a pandas dataframe representation of the hwynet/hwyproj feature class in the current gdb, with only the TIPID + COMPLETION_YEAR fields.
- built_gdbs: a list of the built gdbs in the output folder.
These are the building blocks for the rest of the scripts. There are 7 main methods (which are used in other scripts) and 7 helper methods (which are called by the main methods).
- generate_base_year(): makes a copy of the GDB in the output directory with the relationships removed.
- import_hwy_projects(): imports new highway projects from a spreadsheet.
- check_hwy_fcs(): checks the validity of the base feature classes.
- check_hwy_project_table(): checks the validity of the base highway project coding. (translates coding_overlap.sas and import_highway_projects_2.sas)
- build_future_hwys(): builds the network for the years specified in the years csv. (translates process_highway_coding.sas and the first half of generate_highway_files_2.sas)
- finalize_hwy_data(): drops rows marked for deletion, removes added fields and comments, and ensures that all of the hwy_files agree with each other.
- generate_hwy_files(): generates the highway files for the EMME model. (translates the second half of generate_highway_files_2.sas)
- get_hwy_dfs(): reads hwylink_df, hwynode_df, hwyproj_df, and hwyproj_years_df from the data in current_gdb.
- del_rcs(): deletes the relationship classes specified by rel_classes out of current_gdb.
- copy_gdb_safe(): copies a gdb in a safe way (because arcpy's Copy frequently crashes on me, T_T).
- subset_to_projects(): sets the "USE" field of projects outside the chosen subset (like RSP) to 0, so that they won't be applied.
- create_combined_gdb(): creates a gdb to store all the built highway networks, as well as project feature classes to easily verify how projects were applied.
- copy_hwy_links(): copies the current highway links into the combined gdb.
- hwy_forward_one_year(): moves the highway base year up one year.