arcpy.Delete_management("templyr") # Process: Add XY Coordinates arcpy.AddXY_management(COCLayerOut) # Process: Summary Statistics... arcpy.AddMessage("Filtering Samples...") arcpy.Statistics_analysis(COCLayerOut, COCStats, COCFieldStat, "POINT_X;POINT_Y") arcpy.Delete_management(COCLayerOut) # Process: Make XY Event Layer... arcpy.MakeXYEventLayer_management(COCStats, "POINT_X", "POINT_Y", COCStatsLyr, SpatRef) arcpy.CopyFeatures_management(COCStatsLyr, COCFiltered) # Process: Capture geoprocessing history... history = ARD_HEA_Tools.get_process_history(currDir, COCStats) # Cleanup intermediate files # arcpy.Delete_management(COCStats) #Import metadata template... arcpy.AddMessage("Updating metadata...") arcpy.ImportMetadata_conversion(xmlTemp, "FROM_FGDC", COCFiltered) # arcpy.MetadataImporter_conversion(xmlTemp, COCFiltered) # Process: Average Nearest Neighbor... arcpy.AddMessage("\nDetermining Average Nearest Neighbor stats...") NNOutput = arcpy.AverageNearestNeighbor_stats(COCFiltered, "#", "#", "#") arcpy.AddMessage("The nearest neighbor index is: " + NNOutput.getOutput(0)) arcpy.AddMessage("The z-score of the nearest neighbor index is: " + NNOutput.getOutput(1)) arcpy.AddMessage("The p-value of the nearest neighbor index is: " + NNOutput.getOutput(2))
# arcpy.Exp_sa(maskOut, ExpOut) arcpy.Exp_sa(NNOut, ExpOut) MARaster = arcpy.Raster(ExpOut) / 1000 MARaster.save(outRaster) else: arcpy.AddMessage("Interpolating values...") arcpy.CopyFeatures_management(COCLayer, geoDB + "\\temp_data") arcpy.NaturalNeighbor_sa(geoDB + "\\temp_data", COCField, NNOut, NNCellSize) arcpy.Times_sa(NNOut, AnalysisGrid, maskOut) MARaster = arcpy.Raster(maskOut) * 1 # MARaster = arcpy.Raster(NNOut) * 1 MARaster.save(outRaster) # Process: Capture geoprocessing history... history = ARD_HEA_Tools.get_process_history(currDir, geoDB + "\\temp_data") if history is not None and history != "": history = history + ARD_HEA_Tools.get_process_history(currDir, outRaster) if history is not None and history != "": history = history + ARD_HEA_Tools.get_process_history(currDir, NNOut) # Process: Cleanup temp files.. arcpy.Delete_management(geoDB + "\\temp_data") arcpy.Delete_management(maskOut) arcpy.Delete_management(NNOut) arcpy.Delete_management(ExpOut) #Import metadata template arcpy.AddMessage("Updating metadata...") arcpy.ImportMetadata_conversion(xmlTemp, "FROM_FGDC", outRaster) # arcpy.MetadataImporter_conversion(xmlTemp, outRaster)
# Process: Delete Fields... arcpy.DeleteField_management(COCExtract, "RASTERVALU") # Process: Make Table View... filter_exp = "[COC_VALUE] >= 0" arcpy.TableToTable_conversion(COCExtract, geoDB, COCTable, filter_exp) # Process: Append to COC Data Table... arcpy.AddMessage("Updating table with " + COCName + " data...") InTable = geoDB + "\\" + COCTable arcpy.Append_management(InTable, geoDB + "\\COC_DATA", "NO_TEST") arcpy.Delete_management(InTable) # Process: Update Metadata Tables... history = ARD_HEA_Tools.get_process_history(currDir, COCExtract) rows = arcpy.UpdateCursor(COCInvent, "[COC_NAME] = '" + COCName + "'") row = rows.next() if row: if history is not None and history != "": xmltxt = row.COC_XML if xmltxt is not None: row.COC_XML = xmltxt + history else: row.COC_XML = history rows.updateRow(row) else: arcpy.AddMessage("\n***WARNING***\nError updating metadata record") del row del rows
arcpy.Delete_management("templyr") arcpy.AddMessage("Interpolating values...") arcpy.Idw_sa(geoDB + "\\temp_data", COCField, IDWOut, IDWCellSize, IDWPower, IDWRadius, IDWBarrier) arcpy.Exp_sa(IDWOut, ExpOut) MARaster = arcpy.Raster(ExpOut) / 1000 MARaster.save(outRaster) else: arcpy.AddMessage("Interpolating values...") arcpy.CopyFeatures_management(COCLayer, geoDB + "\\temp_data") arcpy.Idw_sa(geoDB + "\\temp_data", COCField, IDWOut, IDWCellSize, IDWPower, IDWRadius, IDWBarrier) MARaster = arcpy.Raster(IDWOut) * 1 MARaster.save(outRaster) # Process: Capture geoprocessing history... history = ARD_HEA_Tools.get_process_history(currDir, geoDB + "\\temp_data") if history is not None and history != "": history = history + ARD_HEA_Tools.get_process_history(currDir, IDWOut) # Process: Cleanup... arcpy.Delete_management(geoDB + "\\temp_data") arcpy.Delete_management(IDWOut) arcpy.Delete_management(ExpOut) #Import metadata template arcpy.AddMessage("Updating metadata...") arcpy.ImportMetadata_conversion(xmlTemp, "FROM_FGDC", outRaster) # arcpy.MetadataImporter_conversion(xmlTemp, outRaster) #Record process step in COC Table