source: anuga_work/production/australia_ph2/melbourne_east/single_urs/Arc_asc2raster_GDA94z50.py @ 7023

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

exporting results;
making new folder in melbourne_east called single_urs, for scripts to run the model with both east and west boundaries from urs

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
24scenario_dir = "\\\\nas2\\gemd\\georisk_models\\inundation\\data\\australia_ph2\\melbourne\\"
25output_dir="anuga\\outputs\\"
26
27##time_dir1 = '20090417_151345_run_final_0_58115_2649_Tb_east__kvanputt'
28##time_dir2 = '20090416_103113_run_final_0_51449_2649_Tb_east__kvanputt'
29##time_dir3 = '20090421_152343_run_final_0_31853_2649_Tb_east__kvanputt'
30##time_dir4 = '20090416_102418_run_final_0_58348_1979_Tb_west__kvanputt'
31##time_dir5 = '20090421_151342_run_final_0_64288_1979_Tb_west__kvanputt'
32##time_dir6 = '20090426_042056_run_final_0_68793_1979_Tb_west__kvanputt'
33
34time_dir7 = '20090511_145103_run_trial_0_31853_2649_Tb_both__mhingee'
35
36##time_dirs = [time_dir1, time_dir2, time_dir3, time_dir4, time_dir5, time_dir7]
37time_dirs = [time_dir7]
38   
39for time_dir in time_dirs:
40    # Local variables...
41    folder = scenario_dir + output_dir +  time_dir +'\\'
42    raster_gbd = folder + 'raster.gdb'
43##    land = scenario_dir + "map_work\\\port_hedland.gdb\\outlines\\initial_condition"
44##    ocean = scenario_dir + "map_work\\\port_hedland.gdb\\outlines\\initial_conditions_ocean"
45
46    print 'Process: Create File GDB'
47    gp.CreateFileGDB_management(folder, "raster")
48
49    gp.Workspace = raster_gbd
50
51    print gp.Workspace
52   
53    #replication dictionary
54    replicate = (('melbourne', ''),('_', ''),('max','_M'),
55                 ('CBD', 'CDB'),('All',''),
56                 ('depth','_depth'),('speed', '_speed'),
57                 ('elevation', '_ele_'), ('stage','_stage'))
58
59    generate_filename = []
60    input_ascii = glob.glob(folder + '*.asc')
61
62    for infile in input_ascii:
63        output_DEM = os.path.basename(infile)[:-4]
64        for (key, rep) in replicate:
65            output_DEM = output_DEM.replace(key,rep)
66        output_DEM = output_DEM[:10]
67        if output_DEM in generate_filename:
68            print 'Output_DEM filename (%s) already in use' % output_DEM
69            sys.exit(10)
70        generate_filename.append(output_DEM)
71
72        print 'Output DEM ',output_DEM
73       
74        print 'Process: ASCII to Raster'
75        gp.ASCIIToRaster_conversion(infile, output_DEM, "FLOAT")
76
77        print 'Process: Define Projection'
78## GDA_1994_MGA_Zone_55       
79        gp.DefineProjection_management(output_DEM, "PROJCS['CM_146',GEOGCS['GCS_GDA_1994',DATUM['D_GDA_1994',SPHEROID['GRS_1980',6378137.0,298.257222101]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]"
80                                                   ",PROJECTION['Transverse_Mercator'],PARAMETER['False_Easting',500000.0],PARAMETER['False_Northing',10000000.0],PARAMETER['Central_Meridian',146.0],PARAMETER['Scale_Factor',0.9996]"
81                                                   ",PARAMETER['Latitude_Of_Origin',0.0],UNIT['Meter',1.0]]")
82##        output_extract = output_DEM + 'E'
83##        print 'Output Extract ',output_extract
84##        print 'Process: Extract by Mask'
85##        gp.ExtractByMask_sa(output_DEM, land, output_extract)
86
87
Note: See TracBrowser for help on using the repository browser.