def insertcursorvalue (inputField, outputField, naValue): if rowJoin.getValue(inputField) is None or rowJoin.getValue(inputField) == " ": rowSite.setValue(outputField, naValue) elif len(str(rowJoin.getValue(inputField))) > 0: text = str(rowJoin.getValue(inputField)) rowSite.setValue(outputField, ARD_HEA_Tools.sanitizetext(text)) else: rowSite.setValue(outputField, naValue)
rows = arcpy.SearchCursor(usrTbl) row = rows.next() while row: valueList.append(row.getValue(field)) row = rows.next() uniqueSet = set(valueList) uniqueScen = list(uniqueSet) uniqueScen.sort() del rows del row arcpy.AddMessage("Scenarios with results: "+str(uniqueScen)) env.qualifiedFieldNames = "UNQUALIFIED" # Make a point layer for each scenario by copying ANALYSIS_POINTS and cursoring through results table for each grid cell for scen in uniqueScen: scname = ARD_HEA_Tools.sanitizetext(str(scen)) rows = arcpy.SearchCursor(scnTbl, "[Scenario_ID] = " + str(scen)) row = rows.next() while row: if row.getValue("Scenario_Name") is not None or row.getValue("Scenario_Name") != " ": text = row.getValue("Scenario_Name") scname = ARD_HEA_Tools.sanitizetext(str.upper(str(text))) row = rows.next() del rows del row #Setup temp and output files outTbl = geoDB + "\\SC" + str(scen) + "_" + scname + "_RESULT_TBL" if arcpy.Exists(outTbl): arcpy.Delete_management(outTbl) outPts = geoDB + "\\SC" + str(scen) + "_" + scname + "_RESULT_PNTS"
crow.FROM_VALUE = prevhigh crow.TO_VALUE = high crow.LABEL = int(perc) if not skipFlag: crows.insertRow(crow) recs = recs + 1 arcpy.AddMessage("Level: " + str(catList[cat])+" from: " + str(prevhigh) + " to: " + str(high) + " Pct Injury: " + str(perc) ) else: arcpy.AddMessage("Skipping level: "+ str(catList[cat])) del crow del crows # Process: Reclass contaminant... if not errFlag and recs > 0: arcpy.AddMessage("Reclassifying surface...\n") outRaster = geoDB + "\\" + ARD_HEA_Tools.sanitizetext(str.upper(str(row.COC_NAME))) + "_SC" + str(row.Scenario_ID) outPolygon = geoDB + "\\" + ARD_HEA_Tools.sanitizetext(str.upper(str(row.COC_NAME))) + "_SC" + str(row.Scenario_ID) + "_ZONE" if arcpy.Exists(outRaster): arcpy.Delete_management(outRaster) if arcpy.Exists(outPolygon): arcpy.Delete_management(outPolygon) arcpy.ReclassByTable_sa(inRaster, tmpTbl, "FROM_VALUE", "TO_VALUE", "LABEL", outRaster, "NODATA") arcpy.RasterToPolygon_conversion(outRaster, outPolygon, "SIMPLIFY") else: arcpy.AddMessage("Cannot reclass: " + row.COC_NAME + " for scenario: " + str(row.Scenario_ID)) arcpy.AddMessage("Missing or incorrect values in threshold table.\n") #Process: Remove temporary table used by reclass arcpy.Delete_management(tmpTbl) else: