# -*- coding: utf-8 -*- """ Generated by ArcGIS ModelBuilder on : 2021-02-02 17:52:23 """ import arcpy from sys import argv def Model(Input_Shapefile_Geomorphology_Dataset_Vorarlberg_): # Geomorph_Vorarlberg_model_Pro # To allow overwriting outputs change overwriteOutput option to True. arcpy.env.overwriteOutput = False # Model Environment settings with arcpy.EnvManager(outputCoordinateSystem="PROJCS['MGI_Austria_GK_West',GEOGCS['GCS_MGI',DATUM['D_MGI',SPHEROID['Bessel_1841',6377397.155,299.1528128]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Transverse_Mercator'],PARAMETER['False_Easting',0.0],PARAMETER['False_Northing',-5000000.0],PARAMETER['Central_Meridian',10.33333333333333],PARAMETER['Scale_Factor',1.0],PARAMETER['Latitude_Of_Origin',0.0],UNIT['Meter',1.0]]", scratchWorkspace=r"E:\_Geoinform\Harry\GeoMapping\Data_Multi_level_mapping_versie_13_11_2019\Au_Nov_2019\3. Geodatabases\ToolboxGDB.gdb", workspace=r"E:\_Geoinform\Harry\GeoMapping\Data_Multi_level_mapping_versie_13_11_2019\Au_Nov_2019\3. Geodatabases\ArcGIS Data Vorarlberg.gdb"): # Process: Add Tier 1 (Add Field) (management) Geomorphology_Vorarlberg_V2_6_ = arcpy.management.AddField(in_table=Input_Shapefile_Geomorphology_Dataset_Vorarlberg_, field_name="Tier_1", field_type="TEXT", field_precision=None, field_scale=None, field_length=None, field_alias="", field_is_nullable="NULLABLE", field_is_required="NON_REQUIRED", field_domain="")[0] # Process: Rename Tier 1 with Text Explanation (Calculate Field) (management) Geomorphology_Vorarlberg_V2_7_ = arcpy.management.CalculateField(in_table=Geomorphology_Vorarlberg_V2_6_, field="Tier_1", expression="Reclass(!Geomorph!)", expression_type="PYTHON3", code_block="""def Reclass(Geomorph): reclass = { \"1111\": \"1000 - Glacial\", \"1112\": \"1000 - Glacial\", \"1211\": \"1000 - Glacial\", \"1311\": \"1000 - Glacial\", \"1312\": \"1000 - Glacial\", \"1313\": \"1000 - Glacial\", \"1314\": \"1000 - Glacial\", \"2111\": \"2000 - Fluvial\", \"2211\": \"2000 - Fluvial\", \"2212\": \"2000 - Fluvial\", \"2213\": \"2000 - Fluvial\", \"2214\": \"2000 - Fluvial\", \"3111\": \"3000 - Mass movement\", \"3112\": \"3000 - Mass movement\", \"3211\": \"3000 - Mass movement\", \"3212\": \"3000 - Mass movement\", \"3213\": \"3000 - Mass movement\", \"4111\": \"4000 - Periglacial\", \"4211\": \"4000 - Periglacial\", \"5111\": \"5000 - Organic\", \"6111\": \"6000 - Karst\", \"6211\": \"6000 - Karst\", \"6212\": \"6000 - Karst\", \"6213\": \"6000 - Karst\", \"6214\": \"6000 - Karst\", \"6215\": \"6000 - Karst\", \"7111\": \"7000 - Aeolian\", \"8111\": \"8000 - Water\", \"8112\": \"8000 - Water\", \"8113\": \"8000 - Water\", \"8114\": \"8000 - Water\", \"9111\": \"9000 - Settlements and infrastructure\", \"9112\": \"9000 - Settlements and infrastructure\",} return reclass.get(Geomorph)""", field_type="TEXT")[0] # Process: Add Tier 2 (Add Field) (management) Geomorphology_Vorarlberg_V2_4_ = arcpy.management.AddField(in_table=Geomorphology_Vorarlberg_V2_7_, field_name="Tier_2", field_type="TEXT", field_precision=None, field_scale=None, field_length=None, field_alias="", field_is_nullable="NULLABLE", field_is_required="NON_REQUIRED", field_domain="")[0] # Process: Rename Tier 2 with Text Explanation (Calculate Field) (management) Geomorphology_Vorarlberg_V2_5_ = arcpy.management.CalculateField(in_table=Geomorphology_Vorarlberg_V2_4_, field="Tier_2", expression="Reclass(!Geomorph!)", expression_type="PYTHON3", code_block="""def Reclass(Geomorph): reclass = { \"1111\": \"1100 - Glacial - Erosion\", \"1112\": \"1100 - Glacial - Erosion\", \"1211\": \"1200 - Glacial - (Glacio)fluvial erosion\", \"1311\": \"1300 - Glacial - Accumulation\", \"1312\": \"1300 - Glacial - Accumulation\", \"1313\": \"1300 - Glacial - Accumulation\", \"1314\": \"1300 - Glacial - Accumulation\", \"2111\": \"2100 - Fluvial - Erosion\", \"2211\": \"2200 - Fluvial - Accumulation\", \"2212\": \"2200 - Fluvial - Accumulation\", \"2213\": \"2200 - Fluvial - Accumulation\", \"2214\": \"2200 - Fluvial - Accumulation\", \"3111\": \"3100 - Mass movement - Degradation\", \"3112\": \"3100 - Mass movement - Degradation\", \"3211\": \"3200 - Mass movement - Accumulation\", \"3212\": \"3200 - Mass movement - Accumulation\", \"3213\": \"3200 - Mass movement - Accumulation\", \"4111\": \"4100 - Periglacial - Disintegration\", \"4211\": \"4200 - Periglacial - Accumulation\", \"5111\": \"5100 - Organic\", \"6111\": \"6100 - Carbonate karst\", \"6211\": \"6200 - Sulphate karst\", \"6212\": \"6200 - Sulphate karst\", \"6213\": \"6200 - Sulphate karst\", \"6214\": \"6200 - Sulphate karst\", \"6215\": \"6200 - Sulphate karst\", \"7111\": \"7100 - Aeolian\", \"8111\": \"8100 - Water\", \"8112\": \"8100 - Water\", \"8113\": \"8100 - Water\", \"8114\": \"8100 - Water\", \"9111\": \"9100 - Settlements and infrastructure\", \"9112\": \"9100 - Settlements and infrastructure\", } return reclass.get(Geomorph)""", field_type="TEXT")[0] # Process: Add Tier 3 (Add Field) (management) Geomorphology_Vorarlberg_V2_3_ = arcpy.management.AddField(in_table=Geomorphology_Vorarlberg_V2_5_, field_name="Tier_3", field_type="TEXT", field_precision=None, field_scale=None, field_length=None, field_alias="", field_is_nullable="NULLABLE", field_is_required="NON_REQUIRED", field_domain="")[0] # Process: Rename Tier 3 with Text Explanation (Calculate Field) (management) Geomorphology_Vorarlberg_V2_2_ = arcpy.management.CalculateField(in_table=Geomorphology_Vorarlberg_V2_3_, field="Tier_3", expression="Reclass(!Geomorph!)", expression_type="PYTHON3", code_block="""def Reclass(Geomorph): reclass = { \"1111\": \"1111 - Glacially eroded bedrock\", \"1112\": \"1112 - Glacially eroded Quaternary deposits\", \"1211\": \"1211 - (Glacio)fluvial erosion\", \"1311\": \"1311 - Subglacial tills\", \"1312\": \"1312 - Ablation tills\", \"1313\": \"1313 - (Glacio)fluvial deposits\", \"1314\": \"1314- Lake deposits\", \"2111\": \"2111 - Incision; slope subject to strong fluvial erosion\", \"2211\": \"2211 - (Sub)recent streambed\", \"2212\": \"2212 - Fluvial terrace (incl. small escarpment)\", \"2213\": \"2213 - Alluvial fan, debris fan (incl. terrace)\", \"2214\": \"2214 - Lake deposits\", \"3111\": \"3111 - Deep-seated mass movement\", \"3112\": \"3112 - Shallow mass movement (degradation)\", \"3211\": \"3211 - Fall deposits\", \"3212\": \"3212 - Flow and/or slide deposits\", \"3213\": \"3213 - Protalus rampart\", \"4111\": \"4111 - Surface subject to disintegration\", \"4211\": \"4211 - Rock glacier\", \"5111\": \"5111 - Peat deposits\", \"6111\": \"6111 - Surface strongly affected by carbonate karst\", \"6211\": \"6211 - Surface strongly affected by sulphate (gypsum) karst\", \"6212\": \"6212 - Covered gypsum karst (glacial deposits)\", \"6213\": \"6213 - Covered gypsum karst (slope deposits)\", \"6214\": \"6214 - Collapse structure due to gypsum karst\", \"6215\": \"6215 - Breccia exposure\", \"7111\": \"7111 - Aeolian deposits\", \"8111\": \"8111 - Lake and its fill\", \"8112\": \"8112 - Wide river\", \"8113\": \"8113 - Reservoir and its fill\", \"8114\": \"8114 - Glacier\", \"9111\": \"9111 - Graded or leveled land\", \"9112\": \"9112 - Pits and quarries\", } return reclass.get(Geomorph)""", field_type="TEXT")[0] # Process: Delete unnecessary fields (Delete Field) (management) Geomorphology_Vorarlberg_V2 = arcpy.management.DeleteField(in_table=Geomorphology_Vorarlberg_V2_2_, drop_field=["Geomorph"])[0] if __name__ == '__main__': Model(*argv[1:])