source: anuga_work/production/new_south_wales/batemans_bay/Arc_asc2raster_GDA94z56.py @ 7619

Last change on this file since 7619 was 7619, checked in by griffin, 14 years ago

Added extra probabilistic runs

File size: 4.8 KB
Line 
1# ---------------------------------------------------------------------------
2# This python script is an ArcGIS script that can only be run on a computer
3# with and ArcGIS licence and version 2.4.1 python.
4# This script is designed to read in .asc files and deliever rasters with
5# projection (GDA94z56) held in a file geodatabase (called raster)
6# written by Kristy Van Putten and Ross Wilson
7# ---------------------------------------------------------------------------
8
9# Import system modules
10import sys, string, os, arcgisscripting, glob, os.path
11
12# Create the Geoprocessor object
13gp = arcgisscripting.create()
14
15# Check out any necessary licenses
16gp.CheckOutExtension("spatial")
17
18# Load required toolboxes...
19gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Spatial Analyst Tools.tbx")
20gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Conversion Tools.tbx")
21gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Data Management Tools.tbx")
22gp.overwriteoutput = 1
23
24scenario_dir="\\\\nas2\\gemd\\georisk_models\\inundation\\data\\new_south_wales\\batemans_bay_tsunami_scenario_2009\\"
25output_dir = "anuga\\outputs\\"
26
27##time_dir1 = '20091223_101813_run_final_0.0_6157_jgriffin'
28##
29##time_dirs = [time_dir1]#, time_dir2, time_dir3, time_dir4, time_dir5]#, time_dir6, time_dir7, time_dir8, time_dir9]
30time_dirs =['20090422_162054_run_final_0.0_58368_jgriffin',
31            '20090422_162114_run_final_0.0_51436_jgriffin',
32            '20090520_144937_run_final_0.0_58272_jgriffin',
33            '20090520_145156_run_final_1.0_58272_jgriffin',
34            '20090520_145453_run_final_0.0_58115_jgriffin',
35            '20090520_145510_run_final_0.0_58129_jgriffin',
36            '20090520_145608_run_final_0.0_58226_jgriffin',
37            '20090520_145616_run_final_0.0_58284_jgriffin',
38            '20090520_145700_run_final_0.0_58286_jgriffin',
39            '20090525_093040_run_final_1.0_51445_jgriffin',
40            '20090528_143200_run_final_1.0_51204_jgriffin',
41            '20090528_143323_run_final_1.0_58346_jgriffin',
42            '20090528_153025_run_final_0.0_58346_jgriffin',
43            '20090528_153109_run_final_0.0_51204_jgriffin',
44            '20090529_143332_run_final_0.0_51378_jgriffin',
45            '20090529_143419_run_final_0.0_51077_jgriffin',
46            '20090529_143442_run_final_0.0_51347_jgriffin',
47            '20090529_143458_run_final_0.0_51292_jgriffin',
48            '20090529_143527_run_final_0.0_51424_jgriffin']
49
50for time_dir in time_dirs:
51
52    # Local variables...
53    folder =  scenario_dir + output_dir + time_dir + '\\'
54    raster_gbd = folder + 'raster.gdb'
55    #contour = raster_gbd + '\\contour_dep'
56    #land = scenario_dir + "map_work\\Perth.gdb\\Outlines\\initial_conditions_rottnest"
57    #ocean = scenario_dir + "map_work\\Perth.gdb\\Outlines\\initial_conditions_ocean1"
58   
59##    print 'Process: Create File GDB'
60##    gp.CreateFileGDB_management(folder, "raster")
61
62    gp.Workspace = raster_gbd
63
64    print gp.Workspace
65   
66    #replication dictionary
67    replicate = (('batemans_bay', ''),
68                 ('_', ''),('Geordie', 'Geo'),('Sorrento', 'Sor'), ('max','M_'),
69                 ('Fremantle', 'Fre'),('Rockingham', 'Roc'),('depth','_dep_'),
70                 ('speed', '_spe_'), ('elevation', '_ele_'), ('stage','_stage'))
71
72    generate_filename = []
73    input_ascii = glob.glob(folder + '*AOI_bed_shear_stress_max.asc')
74    print time_dir
75
76    for infile in input_ascii:
77        output_DEM = os.path.basename(infile)[:-4]
78        for (key, rep) in replicate:
79            output_DEM = output_DEM.replace(key,rep)
80        output_DEM = output_DEM[:10]
81        if output_DEM in generate_filename:
82            print 'Output_DEM filename (%s) already in use' % output_DEM
83            sys.exit(10)
84        generate_filename.append(output_DEM)
85        print 'Output DEM ',output_DEM
86       
87        print 'Process: ASCII to Raster'
88        gp.ASCIIToRaster_conversion(infile, output_DEM, "FLOAT")
89
90        print 'Process: Define Projection' 
91        gp.DefineProjection_management(output_DEM, "PROJCS['GDA_1994_MGA_Zone_56',GEOGCS['GCS_GDA_1994',DATUM['D_GDA_1994',SPHEROID['GRS_1980',6378137.0,298.257222101]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]"
92                                                   ",PROJECTION['Transverse_Mercator'],PARAMETER['False_Easting',500000.0],PARAMETER['False_Northing',10000000.0],PARAMETER['Central_Meridian',153.0],PARAMETER['Scale_Factor',0.9996]"
93                                                   ",PARAMETER['Latitude_Of_Origin',0.0],UNIT['Meter',1.0]]")
94
95
96   
97##        output_extract = output_DEM + 'E'
98##        print 'Output Extract ',output_extract
99####   
100##        print 'Process: Extract by Mask'
101##        gp.ExtractByMask_sa(output_DEM, land, output_extract)
102####
103##       
Note: See TracBrowser for help on using the repository browser.