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

Last change on this file since 7855 was 7354, checked in by kristy, 16 years ago

Updated all scripts since new runs

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