source: anuga_work/production/australia_ph2/carnarvon/Arc_asc2raster_GDA94z50.py @ 7011

Last change on this file since 7011 was 7011, checked in by kristy, 15 years ago
File size: 3.2 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 = 0
23
24scenario_dir = "\\\\nas2\\gemd\\georisk_models\\inundation\\data\\australia_ph2\\carnarvon\\"
25output_dir="anuga\\outputs\\"
26
27time_dir1 = '20090504_114635_run_final_0_68754_84_Tb__mhingee'
28time_dir2 = '20090504_114715_run_final_0_70881_84_Tb__mhingee'
29time_dir3 = '20090505_100250_run_final_0_27285_84_Tb__mhingee'
30time_dir4 = '20090505_173023_run_final_0_27285_84_Tb_internal_mhingee'
31
32time_dirs = [time_dir1, time_dir2, time_dir3, time_dir4]
33 
34for time_dir in time_dirs:
35
36    # Local variables...
37    folder = scenario_dir + output_dir + time_dir +'\\'
38    raster_gbd = folder + 'raster.gdb'
39       
40##    print 'Process: Create File GDB'
41##    gp.CreateFileGDB_management(folder, "raster")
42
43    gp.Workspace = raster_gbd
44
45    print time_dir
46   
47    #replication dictionary
48    replicate = (('carnarvon', ''),('_', ''),
49                 ('depth','_depth'),('speed', '_speed'),
50                 ('elevation', '_ele_'), ('stage','_stage'))
51
52    generate_filename = []
53    input_ascii = glob.glob(folder + '*elevation.asc')
54
55    for infile in input_ascii:
56        output_DEM = os.path.basename(infile)[:-4]
57        for (key, rep) in replicate:
58            output_DEM = output_DEM.replace(key,rep)
59        output_DEM = output_DEM[:12]
60        if output_DEM in generate_filename:
61            print 'Output_DEM filename (%s) already in use' % output_DEM
62            sys.exit(10)
63        generate_filename.append(output_DEM)
64
65        print 'Output DEM ',output_DEM
66       
67        print 'Process: ASCII to Raster'
68        gp.ASCIIToRaster_conversion(infile, output_DEM, "FLOAT")
69
70        print 'Process: Define Projection' 
71        gp.DefineProjection_management(output_DEM, "PROJCS['CM_113.5',GEOGCS['GCS_GDA_1994',DATUM['D_GDA_1994',SPHEROID['GRS_1980',6378137.0,298.257222101]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]"
72                                                   ",PROJECTION['Transverse_Mercator'],PARAMETER['False_Easting',500000.0],PARAMETER['False_Northing',10000000.0],PARAMETER['Central_Meridian',113.5],PARAMETER['Scale_Factor',0.9996]"
73                                                   ",PARAMETER['Latitude_Of_Origin',0.0],UNIT['Meter',1.0]]")
74
Note: See TracBrowser for help on using the repository browser.