Can somebody help with me with my if statement code on the bottom

المشرف العام

Administrator
طاقم الإدارة
try: # Import the modules import arcpy from arcpy import env

# Set up the environment env.workspace = r"C:\Users\Neng\Desktop\Fire_Files_For Oct_2010.gdb" env.overwriteOutput = True # Prompt user for the input table inTable = arcpy.GetParameterAsText(0) # When this is set up as a script tool, set the input to tables only # Get the fields from the input fields = arcpy.ListFields(inTable) # Create a describe object describing the input table descTable = arcpy.Describe(inTable) # Create variable to store path to results gdbName = descTable.path # Create table view to use for selections # MakeTableView_management (in_table, out_view, {where_clause}, {workspace}, {field_info}) arcpy.MakeTableView_management(inTable,"tableView") # Create a cursor to go through the table view row by row fireCursor = arcpy.da.SearchCursor("tableView", "*") # Use cursor to find each unique incident type and add it to a list # Set up a list to hold unique incident types incidentList = [] # Start cursor iteration for row in fireCursor: incidentType = row[6] if incidentType not in incidentList: incidentList.append(incidentType) # Result is a list object with all the unique values of the inci_type field del row arcpy.AddWarning("Made the list of incident types.") # Use the names in the list object to select records for name in incidentList: cityQuery = '"inciType" = \'' + name + '\'' arcpy.SelectLayerByAttribute_management ("tableView", "NEW_SELECTION", cityQuery) newTable = gdbName + "\\Oleander_Incident_" + "\\Bedford_Incident_"+"\\Fort_Worth_Incident_"+"\\Hurst_Incident_"+"\\Irving_Incident_"+ name.replace(" ","_") # CopyRows_management (in_rows, out_table, {config_keyword}) arcpy.CopyRows_management ("tableView", newTable) itemCount =int(arcpy.GetCount_management("tableView").getOutput(0)) arcpy.AddWarning("A table called " + newTable + " was created with " + str(itemCount) + " rows.") arcpy.AddWarning("Finished.") if inTable = "Oleander": elif "Bedford">= 600 elif "Worth" >=600 elif "Hurst" >= 600 else: "Irving">= 600 except arcpy.ExecuteError: print (arcpy.GetMessages(2)) except: print ("Process did not complete.")



أكثر...
 
أعلى