source: anuga_work/production/hobart_2009/Arc_asc2raster_GDA94z55.py @ 7083

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

Arc scripts updated

File size: 3.9 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
24model = 'hobart'
25scenario_dir="\\\\nas2\\gemd\\georisk_models\\inundation\\data\\tasmania\\" + model + "_tsunami_scenario_2009\\"
26output_dir = "anuga\\outputs\\"
27
28time_dir1 = '20090505_150430_run_final_0.8_58292_None_kvanputt'
29time_dir2 = '20090505_150517_run_final_0_58292_None_kvanputt'
30time_dir3 = '20090505_150711_run_final_0_58280_None_kvanputt'
31time_dir4 = '20090505_150805_run_final_0.8_58280_None_kvanputt'
32time_dir5 = '20090505_151322_run_final_0.8_64477_None_kvanputt'
33time_dir6 = '20090505_151447_run_final_0_64477_None_kvanputt'
34
35time_dirs = [time_dir1] #, time_dir2, time_dir3, time_dir4, time_dir5, time_dir6]
36 
37for time_dir in time_dirs:
38    # Local variables...
39    folder = scenario_dir + output_dir + time_dir + '\\'
40    raster_gbd = folder + 'raster.gdb'
41    land_folder = scenario_dir + "ArcGIS\\data.gdb\\Land"
42    areas = ['Hobart', 'NW', 'South']
43    print time_dir
44
45##    print 'Process: Create File GDB'
46##    gp.CreateFileGDB_management(folder, "raster")
47
48    gp.Workspace = raster_gbd
49
50    for area in areas:
51        #replication dictionary
52        replicate = (('hobart', ''), ('fitting_problem', ''),
53                     ('_', ''), ('max','_M'), ('depth','_depth'),
54                     ('speed', '_speed_'), ('elevation', '_ele_'), ('stage','_stage'))
55
56        generate_filename = []
57
58        infile = folder + model + '_' + area + '_elevation.asc'
59               
60        output_DEM = os.path.basename(infile)[:-4]
61        for (key, rep) in replicate:
62            output_DEM = output_DEM.replace(key,rep)
63        output_DEM = output_DEM[:16]
64        if output_DEM in generate_filename:
65            print 'Output_DEM filename (%s) already in use' % output_DEM
66            sys.exit(10)
67        generate_filename.append(output_DEM)
68        print 'Output DEM ',output_DEM
69       
70        print 'Process: ASCII to Raster'
71        gp.ASCIIToRaster_conversion(infile, output_DEM, "FLOAT")
72
73        print 'Process: Define Projection' 
74        gp.DefineProjection_management(output_DEM,"PROJCS['GDA_1994_MGA_Zone_55',GEOGCS['GCS_GDA_1994',DATUM['D_GDA_1994'"
75                                       ",SPHEROID['GRS_1980',6378137.0,298.257222101]],PRIMEM['Greenwich',0.0]"
76                                       ",UNIT['Degree',0.0174532925199433]],PROJECTION['Transverse_Mercator']"
77                                       ",PARAMETER['False_Easting',500000.0],PARAMETER['False_Northing',10000000.0]"
78                                       ",PARAMETER['Central_Meridian',147.0],PARAMETER['Scale_Factor',0.9996]"
79                                       ",PARAMETER['Latitude_Of_Origin',0.0],UNIT['Meter',1.0]]")
80
81        land = land_folder + '_' + area
82        print 'Process: Extract by Mask'
83        output_extract = output_DEM + '_E'
84        print 'Output Extract ',output_extract
85        gp.ExtractByMask_sa(output_DEM, land, output_extract)
86
87
Note: See TracBrowser for help on using the repository browser.