1 | # --------------------------------------------------------------------------- |
---|
2 | # Inundation_line.py |
---|
3 | # Created on: Tue May 12 2009 01:50:45 PM |
---|
4 | # (generated by ArcGIS/ModelBuilder) |
---|
5 | # Usage: Inundation_line <Bun_depth_M_E> <Bus_depth_M_E> <bunbury_1km> <busselton_1km> |
---|
6 | # --------------------------------------------------------------------------- |
---|
7 | |
---|
8 | # Import system modules |
---|
9 | import sys, string, os, arcgisscripting, glob |
---|
10 | |
---|
11 | # Create the Geoprocessor object |
---|
12 | gp = arcgisscripting.create() |
---|
13 | gp.overwriteoutput = 1 |
---|
14 | |
---|
15 | # Set the necessary product code |
---|
16 | gp.SetProduct("ArcInfo") |
---|
17 | |
---|
18 | # Check out any necessary licenses |
---|
19 | gp.CheckOutExtension("spatial") |
---|
20 | |
---|
21 | # Load required toolboxes... |
---|
22 | gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Spatial Analyst Tools.tbx") |
---|
23 | gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Conversion Tools.tbx") |
---|
24 | gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Data Management Tools.tbx") |
---|
25 | gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Analysis Tools.tbx") |
---|
26 | |
---|
27 | # Script arguments... |
---|
28 | time_dir1 = '20090324_134442_run_final_1_27255_Bt_kvanputt' |
---|
29 | time_dir2 = '20090324_154738_run_final_1_27283_Bt_kvanputt' |
---|
30 | time_dir3 = '20090324_154824_run_final_1_68693_Bt_kvanputt' |
---|
31 | time_dir4 = '20090327_154730_run_final_0_68693_Bt_kvanputt' |
---|
32 | time_dir5 = '20090327_154824_run_final_0_27255_Bt_kvanputt' |
---|
33 | time_dir6 = '20090327_160753_run_final_0_27283_Bt_kvanputt' |
---|
34 | |
---|
35 | time_dirs = [time_dir1, time_dir2, time_dir3, time_dir4, time_dir5, time_dir6] |
---|
36 | |
---|
37 | community = 'carnarvon' |
---|
38 | scenario = "\\\\nas2\\gemd\\georisk_models\\inundation\\data\\western_australia\\" + community +"_tsunami_scenario\\" |
---|
39 | output_folder = scenario + "anuga\\outputs\\" |
---|
40 | location = 'CBD' |
---|
41 | extent = scenario + "map_work\\Carnarvon.gdb\\Polygon\\Carnarvon5m_clip" |
---|
42 | depth = 'CBD_dep__M_E' |
---|
43 | |
---|
44 | for time_dir in time_dirs: |
---|
45 | |
---|
46 | raster = output_folder + time_dir + "\\raster.gdb\\" |
---|
47 | print 'location', location |
---|
48 | print 'extent', extent |
---|
49 | |
---|
50 | # Local variables... |
---|
51 | Output_raster = raster +"Temp_raster_"+ location |
---|
52 | Output_polygon_features = raster +"Temp_polygon_"+ location |
---|
53 | Output_Feature_Class = raster +"Temp_line_"+ location |
---|
54 | Reclassification = "0 0.05 NODATA;0.05 4.5840001106262207 1" |
---|
55 | Inundation = raster + "Inundation_" + location + "_polygon" |
---|
56 | depth_loc = raster + depth |
---|
57 | |
---|
58 | print 'Process: Reclassify' |
---|
59 | gp.Reclassify_sa(depth_loc, "Value", Reclassification, Output_raster, "DATA") |
---|
60 | |
---|
61 | print 'Process: Raster to Polygon' |
---|
62 | gp.RasterToPolygon_conversion(Output_raster, Output_polygon_features, "SIMPLIFY", "VALUE") |
---|
63 | |
---|
64 | print 'Process: Clip' |
---|
65 | gp.Clip_analysis(Output_polygon_features, extent, Inundation, "") |
---|
66 | |
---|
67 | print 'Process: Delete' |
---|
68 | gp.Delete_management(Output_raster, "RasterDataset") |
---|
69 | gp.Delete_management(Output_polygon_features, "FeatureClass") |
---|