source: anuga_work/production/busselton/Arc_asc2raster_GDA94z50.py @ 6392

Last change on this file since 6392 was 6201, checked in by kristy, 16 years ago

Updating scripts

File size: 4.1 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 (GDA94z50) 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\\western_australia\\busselton_tsunami_scenario\\"
25output_dir="anuga\\outputs\\"
26
27##time_dir1 = '20081209_155610_run_final_0_27255_250m_none_lfountai'
28##time_dir2 = '20081209_160607_run_final_0_68693_250m_none_lfountai'
29
30##time_dir1 = '20081002_111432_run_final_0_27283_250m_none_kvanputt'
31##time_dir2 = '20081217_115336_run_final_0_27283_250m_none_dp_kvanputt'
32
33
34time_dir1 = '20081211_154006_run_final_0.6_27255_alpha0.1_kvanputt'
35####time_dir2 = '20081211_162311_run_final_0_27255_alpha0.1_kvanputt'
36####time_dir3 = '20081211_162346_run_final_0_68693_alpha0.1_kvanputt'
37##time_dir4 = '20081211_162433_run_final_0.6_68693_alpha0.1_kvanputt'
38##time_dir5 = '20081211_162656_run_final_0.6_27283_alpha0.1_kvanputt'
39##time_dir6 = '20081211_162744_run_final_0_27283_alpha0.1_kvanputt'
40
41time_dirs = [time_dir1] #, time_dir2] #4, time_dir5] #, time_dir3, time_dir4, time_dir5, time_dir6]
42 
43for time_dir in time_dirs:
44
45    # Local variables...
46    folder = scenario_dir + output_dir + time_dir +'\\'
47    raster_gbd = folder + 'raster.gdb'
48    land = scenario_dir + "map_work\\Busselton.gdb\\Internal_polygons\\initial_conditions_extend_Di"
49    ocean = scenario_dir + "map_work\\Busselton.gdb\\input_boundaries\\Ocean"
50
51   
52    #print 'Process: Create File GDB'
53    #gp.CreateFileGDB_management(folder, "raster")
54
55    gp.Workspace = raster_gbd
56
57    print time_dir
58   
59    #replication dictionary
60    replicate = (('busselton', ''),('_', ''),('max','_M_5'),
61                 ('Busselton', 'Bus'),('Bunbury', 'Bun'),
62                 ('depth','_depth'),('speed', '_speed'),
63                 ('elevation', '_ele_'), ('stage','_stage'))
64
65    generate_filename = []
66    input_ascii = glob.glob(folder + '*Bunbury_depth_max.asc')
67
68    for infile in input_ascii:
69        output_DEM = os.path.basename(infile)[:-4]
70        for (key, rep) in replicate:
71            output_DEM = output_DEM.replace(key,rep)
72        output_DEM = output_DEM[:12]
73        if output_DEM in generate_filename:
74            print 'Output_DEM filename (%s) already in use' % output_DEM
75            sys.exit(10)
76        generate_filename.append(output_DEM)
77
78        print 'Output DEM ',output_DEM
79       
80        print 'Process: ASCII to Raster'
81        gp.ASCIIToRaster_conversion(infile, output_DEM, "FLOAT")
82
83        print 'Process: Define Projection' 
84        gp.DefineProjection_management(output_DEM, "PROJCS['GDA_1994_MGA_Zone_50',GEOGCS['GCS_GDA_1994',DATUM['D_GDA_1994',SPHEROID['GRS_1980',6378137.0,298.257222101]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]"
85                                                   ",PROJECTION['Transverse_Mercator'],PARAMETER['False_Easting',500000.0],PARAMETER['False_Northing',10000000.0],PARAMETER['Central_Meridian',117.0],PARAMETER['Scale_Factor',0.9996]"
86                                                   ",PARAMETER['Latitude_Of_Origin',0.0],UNIT['Meter',1.0]]")
87        output_extract = output_DEM + '_E'
88        print 'Output Extract ',output_extract
89        print 'Process: Extract by Mask'
90        gp.ExtractByMask_sa(output_DEM, land, output_extract)
91
92
Note: See TracBrowser for help on using the repository browser.