# -*- coding: utf-8 -*- # This script was automatically generated via ArcGis by exporting the model 'to # Python Script'. Filepaths were replaced by exemplary filepaths, which the user # needs to define. # --------------------------------------------------------------------------- # ArcGis-Zr-polygon-model.py # Created on: 2021-09-09 15:57:42.00000 # (generated by ArcGIS/ModelBuilder) # Description: # --------------------------------------------------------------------------- # Set the necessary product code # import arcinfo # Import arcpy module import arcpy # Local variables: TR3_csv__2_ = "C:\\folder\\INPUT.csv" sampleID_total_thin_section = "sampleID_total_thin-section" sampleID_zircon = "C:\\folder\\Model_Zr-polygons.gdb\\sampleID_zircon" sampleID_zircon_tbl = sampleID_zircon sampleID_zircon_p = "C:\\folder\\Model_Zr-polygons.gdb\\sampleID_zircon_p" storage = sampleID_zircon_p sampleID_zircon_p1new = sampleID_zircon_p sampleID_zircon_p2new = sampleID_zircon_p1new RESULT_sampleID = sampleID_zircon_p2new Model_Zr_polygons_gdb = "C:\\folder\\Model.gdb" # Process: Make XY Event Layer tempEnvironment0 = arcpy.env.XYResolution arcpy.env.XYResolution = "" tempEnvironment1 = arcpy.env.XYTolerance arcpy.env.XYTolerance = "" arcpy.MakeXYEventLayer_management(INPUT, "Field2", "Field1", sampleID_total_thin_section, "{B286C06B-0879-11D2-AACA-00C04FA33C20};-1571 -1248 10000;-100000 10000;-100000 10000;0.001;0.001;0.001;IsHighPrecision", "") arcpy.env.XYResolution = tempEnvironment0 arcpy.env.XYTolerance = tempEnvironment1 # Process: Select arcpy.Select_analysis(sampleID_total_thin_section, sampleID_zircon, "\"Field3\" = 'Zircon'") # Process: Aggregate Points tempEnvironment0 = arcpy.env.autoCommit arcpy.env.autoCommit = "1000" tempEnvironment1 = arcpy.env.compression arcpy.env.compression = "LZ77" tempEnvironment2 = arcpy.env.rasterStatistics arcpy.env.rasterStatistics = "STATISTICS 1 1" tempEnvironment3 = arcpy.env.transferDomains arcpy.env.transferDomains = "false" tempEnvironment4 = arcpy.env.maintainAttachments arcpy.env.maintainAttachments = "true" tempEnvironment5 = arcpy.env.resamplingMethod arcpy.env.resamplingMethod = "NEAREST" tempEnvironment6 = arcpy.env.configKeyword arcpy.env.configKeyword = "" tempEnvironment7 = arcpy.env.qualifiedFieldNames arcpy.env.qualifiedFieldNames = "true" tempEnvironment8 = arcpy.env.tileSize arcpy.env.tileSize = "128 128" tempEnvironment9 = arcpy.env.pyramid arcpy.env.pyramid = "PYRAMIDS -1 NEAREST DEFAULT 75 NO_SKIP" tempEnvironment10 = arcpy.env.nodata arcpy.env.nodata = "NONE" arcpy.AggregatePoints_cartography(sampleID_zircon, sampleID_zircon_p, "3 Points") arcpy.env.autoCommit = tempEnvironment0 arcpy.env.compression = tempEnvironment1 arcpy.env.rasterStatistics = tempEnvironment2 arcpy.env.transferDomains = tempEnvironment3 arcpy.env.maintainAttachments = tempEnvironment4 arcpy.env.resamplingMethod = tempEnvironment5 arcpy.env.configKeyword = tempEnvironment6 arcpy.env.qualifiedFieldNames = tempEnvironment7 arcpy.env.tileSize = tempEnvironment8 arcpy.env.pyramid = tempEnvironment9 arcpy.env.nodata = tempEnvironment10 # Process: Add Field arcpy.AddField_management(sampleID_zircon_p, "Mineral", "TEXT", "20", "", "20", "", "NULLABLE", "NON_REQUIRED", "") # Process: Calculate Field arcpy.CalculateField_management(sampleID_zircon_p1new, "Mineral", "updateValue(!Mineral!)", "PYTHON_9.3", "def updateValue(value):\\n if value == None:\\n return 'Zircon'\\n else: return value") # Process: Create Feature Class arcpy.CreateFeatureclass_management(Model_Zr_polygons_gdb, "storage", "POLYLINE", "'C:\\Model_Zr-polygons.gdb\\sampleID_zircon_p'", "SAME_AS_TEMPLATE", "DISABLED", "{B286C06B-0879-11D2-AACA-00C04FA33C20};IsHighPrecision", "", "0", "0", "0") # Process: Append arcpy.Append_management("'C:\\folder\\Model_Zr-polygons.gdb\\sampleID_zircon_p'", storage, "TEST", "", "")