source: anuga_work/production/australia_ph2/cairns/Arc_asc2raster_GDA94z50.py @ 6939

Last change on this file since 6939 was 6939, checked in by myall, 15 years ago

exporting stage and elevation and making rasters for GBR models

File size: 3.7 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\\australia_ph2\\cairns\\"
25output_dir="anuga\\outputs\\"
26
27time_dir1 = '20090408_153044_run_final_0_31975_2172_Tb__mhingee'
28time_dir2 = '20090408_223355_run_final_0_51469_2172_Tb__mhingee'
29time_dir3 = '20090409_055521_run_final_0_63737_2172_Tb__mhingee'
30
31time_dir4 = '20090421_140811_run_final_0_31975_2172_Tb_internal_lfountai'
32
33time_dirs = [time_dir1, time_dir2, time_dir3, time_dir4]
34##time_dirs = [time_dir2, time_dir3]
35
36for time_dir in time_dirs:
37    # Local variables...
38    folder = scenario_dir + output_dir +  time_dir +'\\'
39    raster_gbd = folder + 'raster.gdb'
40##    land = scenario_dir + "map_work\\\port_hedland.gdb\\outlines\\initial_condition"
41##    ocean = scenario_dir + "map_work\\\port_hedland.gdb\\outlines\\initial_conditions_ocean"
42
43    print 'Process: Create File GDB'
44    gp.CreateFileGDB_management(folder, "raster")
45
46    gp.Workspace = raster_gbd
47
48    print gp.Workspace
49   
50    #replication dictionary
51    replicate = (('cairns', ''),('_', ''),('max','_M'),
52                 ('CBD', 'CDB'),('All',''),
53                 ('depth','_depth'),('speed', '_speed'),
54                 ('elevation', 'ele_'), ('stage','_stage'))
55
56    generate_filename = []
57    input_ascii = glob.glob(folder + '*.asc')
58
59    for infile in input_ascii:
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[:10]
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
69        print 'Output DEM ',output_DEM
70       
71        print 'Process: ASCII to Raster'
72        gp.ASCIIToRaster_conversion(infile, output_DEM, "FLOAT")
73
74        print 'Process: Define Projection'
75        #GDA_1994_MGA_Zone_54
76        gp.DefineProjection_management(output_DEM, "PROJCS['GDA_1994_MGA_Zone_55',GEOGCS['GCS_GDA_1994',DATUM['D_GDA_1994',SPHEROID['GRS_1980',6378137.0,298.257222101]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]"
77                                                   ",PROJECTION['Transverse_Mercator'],PARAMETER['False_Easting',500000.0],PARAMETER['False_Northing',10000000.0],PARAMETER['Central_Meridian',147.0],PARAMETER['Scale_Factor',0.9996]"
78                                                   ",PARAMETER['Latitude_Of_Origin',0.0],UNIT['Meter',1.0]]")
79##        output_extract = output_DEM + 'E'
80##        print 'Output Extract ',output_extract
81##        print 'Process: Extract by Mask'
82##        gp.ExtractByMask_sa(output_DEM, land, output_extract)
83
84
Note: See TracBrowser for help on using the repository browser.