arcpy.Delete_management(arcs_without_ABB_lyr) # Check for problems with other fields. bad_arcs_lyr = 'bad_arcs_lyr' bad_arcs_query = ( ''' "BASELINK" = ' ' OR "DIRECTIONS" = '0' ''' ''' OR ("BASELINK" = '1' AND ("DIRECTIONS" = '0' OR "TYPE1" = '0' OR "THRULANES1" = 0 OR "THRULANEWIDTH1" = 0 OR "AMPM1" = '0' OR "MODES" = '0')) ''' ''' OR ("BASELINK" = '1' AND "TYPE1" <> '7' AND "POSTEDSPEED1" = 0) ''' ''' OR ("BASELINK" = '1' AND "DIRECTIONS" = '3' AND ("TYPE2" = '0' OR "THRULANES2" = 0 OR "THRULANEWIDTH2" = 0 OR "AMPM2" = '0')) ''' ''' OR ("BASELINK" = '1' AND "DIRECTIONS" = '3' AND "TYPE2" <> '7' AND "POSTEDSPEED2" = 0) ''' ) arcpy.MakeFeatureLayer_management(temp_arcs, bad_arcs_lyr, bad_arcs_query) bad_arcs_count = int(arcpy.GetCount_management(bad_arcs_lyr).getOutput(0)) if bad_arcs_count > 0: arcpy.CopyFeatures_management(bad_arcs_lyr, bad_arcs_shp) MHN.die('Some arcs are missing required attributes. Check {0} for specific arcs.'.format(bad_arcs_shp)) raise arcpy.ExecuteError else: arcpy.Delete_management(bad_arcs_lyr) arcpy.AddMessage('-- All arcs have all required attributes') # ----------------------------------------------------------------------------- # Copy node attributes to memory, for fast access. # ----------------------------------------------------------------------------- current_nodes_dict = MHN.make_attribute_dict(MHN.node, 'NODE', ['POINT_X','POINT_Y']) # ----------------------------------------------------------------------------- # Generate nodes from arcs, to check for changes and errors. # -----------------------------------------------------------------------------
import sys import arcpy sys.path.append(os.path.abspath(os.path.join(sys.path[0], '..'))) # Add mhn_programs dir to path, so MHN.py can be imported from MHN import MasterHighwayNetwork # Custom class for MHN processing functionality # ----------------------------------------------------------------------------- # Set parameters. # ----------------------------------------------------------------------------- mhn_gdb_path = arcpy.GetParameterAsText(0) # MHN gdb path MHN = MasterHighwayNetwork(mhn_gdb_path) # Initialize MHN object # Get the build year, and verify that it can actually be built. build_year = arcpy.GetParameter(1) # Integer, default = 2013 if build_year < MHN.base_year: MHN.die(('The MHN currently has a base year of {0}, so its prior state is ' 'unknown. Please try {0} or later.').format(MHN.base_year)) # Get the output GDB and feature dataset, and create if non-existent. gdb_path = arcpy.GetParameterAsText(2) # Folder, no default gdb_name = arcpy.GetParameterAsText(3) # String, no default if not gdb_name.endswith('.gdb'): gdb_name = '{0}.gdb'.format(gdb_name) out_gdb = os.path.join(gdb_path, gdb_name) if not arcpy.Exists(out_gdb): arcpy.CreateFileGDB_management(gdb_path, gdb_name) out_fd_name = 'hwynet_{0}'.format(build_year) out_fd = os.path.join(out_gdb, out_fd_name) sr = arcpy.Describe(MHN.hwynet).spatialReference if not arcpy.Exists(out_fd): arcpy.CreateFeatureDataset_management(out_gdb, out_fd_name, sr)
# ----------------------------------------------------------------------------- # Set parameters. # ----------------------------------------------------------------------------- mhn_gdb_path = arcpy.GetParameterAsText(0) # MHN geodatabase MHN = MasterHighwayNetwork(mhn_gdb_path) mrn_gdb_path = arcpy.GetParameterAsText(1) # MRN geodatabase mrn_future_fc = os.path.join(mrn_gdb_path, 'railnet', 'future') people_mover_table = os.path.join(mrn_gdb_path, 'people_mover') tipid_conformed_csv = arcpy.GetParameterAsText(2) # CSV of coded conformed projects tipid_exempt_csv = arcpy.GetParameterAsText(3) # CSV of coded exempt projects tipid_uncodable_csv = arcpy.GetParameterAsText(4) # CSV of uncodable projects #arcpy.AddWarning('\nCurrently updating {0}.'.format(MHN.gdb)) if not arcpy.Exists(mrn_gdb_path): MHN.die("{0} doesn't exist!".format(mrn_gdb_path)) if not arcpy.Exists(mrn_future_fc): MHN.die("{0} doesn't exist!".format(mrn_future_fc)) if not arcpy.Exists(people_mover_table): MHN.die("{0} doesn't exist!".format(people_mover_table)) if not os.path.exists(tipid_conformed_csv): MHN.die("{0} doesn't exist!".format(tipid_conformed_csv)) if not os.path.exists(tipid_exempt_csv): MHN.die("{0} doesn't exist!".format(tipid_exempt_csv)) if not os.path.exists(tipid_uncodable_csv): MHN.die("{0} doesn't exist!".format(tipid_uncodable_csv)) # ----------------------------------------------------------------------------- # Set diagnostic output locations. # -----------------------------------------------------------------------------
# ----------------------------------------------------------------------------- MHN.delete_if_exists(sas1_log) MHN.delete_if_exists(sas1_lst) MHN.delete_if_exists(year_csv) MHN.delete_if_exists(transact_csv) MHN.delete_if_exists(network_csv) MHN.delete_if_exists(future_itin_csv) MHN.delete_if_exists(future_route_csv) # ----------------------------------------------------------------------------- # Verify that all projects have a non-zero, non-null completion year. # ----------------------------------------------------------------------------- invalid_hwyproj = MHN.get_yearless_hwyproj() if invalid_hwyproj: MHN.die('The following highway projects have no completion year: {0}'.format(', '.join(invalid_hwyproj))) # ----------------------------------------------------------------------------- # Export highway project coding info to determine future arc availability. # ----------------------------------------------------------------------------- hwyproj_id_field = MHN.route_systems[MHN.hwyproj][1] # Export projects with valid completion years. year_attr = (hwyproj_id_field, 'COMPLETION_YEAR') year_query = '{0} <= {1}'.format("COMPLETION_YEAR", MHN.max_year) year_view = MHN.make_skinny_table_view(MHN.hwyproj, 'year_view', year_attr, year_query) MHN.write_attribute_csv(year_view, year_csv, year_attr) projects = MHN.make_attribute_dict(year_view, hwyproj_id_field, attr_list=[]) arcpy.Delete_management(year_view)
# ----------------------------------------------------------------------------- MHN.delete_if_exists(sas1_log) MHN.delete_if_exists(sas1_lst) MHN.delete_if_exists(year_csv) MHN.delete_if_exists(transact_csv) MHN.delete_if_exists(network_csv) MHN.delete_if_exists(future_itin_csv) MHN.delete_if_exists(future_route_csv) # ----------------------------------------------------------------------------- # Verify that all projects have a non-zero, non-null completion year. # ----------------------------------------------------------------------------- invalid_hwyproj = MHN.get_yearless_hwyproj() if invalid_hwyproj: MHN.die( 'The following highway projects have no completion year: {0}'.format( ', '.join(invalid_hwyproj))) # ----------------------------------------------------------------------------- # Export highway project coding info to determine future arc availability. # ----------------------------------------------------------------------------- hwyproj_id_field = MHN.route_systems[MHN.hwyproj][1] # Export projects with valid completion years. year_attr = (hwyproj_id_field, 'COMPLETION_YEAR') year_query = '{0} <= {1}'.format("COMPLETION_YEAR", MHN.max_year) year_view = MHN.make_skinny_table_view(MHN.hwyproj, 'year_view', year_attr, year_query) MHN.write_attribute_csv(year_view, year_csv, year_attr) projects = MHN.make_attribute_dict(year_view, hwyproj_id_field, attr_list=[]) arcpy.Delete_management(year_view)
# ----------------------------------------------------------------------------- # Set parameters. # ----------------------------------------------------------------------------- mhn_gdb_path = arcpy.GetParameterAsText(0) # MHN geodatabase MHN = MasterHighwayNetwork(mhn_gdb_path) mrn_gdb_path = arcpy.GetParameterAsText(1) # MRN geodatabase mrn_future_fc = os.path.join(mrn_gdb_path, 'railnet', 'future') people_mover_table = os.path.join(mrn_gdb_path, 'people_mover') tipid_conformed_csv = arcpy.GetParameterAsText(2) # CSV of coded conformed projects tipid_exempt_csv = arcpy.GetParameterAsText(3) # CSV of coded exempt projects tipid_uncodable_csv = arcpy.GetParameterAsText(4) # CSV of uncodable projects #arcpy.AddWarning('\nCurrently updating {0}.'.format(MHN.gdb)) if not arcpy.Exists(mrn_gdb_path): MHN.die("{0} doesn't exist!".format(mrn_gdb_path)) if not arcpy.Exists(mrn_future_fc): MHN.die("{0} doesn't exist!".format(mrn_future_fc)) if not arcpy.Exists(people_mover_table): MHN.die("{0} doesn't exist!".format(people_mover_table)) if not os.path.exists(tipid_conformed_csv): MHN.die("{0} doesn't exist!".format(tipid_conformed_csv)) if not os.path.exists(tipid_exempt_csv): MHN.die("{0} doesn't exist!".format(tipid_exempt_csv)) if not os.path.exists(tipid_uncodable_csv): MHN.die("{0} doesn't exist!".format(tipid_uncodable_csv)) # ----------------------------------------------------------------------------- # Set diagnostic output locations. # -----------------------------------------------------------------------------
sys.path.append(os.path.abspath(os.path.join( sys.path[0], '..'))) # Add mhn_programs dir to path, so MHN.py can be imported from MHN import MasterHighwayNetwork # Custom class for MHN processing functionality # ----------------------------------------------------------------------------- # Set parameters. # ----------------------------------------------------------------------------- mhn_gdb_path = arcpy.GetParameterAsText(0) # MHN gdb path MHN = MasterHighwayNetwork(mhn_gdb_path) # Initialize MHN object # Get the build year, and verify that it can actually be built. build_year = arcpy.GetParameter(1) # Integer, default = 2013 if build_year < MHN.base_year: MHN.die(('The MHN currently has a base year of {0}, so its prior state is ' 'unknown. Please try {0} or later.').format(MHN.base_year)) # Get the output GDB and feature dataset, and create if non-existent. gdb_path = arcpy.GetParameterAsText(2) # Folder, no default gdb_name = arcpy.GetParameterAsText(3) # String, no default if not gdb_name.endswith('.gdb'): gdb_name = '{0}.gdb'.format(gdb_name) out_gdb = os.path.join(gdb_path, gdb_name) if not arcpy.Exists(out_gdb): arcpy.CreateFileGDB_management(gdb_path, gdb_name) out_fd_name = 'hwynet_{0}'.format(build_year) out_fd = os.path.join(out_gdb, out_fd_name) sr = arcpy.Describe(MHN.hwynet).spatialReference if not arcpy.Exists(out_fd): arcpy.CreateFeatureDataset_management(out_gdb, out_fd_name, sr)
# Check for problems with other fields. bad_arcs_lyr = 'bad_arcs_lyr' bad_arcs_query = ( ''' "BASELINK" = ' ' OR "DIRECTIONS" = '0' ''' ''' OR ("BASELINK" = '1' AND ("DIRECTIONS" = '0' OR "TYPE1" = '0' OR "THRULANES1" = 0 OR "THRULANEWIDTH1" = 0 OR "AMPM1" = '0' OR "MODES" = '0')) ''' ''' OR ("BASELINK" = '1' AND "TYPE1" <> '7' AND "POSTEDSPEED1" = 0) ''' ''' OR ("BASELINK" = '1' AND "DIRECTIONS" = '3' AND ("TYPE2" = '0' OR "THRULANES2" = 0 OR "THRULANEWIDTH2" = 0 OR "AMPM2" = '0')) ''' ''' OR ("BASELINK" = '1' AND "DIRECTIONS" = '3' AND "TYPE2" <> '7' AND "POSTEDSPEED2" = 0) ''' ) arcpy.MakeFeatureLayer_management(temp_arcs, bad_arcs_lyr, bad_arcs_query) bad_arcs_count = int(arcpy.GetCount_management(bad_arcs_lyr).getOutput(0)) if bad_arcs_count > 0: arcpy.CopyFeatures_management(bad_arcs_lyr, bad_arcs_shp) MHN.die( 'Some arcs are missing required attributes. Check {0} for specific arcs.' .format(bad_arcs_shp)) raise arcpy.ExecuteError else: arcpy.Delete_management(bad_arcs_lyr) arcpy.AddMessage('-- All arcs have all required attributes') # ----------------------------------------------------------------------------- # Copy node attributes to memory, for fast access. # ----------------------------------------------------------------------------- current_nodes_dict = MHN.make_attribute_dict(MHN.node, 'NODE', ['POINT_X', 'POINT_Y']) # ----------------------------------------------------------------------------- # Generate nodes from arcs, to check for changes and errors. # -----------------------------------------------------------------------------
import sys import arcpy sys.path.append(os.path.abspath(os.path.join(sys.path[0], '..'))) # Add mhn_programs dir to path, so MHN.py can be imported from MHN import MasterHighwayNetwork # Custom class for MHN processing functionality # ----------------------------------------------------------------------------- # Set parameters. # ----------------------------------------------------------------------------- mhn_gdb_path = arcpy.GetParameterAsText(0) # Input MHN gdb path in_mhn = MasterHighwayNetwork(mhn_gdb_path) # Initialize input MHN object # Get the build year, and verify that it can actually be built. build_year = arcpy.GetParameter(1) # Integer, default = 2015 if build_year <= in_mhn.base_year: in_mhn.die(('The MHN currently has a base year of {0}. Try a year later than {0}.').format(in_mhn.base_year)) # Get the output GDB and feature dataset, and create if non-existent. gdb_path = arcpy.GetParameterAsText(2) # Folder, no default gdb_name = arcpy.GetParameterAsText(3) # String, no default if not gdb_name.endswith('.gdb'): gdb_name = '{}.gdb'.format(gdb_name) out_gdb = os.path.join(gdb_path, gdb_name) # Output MHN gdb path # Other parameters sas1_name = 'process_highway_coding' # Also used by export_future_network.py # ----------------------------------------------------------------------------- # Set diagnostic output locations. # -----------------------------------------------------------------------------
MHN.delete_if_exists(short_path_txt) MHN.delete_if_exists(path_err_txt) MHN.delete_if_exists(hold_check_csv) MHN.delete_if_exists(hold_times_csv) MHN.delete_if_exists(routes_processed_csv) # ----------------------------------------------------------------------------- # Set route system-specific variables. # ----------------------------------------------------------------------------- if which_bus == 'base': routes_fc = MHN.bus_base elif which_bus == 'current': routes_fc = MHN.bus_current else: MHN.die('Route system must be either "base" or "current", not "{0}"!'.format(which_bus)) itin = MHN.route_systems[routes_fc][0] common_id_field = MHN.route_systems[routes_fc][1] order_field = MHN.route_systems[routes_fc][2] min_route_id = MHN.route_systems[routes_fc][3] network_year = MHN.bus_years[which_bus] # ----------------------------------------------------------------------------- # Verify that all projects have a non-zero, non-null completion year. # ----------------------------------------------------------------------------- # Skip check if bus year = base year (i.e. no projects would be added anyway). if network_year > MHN.base_year: invalid_hwyproj = MHN.get_yearless_hwyproj() if invalid_hwyproj:
# ----------------------------------------------------------------------------- # Use SAS program to validate coding before import. # ----------------------------------------------------------------------------- arcpy.AddMessage('{0}Validating coding in {1}...'.format('\n', xls)) mhn_links_attr = ['ANODE', 'BNODE', 'BASELINK'] mhn_links_query = ''' "BASELINK" IN ('0', '1') ''' # Ignore BASELINK > 1 mhn_links_view = MHN.make_skinny_table_view(MHN.arc, 'mhn_links_view', mhn_links_attr, mhn_links_query) MHN.write_attribute_csv(mhn_links_view, mhn_links_csv, mhn_links_attr) sas1_sas = os.path.join(MHN.prog_dir, '{0}.sas'.format(sas1_name)) sas1_args = [xls, mhn_links_csv, projects_csv, sas1_lst] MHN.submit_sas(sas1_sas, sas1_log, sas1_lst, sas1_args) if not os.path.exists(sas1_log): MHN.die('{0} did not run!'.format(sas1_sas)) elif not os.path.exists(projects_csv): MHN.die('{0} did not finish successfully! Please see {1}'.format(sas1_sas, sas1_log)) elif os.path.exists(sas1_lst): MHN.die('Problems with project coding. Please see {0}.'.format(sas1_lst)) else: os.remove(sas1_log) os.remove(mhn_links_csv) # ----------------------------------------------------------------------------- # Generate temp feature class/coding table from SAS output. # ----------------------------------------------------------------------------- arcpy.AddMessage('{0}Building updated coding table & feature class in memory...'.format('\n')) temp_projects_name = 'temp_routes_fc'
# ----------------------------------------------------------------------------- MHN.delete_if_exists(sas1_log) MHN.delete_if_exists(sas1_lst) MHN.delete_if_exists(year_csv) MHN.delete_if_exists(transact_csv) MHN.delete_if_exists(network_csv) MHN.delete_if_exists(future_itin_csv) MHN.delete_if_exists(future_route_csv) # ----------------------------------------------------------------------------- # Verify that all projects have a non-zero, non-null completion year. # ----------------------------------------------------------------------------- invalid_hwyproj = MHN.get_yearless_hwyproj() if invalid_hwyproj: MHN.die("The following highway projects have no completion year: {0}".format(", ".join(invalid_hwyproj))) # ----------------------------------------------------------------------------- # Export highway project coding info to determine future arc availability. # ----------------------------------------------------------------------------- hwyproj_id_field = MHN.route_systems[MHN.hwyproj][1] # Export projects with valid completion years. year_attr = (hwyproj_id_field, "COMPLETION_YEAR") year_query = "{0} <= {1}".format("COMPLETION_YEAR", MHN.max_year) year_view = MHN.make_skinny_table_view(MHN.hwyproj, "year_view", year_attr, year_query) MHN.write_attribute_csv(year_view, year_csv, year_attr) projects = MHN.make_attribute_dict(year_view, hwyproj_id_field, attr_list=[]) arcpy.Delete_management(year_view)
MHN.delete_if_exists(short_path_txt) MHN.delete_if_exists(path_err_txt) MHN.delete_if_exists(hold_check_csv) MHN.delete_if_exists(hold_times_csv) MHN.delete_if_exists(routes_processed_csv) # ----------------------------------------------------------------------------- # Set route system-specific variables. # ----------------------------------------------------------------------------- if which_bus == 'base': routes_fc = MHN.bus_base elif which_bus == 'current': routes_fc = MHN.bus_current else: MHN.die('Route system must be either "base" or "current", not "{0}"!'.format(which_bus)) itin = MHN.route_systems[routes_fc][0] common_id_field = MHN.route_systems[routes_fc][1] order_field = MHN.route_systems[routes_fc][2] min_route_id = MHN.route_systems[routes_fc][3] network_year = MHN.bus_years[which_bus] # ----------------------------------------------------------------------------- # Verify that all projects have a non-zero, non-null completion year. # ----------------------------------------------------------------------------- # Skip check if bus year = base year (i.e. no projects would be added anyway). if network_year > MHN.base_year: invalid_hwyproj = MHN.get_yearless_hwyproj() if invalid_hwyproj:
# ----------------------------------------------------------------------------- # Set parameters. # ----------------------------------------------------------------------------- arcpy.env.qualifiedFieldNames = False # Joined attributes will not have fc name prefix mhn_gdb_path = arcpy.GetParameterAsText(0) # MHN geodatabase MHN = MasterHighwayNetwork(mhn_gdb_path) scen_list = arcpy.GetParameterAsText(1).split(';') # Semicolon-delimited string, e.g. '100;200' root_path = arcpy.GetParameterAsText(2) # String, no default abm_output = arcpy.GetParameter(3) # Boolean, default = False out_tod_periods = sorted(MHN.tod_periods.keys()) if not os.path.exists(root_path): MHN.die("{0} doesn't exist!".format(root_path)) hwy_path = os.path.join(root_path, 'highway') if not os.path.exists(hwy_path): MHN.die('{0} contains no highway folder! Please run the Generate Highway Files tool first.'.format(root_path)) tran_path = os.path.join(root_path, 'transit') if not os.path.exists(tran_path): MHN.die("{0} contains no transit folder! Please run the Master Rail Network's Create Emme Scenario Files tool first.".format(root_path)) sas1_name = 'gtfs_reformat_feed' sas2_name = 'generate_transit_files_2' sas3_name = 'generate_transit_files_3' # ----------------------------------------------------------------------------- # Set diagnostic output locations. # -----------------------------------------------------------------------------
from MHN import MasterHighwayNetwork # Custom class for MHN processing functionality # ----------------------------------------------------------------------------- # Set parameters. # ----------------------------------------------------------------------------- mhn_gdb_path = arcpy.GetParameterAsText(0) # MHN geodatabase MHN = MasterHighwayNetwork(mhn_gdb_path) scen_list = arcpy.GetParameterAsText(1).split( ';') # Semicolon-delimited string, e.g. '100;200' root_path = arcpy.GetParameterAsText(2) # String, no default create_tollsys_flag = arcpy.GetParameter(3) # Boolean, default = True abm_output = arcpy.GetParameter(4) # Boolean, default = False if os.path.exists(root_path): hwy_path = MHN.ensure_dir(os.path.join(root_path, 'highway')) else: MHN.die("{0} doesn't exist!".format(root_path)) sas1_name = 'coding_overlap' sas2_name = 'generate_highway_files_2' # ----------------------------------------------------------------------------- # Set diagnostic output locations. # ----------------------------------------------------------------------------- overlap_year_csv = os.path.join(MHN.temp_dir, 'overlap_year.csv') overlap_transact_csv = os.path.join(MHN.temp_dir, 'overlap_transact.csv') overlap_network_csv = os.path.join(MHN.temp_dir, 'overlap_network.csv') sas1_log = os.path.join(MHN.temp_dir, '{0}.log'.format(sas1_name)) sas1_lst = os.path.join(MHN.temp_dir, '{0}.lst'.format(sas1_name)) # sas2_log & sas2_lst are scenario-dependent, defined below # ----------------------------------------------------------------------------- # Clean up old temp files, if necessary.
import arcpy from operator import itemgetter from MHN import MasterHighwayNetwork # Custom class for MHN processing functionality # ----------------------------------------------------------------------------- # Set parameters. # ----------------------------------------------------------------------------- mhn_gdb_path = arcpy.GetParameterAsText(0) # MHN geodatabase MHN = MasterHighwayNetwork(mhn_gdb_path) scen_list = arcpy.GetParameterAsText(1).split(";") # Semicolon-delimited string, e.g. '100;200' root_path = arcpy.GetParameterAsText(2) # String, no default create_tollsys_flag = arcpy.GetParameter(3) # Boolean, default = True if os.path.exists(root_path): hwy_path = MHN.ensure_dir(os.path.join(root_path, "highway")) else: MHN.die("{0} doesn't exist!".format(root_path)) sas1_name = "coding_overlap" sas2_name = "generate_highway_files_2" # ----------------------------------------------------------------------------- # Set diagnostic output locations. # ----------------------------------------------------------------------------- overlap_year_csv = os.path.join(MHN.temp_dir, "overlap_year.csv") overlap_transact_csv = os.path.join(MHN.temp_dir, "overlap_transact.csv") overlap_network_csv = os.path.join(MHN.temp_dir, "overlap_network.csv") sas1_log = os.path.join(MHN.temp_dir, "{0}.log".format(sas1_name)) sas1_lst = os.path.join(MHN.temp_dir, "{0}.lst".format(sas1_name)) # sas2_log & sas2_lst are scenario-dependent, defined below
# ----------------------------------------------------------------------------- # Use SAS program to validate coding before import. # ----------------------------------------------------------------------------- arcpy.AddMessage('{0}Validating coding in {1}...'.format('\n', xls)) mhn_links_attr = ['ANODE', 'BNODE', 'BASELINK'] mhn_links_query = ''' "BASELINK" IN ('0', '1') ''' # Ignore BASELINK > 1 mhn_links_view = MHN.make_skinny_table_view(MHN.arc, 'mhn_links_view', mhn_links_attr, mhn_links_query) MHN.write_attribute_csv(mhn_links_view, mhn_links_csv, mhn_links_attr) sas1_sas = os.path.join(MHN.prog_dir, '{0}.sas'.format(sas1_name)) sas1_args = [xls, mhn_links_csv, projects_csv, sas1_lst] MHN.submit_sas(sas1_sas, sas1_log, sas1_lst, sas1_args) if not os.path.exists(sas1_log): MHN.die('{0} did not run!'.format(sas1_sas)) elif not os.path.exists(projects_csv): MHN.die('{0} did not finish successfully! Please see {1}'.format( sas1_sas, sas1_log)) elif os.path.exists(sas1_lst): MHN.die('Problems with project coding. Please see {0}.'.format(sas1_lst)) else: os.remove(sas1_log) os.remove(mhn_links_csv) # ----------------------------------------------------------------------------- # Generate temp feature class/coding table from SAS output. # ----------------------------------------------------------------------------- arcpy.AddMessage( '{0}Building updated coding table & feature class in memory...'.format( '\n'))