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 = '20090505_150430_run_final_0.8_58292_None_kvanputt' |
---|
29 | time_dir2 = '20090505_150517_run_final_0_58292_None_kvanputt' |
---|
30 | time_dir3 = '20090505_150711_run_final_0_58280_None_kvanputt' |
---|
31 | time_dir4 = '20090505_150805_run_final_0.8_58280_None_kvanputt' |
---|
32 | time_dir5 = '20090505_151322_run_final_0.8_64477_None_kvanputt' |
---|
33 | time_dir6 = '20090505_151447_run_final_0_64477_None_kvanputt' |
---|
34 | |
---|
35 | time_dirs = [time_dir1, time_dir2, time_dir3, time_dir4, time_dir5, time_dir6] |
---|
36 | |
---|
37 | community = 'hobart' |
---|
38 | scenario = "\\\\nas2\\gemd\\georisk_models\\inundation\\data\\tasmania\\" + community +"_tsunami_scenario_2009\\" |
---|
39 | output_folder = scenario + "anuga\\outputs\\" |
---|
40 | |
---|
41 | |
---|
42 | for time_dir in time_dirs: |
---|
43 | print "time_dir = ",time_dir |
---|
44 | raster = output_folder + time_dir + "\\raster.gdb\\" |
---|
45 | |
---|
46 | # Local variables... |
---|
47 | locations = ['Hobart', 'NW', 'South'] |
---|
48 | # polygon clip |
---|
49 | extent = scenario + "ArcGIS\\data.gdb\\PriorityAreasHobart" |
---|
50 | # name of rasters |
---|
51 | for location in locations: |
---|
52 | depth = raster + location +'_depth_M_E' |
---|
53 | depth_raster = depth |
---|
54 | |
---|
55 | # Local variables... |
---|
56 | Output_raster = raster +"Temp_raster_"+ location |
---|
57 | Output_polygon_features = raster +"Temp_polygon_"+ location |
---|
58 | Output_Feature_Class = raster +"Temp_line_"+ location |
---|
59 | Reclassification = "0 0.05 NODATA;0.05 4.5840001106262207 1" |
---|
60 | Inundation = raster + "Inundation_" + location + "_polygon" |
---|
61 | Inundation_line = raster + "Inundation_line" |
---|
62 | |
---|
63 | print 'Process: Reclassify' |
---|
64 | gp.Reclassify_sa(depth, "Value", Reclassification, Output_raster, "DATA") |
---|
65 | |
---|
66 | print 'Process: Raster to Polygon' |
---|
67 | gp.RasterToPolygon_conversion(Output_raster, Output_polygon_features, "SIMPLIFY", "VALUE") |
---|
68 | |
---|
69 | print 'Process: Clip' |
---|
70 | gp.Clip_analysis(Output_polygon_features, extent, Inundation, "") |
---|
71 | |
---|
72 | print 'Process: Delete' |
---|
73 | gp.Delete_management(Output_raster, "RasterDataset") |
---|
74 | gp.Delete_management(Output_polygon_features, "FeatureClass") |
---|
75 | |
---|