source: anuga_work/production/patong/asc2raster_WGS84z47N.py @ 6273

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

updating

File size: 3.5 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\\thailand\\patong_tsunami_scenario\\"
25output_dir="anuga\\outputs\\"
26
27
28time_dir1 = '20090130_135044_run_final_0.8_buildings_onielsen'
29time_dir2 = '20090123_135355_run_final_0.8_buildings_onielsen'
30
31time_dirs = [time_dir1] #, time_dir2]
32
33for time_dir in time_dirs:
34
35    # Local variables...
36    folder = scenario_dir + output_dir + time_dir + '\\'
37    raster_gbd = folder + 'raster.gdb'
38    land = scenario_dir + "map_work\\patong.gdb\\initial_conditions_Dissolve"
39   
40##    print 'Process: Create File GDB'
41##    gp.CreateFileGDB_management(folder, "raster")
42
43    gp.Workspace = raster_gbd
44
45    #print gp.Workspace
46   
47    #replication dictionary
48    replicate = (('patong', ''),('_', '') ,('depth','_dep_'),
49                 ('speed', '_spe_'), ('elevation', '_ele_'), ('stage','_sta_'))
50
51    generate_filename = []
52    input_ascii = glob.glob(folder + '*speed.asc')
53
54    for infile in input_ascii:
55        output_DEM = os.path.basename(infile)[:-4]
56        for (key, rep) in replicate:
57            output_DEM = output_DEM.replace(key,rep)
58        output_DEM = output_DEM[:10]
59        if output_DEM in generate_filename:
60            print 'Output_DEM filename (%s) already in use' % output_DEM
61            sys.exit(10)
62        generate_filename.append(output_DEM)
63        print 'Output DEM ',output_DEM
64       
65        print 'Process: ASCII to Raster'
66        gp.ASCIIToRaster_conversion(infile, output_DEM, "FLOAT")
67
68        print 'Process: Define Projection' 
69        gp.DefineProjection_management(output_DEM, "PROJCS['WGS_1984_UTM_Zone_47N',GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984'"
70                                                   ",SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0]"
71                                                   ",UNIT['Degree',0.0174532925199433]],PROJECTION['Transverse_Mercator']"
72                                                   ",PARAMETER['False_Easting',500000.0],PARAMETER['False_Northing',0.0]"
73                                                   ",PARAMETER['Central_Meridian',99.0],PARAMETER['Scale_Factor',0.9996]"
74                                                   ",PARAMETER['Latitude_Of_Origin',0.0],UNIT['Meter',1.0]]")
75
76##        output_extract = output_DEM + 'E'
77##        print 'Output Extract ',output_extract
78##        print 'Process: Extract by Mask'
79##        gp.ExtractByMask_sa(output_DEM, land, output_extract)
80
81
Note: See TracBrowser for help on using the repository browser.