source: anuga_work/production/perth/perth_rerun/Inundation_polygon.py @ 7113

Last change on this file since 7113 was 7113, checked in by kristy, 15 years ago
File size: 4.0 KB
Line 
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
9import sys, string, os, arcgisscripting, glob
10
11# Create the Geoprocessor object
12gp = arcgisscripting.create()
13gp.overwriteoutput = 1
14
15# Set the necessary product code
16gp.SetProduct("ArcInfo")
17
18# Check out any necessary licenses
19gp.CheckOutExtension("spatial")
20
21# Load required toolboxes...
22gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Spatial Analyst Tools.tbx")
23gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Conversion Tools.tbx")
24gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Data Management Tools.tbx")
25gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Analysis Tools.tbx")
26
27# Script arguments...
28time_dir1 = '20090324_135427_run_final_0.6_27255_Bt_kvanputt'
29time_dir2 = '20090324_154957_run_final_0.6_68693_Bt_kvanputt'
30time_dir3 = '20090324_155028_run_final_0.6_27283_Bt_kvanputt'
31time_dir4 = '20090327_155353_run_final_0_27283_Bt_kvanputt'
32time_dir5 = '20090327_155659_run_final_0_27255_Bt_kvanputt'
33time_dir6 = '20090327_155803_run_final_0_68693_Bt_kvanputt'
34
35time_dirs = [time_dir1, time_dir2, time_dir3, time_dir4, time_dir5, time_dir6] 
36
37community = 'perth'
38scenario = "\\\\nas2\\gemd\\georisk_models\\inundation\\data\\western_australia\\" + community +"_tsunami_scenario\\"
39output_folder = scenario + "anuga\\outputs\\"
40locations = ['bunbury', 'busselton']
41
42locations = ['Fremantle', 'Rockingham', 'Geordie', 'Sorrento']
43
44for time_dir in time_dirs:
45
46    raster = output_folder + time_dir + "\\raster.gdb\\"
47   
48    for location in locations:
49
50        # Local variables...
51        if location == 'Fremantle':
52            # polygon clip
53            extent = scenario + "map_work\\Perth.gdb\\Internal_Polygons\\CBD_coastal_clip"
54            # name of rasters
55            depth = 'Fre_dep_M_E'
56           
57        elif location == 'Rockingham':
58            # polygon clip
59            extent = scenario + "map_work\\Perth.gdb\\Internal_Polygons\\rockingham_penguin_clip"
60            # name of rasters
61            depth = 'Roc_dep_M_E'
62           
63        elif location == 'Geordie':
64            # polygon clip
65            extent = scenario + "map_work\\Perth.gdb\\Internal_Polygons\\Geordie_Bay_clip"
66            # name of rasters
67            depth = 'Geo_dep_M_E'
68           
69        elif location == 'Sorrento':
70            # polygon clip
71            extent = scenario + "map_work\\Perth.gdb\\Internal_Polygons\\Sorrento_gauge_clip"
72            # name of rasters
73            depth = 'Sor_dep_M_E'
74           
75        else:
76            print 'No recognisable location entered'
77
78        print 'location', location
79        print 'extent', extent
80
81        depth_raster = depth
82
83        # Local variables...
84        Output_raster = raster +"Temp_raster_"+ location
85        Output_polygon_features = raster +"Temp_polygon_"+ location
86        Output_Feature_Class = raster +"Temp_line_"+ location
87        Reclassification = "0 0.05 NODATA;0.05 4.5840001106262207 1"
88        Inundation = raster + "Inundation_" + location + "_polygon"
89        Inundation_line = raster + "Inundation_line"
90        depth_loc = raster + depth
91       
92        print 'Process: Reclassify'
93        gp.Reclassify_sa(depth_loc, "Value", Reclassification, Output_raster, "DATA")
94       
95        print 'Process: Raster to Polygon'
96        gp.RasterToPolygon_conversion(Output_raster, Output_polygon_features, "SIMPLIFY", "VALUE")
97
98        print 'Process: Clip'
99        gp.Clip_analysis(Output_polygon_features, extent, Inundation, "")
100
101        print 'Process: Delete'
102        gp.Delete_management(Output_raster, "RasterDataset")
103        gp.Delete_management(Output_polygon_features, "FeatureClass")
Note: See TracBrowser for help on using the repository browser.