source: anuga_work/production/geraldton/asc2raster_GDA94z50.py @ 6027

Last change on this file since 6027 was 6027, checked in by kristy, 15 years ago

general maintenance of scripts, added boundary to mesh in run_geraldton.py

File size: 3.4 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
24output_dir = "\\\\nas2\\gemd\\georisk_models\\inundation\\data\\western_australia\\"
25scenario_dir="geraldton_tsunami_scenario\\anuga\\outputs\\"
26
27
28time_dir1 = '20081117_141443_run_final_0.6_27283_alpha0.1_kvanputt'
29##time_dir2 = ''
30##time_dir3 = ''
31##time_dir4 = ''
32##time_dir5 = ''
33##time_dir6 = ''
34
35time_dirs = [time_dir1] #, time_dir2, time_dir3, time_dir4, time_dir5, time_dir6]
36 
37for time_dir in time_dirs:
38
39    # Local variables...
40    folder = output_dir + scenario_dir + time_dir +'\\'
41    raster_gbd = folder + 'raster.gdb'
42    land = scenario_dir + "map_work\\\Geraldton.gdb\\outlines\\Clip_Topography"
43
44    # Process: Create File GDB...
45    gp.CreateFileGDB_management(folder, "raster")
46
47    gp.Workspace = raster_gbd
48
49    #print gp.Workspace
50   
51    #replication dictionary
52    replicate = (('geraldton', ''),('_', ''),('max','M_'),
53                 ('CBD', 'CDB'),
54                 ('depth','_depth'),('speed', '_speed'),
55                 ('elevation', '_ele_'), ('stage','_sta_'))
56
57    generate_filename = []
58    input_ascii = glob.glob(folder + '*.asc')
59
60    for infile in input_ascii:
61        output_DEM = os.path.basename(infile)[:-4]
62        for (key, rep) in replicate:
63            output_DEM = output_DEM.replace(key,rep)
64        output_DEM = output_DEM[:10]
65        if output_DEM in generate_filename:
66            print 'Output_DEM filename (%s) already in use' % output_DEM
67            sys.exit(10)
68        generate_filename.append(output_DEM)
69
70        print 'Output DEM ',output_DEM
71        output_extract = output_DEM + 'E'
72##        print 'Output Extract ',output_extract
73       
74        print 'Process: ASCII to Raster'
75        gp.ASCIIToRaster_conversion(infile, output_DEM, "FLOAT")
76
77        print 'Process: Define Projection' 
78        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]]"
79                                                   ",PROJECTION['Transverse_Mercator'],PARAMETER['False_Easting',500000.0],PARAMETER['False_Northing',10000000.0],PARAMETER['Central_Meridian',117.0],PARAMETER['Scale_Factor',0.9996]"
80                                                   ",PARAMETER['Latitude_Of_Origin',0.0],UNIT['Meter',1.0]]")
81
82##        print 'Process: Extract by Mask'
83##        gp.ExtractByMask_sa(output_DEM, land, output_extract)
84
85
Note: See TracBrowser for help on using the repository browser.