Changeset 6032


Ignore:
Timestamp:
Nov 28, 2008, 11:54:56 AM (15 years ago)
Author:
kristy
Message:

general maintenance of scripts

Location:
anuga_work/production/perth
Files:
1 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • anuga_work/production/perth/asc2raster_GDA94z50.py

    r5943 r6032  
    1313gp = arcgisscripting.create()
    1414
     15# Check out any necessary licenses
     16gp.CheckOutExtension("spatial")
     17
    1518# Load required toolboxes...
     19gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Spatial Analyst Tools.tbx")
    1620gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Conversion Tools.tbx")
    1721gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Data Management Tools.tbx")
    1822gp.overwriteoutput = 1
    1923
    20 output_dir = "\\\\nas2\\gemd\\georisk_models\\inundation\\data\\western_australia\\"
    21 scenario_dir="perth_tsunami_scenario\\anuga\\outputs\\"
     24scenario_dir="\\\\nas2\\gemd\\georisk_models\\inundation\\data\\western_australia\\perth_tsunami_scenario\\"
     25output_dir = "anuga\\outputs\\"
    2226
    2327
    2428time_dir1 = '20081031_133353_run_final_0.6_68693_alpha0.1_kvanputt'
    25 time_dir2 = '20081031_133511_run_final_0_68693_alpha0.1_kvanputt'
    26 time_dir3 = '20081031_133624_run_final_0_27255_alpha0.1_kvanputt'
    27 time_dir4 = '20081031_133735_run_final_0.6_27255_alpha0.1_kvanputt'
    28 time_dir5 = '20081031_133841_run_final_0_27283_alpha0.1_kvanputt'
    29 time_dir6 = '20081031_133925_run_final_0.6_27283_alpha0.1_kvanputt'
     29##time_dir2 = '20081031_133511_run_final_0_68693_alpha0.1_kvanputt'
     30##time_dir3 = '20081031_133624_run_final_0_27255_alpha0.1_kvanputt'
     31##time_dir4 = '20081031_133735_run_final_0.6_27255_alpha0.1_kvanputt'
     32##time_dir5 = '20081031_133841_run_final_0_27283_alpha0.1_kvanputt'
     33##time_dir6 = '20081031_133925_run_final_0.6_27283_alpha0.1_kvanputt'
    3034
    3135
    32 time_dirs = [time_dir1, time_dir2, time_dir3, time_dir4, time_dir5, time_dir6]
     36time_dirs = [time_dir1]#, time_dir2, time_dir3, time_dir4, time_dir5, time_dir6]
    3337
    3438for time_dir in time_dirs:
    3539
    3640    # Local variables...
    37     folder = output_dir + scenario_dir + time_dir + '\\'
     41    folder =  scenario_dir + output_dir + time_dir + '\\'
    3842    raster_gbd = folder + 'raster.gdb'
     43    land = scenario_dir + "map_work\\Perth.gdb\\poly_all_cut"
    3944   
    4045    # Process: Create File GDB...
    41     gp.CreateFileGDB_management(folder, "raster")
     46    #gp.CreateFileGDB_management(folder, "raster")
    4247
    4348    gp.Workspace = raster_gbd
     
    4752    #replication dictionary
    4853    replicate = (('perth', ''),('time_39900_0', 'b'), ('time_79800_0', 'c'),
    49                  ('_', ''),('Geordie', 'Geo'),('Sorrento', 'Sor'),
    50                  ('Fremantle', 'Fre'),('Rockingham', 'Roc'),('depth','_depth'),
    51                  ('speed', '_speed'), ('elevation', '_elev_'), ('stage','_stage'))
     54                 ('_', ''),('Geordie', 'Geo'),('Sorrento', 'Sor'), ('max','M_'),
     55                 ('Fremantle', 'Fre'),('Rockingham', 'Roc'),('depth','_dep_'),
     56                 ('speed', '_spe_'), ('elevation', '_ele_'), ('stage','_sta_'))
    5257
    5358    generate_filename = []
    54     input_ascii = glob.glob(folder + '*max.asc')
     59    input_ascii = glob.glob(folder + '*elevation.asc')
    5560
    5661    for infile in input_ascii:
     
    6368            sys.exit(10)
    6469        generate_filename.append(output_DEM)
    65 
    66         #print 'input %s and output %s' %(infile,output_DEM)
    67 
    68         # Process: ASCII to Raster (4)...
     70        print 'Output DEM ',output_DEM
     71        output_extract = output_DEM + 'E'
     72        print 'Output Extract ',output_extract
     73       
     74        print 'Process: ASCII to Raster'
    6975        gp.ASCIIToRaster_conversion(infile, output_DEM, "FLOAT")
    7076
    71         # Process: Define Projection (3)...
     77        print 'Process: Define Projection'
    7278        gp.DefineProjection_management(output_DEM, "PROJCS['GDA_1994_MGA_Zone_50',GEOGCS['GCS_GDA_1994',DATUM['D_GDA_1994',SPHEROID['GRS_1980',6378137.0,298.257222101]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]"
    7379                                                   ",PROJECTION['Transverse_Mercator'],PARAMETER['False_Easting',500000.0],PARAMETER['False_Northing',10000000.0],PARAMETER['Central_Meridian',117.0],PARAMETER['Scale_Factor',0.9996]"
    7480                                                   ",PARAMETER['Latitude_Of_Origin',0.0],UNIT['Meter',1.0]]")
    7581
     82##        print 'Process: Extract by Mask'
     83##        gp.ExtractByMask_sa(output_DEM, land, output_extract)
    7684
    7785
  • anuga_work/production/perth/export_results_max.py

    r5952 r6032  
    1313import project, os
    1414import sys
     15from anuga.lib.maxasc.maxasc import MaxAsc
    1516from anuga.shallow_water.data_manager import convert_dem_from_ascii2netcdf, dem2pts
    1617from anuga.shallow_water.data_manager import sww2dem
    1718from os import sep
    18 import maxasc
    1919
    2020directory = project.output_dir
     
    2727
    2828time_dir1 = '20081031_133353_run_final_0.6_68693_alpha0.1_kvanputt'
    29 time_dir2 = '20081031_133511_run_final_0_68693_alpha0.1_kvanputt'
    30 time_dir3 = '20081031_133624_run_final_0_27255_alpha0.1_kvanputt'
    31 time_dir4 = '20081031_133735_run_final_0.6_27255_alpha0.1_kvanputt'
    32 time_dir5 = '20081031_133841_run_final_0_27283_alpha0.1_kvanputt'
    33 time_dir6 = '20081031_133925_run_final_0.6_27283_alpha0.1_kvanputt'
     29##time_dir2 = '20081031_133511_run_final_0_68693_alpha0.1_kvanputt'
     30##time_dir3 = '20081031_133624_run_final_0_27255_alpha0.1_kvanputt'
     31##time_dir4 = '20081031_133735_run_final_0.6_27255_alpha0.1_kvanputt'
     32##time_dir5 = '20081031_133841_run_final_0_27283_alpha0.1_kvanputt'
     33##time_dir6 = '20081031_133925_run_final_0.6_27283_alpha0.1_kvanputt'
    3434
    35 time_dirs = [time_dir1, time_dir2, time_dir3, time_dir4, time_dir5, time_dir6]
     35time_dirs = [time_dir1]#, time_dir2, time_dir3, time_dir4, time_dir5, time_dir6]
    3636
    3737 
     
    4040#cellsize = 250
    4141
    42 timestep = None    # None means no timestep!
    43 #timestep = 0
     42#timestep = None    # None means no timestep!
     43timestep = 0
    4444
    4545######
     
    4747######
    4848
    49 area = ['Rockingham', 'Sorrento', 'Fremantle','Geordie' ]  # strings must match keys in var_equations below
    50 #area = ['All']      # 'All' means no special areas - the whole thing
     49#area = ['Perth'] #Rockingham', 'Sorrento', 'Fremantle','Geordie' ]  # strings must match keys in var_equations below
     50area = ['All']      # 'All' means no special areas - the whole thing
    5151
    5252######
     
    6161
    6262# one or more key strings from var_equations above
    63 var = ['depth', 'speed']
     63var = ['elevation']
    6464
    6565######
     
    9191
    9292            name1 = directory+time_dir+sep+project.scenario_name
    93             name2 = directory+time_dir+sep+project.scenario_name+'_time_39900_0'
    94             name3 = directory+time_dir+sep+project.scenario_name+'_time_79800_0'
     93            #name2 = directory+time_dir+sep+project.scenario_name+'_time_39180_0'
     94            #name3 = directory+time_dir+sep+project.scenario_name+'_time_78360_0'
    9595
    96             names = [name1, name2, name3]
     96            names = [name1] #, name2, name3]
    9797     
    9898            asc_name = []   
  • anuga_work/production/perth/get_timeseries.py

    r5761 r6032  
    1212"""
    1313
    14 from os import sep
     14from os import sep, rename, listdir, system
    1515from anuga.abstract_2d_finite_volumes.util import sww2csv_gauges,csv2timeseries_graphs
    1616import project
    1717
    18 timestamp1='20080815_103442_run_final_0.0_polyline_alpha0.1_kvanputt'
    19 timestamp2='20080815_103336_run_final_0.6_polyline_alpha0.1_kvanputt'
     18directory = project.output_dir
    2019
    21 timestamps = [timestamp1, timestamp2]
    22 for timestamp in timestamps:
     20##time_dir1 = '20081031_133353_run_final_0.6_68693_alpha0.1_kvanputt'
     21##time_dir2 = '20081031_133511_run_final_0_68693_alpha0.1_kvanputt'
     22##time_dir3 = '20081031_133624_run_final_0_27255_alpha0.1_kvanputt'
     23##time_dir4 = '20081031_133735_run_final_0.6_27255_alpha0.1_kvanputt'
     24##time_dir5 = '20081031_133841_run_final_0_27283_alpha0.1_kvanputt'
     25time_dir6 = '20081117_141914_run_final_0.6_27283_Rockingham_kvanputt'
    2326
    24     filename1=project.output_dir+timestamp+sep+project.scenario_name+'.sww'
    25     filename2=project.output_dir+timestamp+sep+'sww2'+sep+project.scenario_name+'_time_39900_0.sww'
     27time_dirs = [time_dir6] #1, time_dir2, time_dir3, time_dir4, time_dir5, time_dir6]
    2628
    27     filenames = [filename1, filename2]
    28     for filename in filenames:
     29for time_dir in time_dirs:
     30   
     31    name1 = directory+time_dir+sep+project.scenario_name
     32    name2 = directory+time_dir+sep+project.scenario_name+'_time_43380_0'
     33    #name3 = directory+time_dir+sep+project.scenario_name+'_time_78360_0'
    2934
    30         gauges = [project.gauges_dir_name, project.gauges_dir_name2]
    31         for gauge in gauges:
    32            
    33             sww2csv_gauges(filename,gauge,
    34                             quantities = ['stage','speed','depth','elevation'],
    35                             verbose=True)
    36                        
     35    names = [name1, name2] #, name3]
    3736
    38    
    39 
    40 
     37    for i, name in enumerate(names):
     38        gauge = project.gauges_dir_name
     39        out_name = 'gauge_%d_' % i
     40        sww2csv_gauges(name+'.sww',gauge,out_name = out_name,
     41                        quantities = ['stage','speed','depth','elevation'],
     42                        verbose=True)
     43##        for out_name in listdir(directory+time_dir):
     44##            #total_filename = directory+time_dir+sep+'All_' + out_name
     45##            if i == 0:
     46##               
     47##            else:
     48##                system('cat %s %s > %s' %(,out_name,))
     49##   
  • anuga_work/production/perth/project.py

    r5829 r6032  
    4343# Model specific parameters. One or all can be changed each time the
    4444# run_scenario script is executed
    45 tide = 0.6                #0.6
     45tide = 0.6               #0.6
    4646#event_number = 27255 # Java 9.3 worst case for Perth
    47 event_number = 68693 # Sumatra 9.2
    48 #event_number = 27283  # Java 9.3 original
     47#event_number = 68693 # Sumatra 9.2
     48event_number = 27283  # Java 9.3 original
    4949alpha = 0.1             # smoothing parameter for mesh
    5050friction=0.01           # manning's friction coefficient
     
    7777# Important to distinguish each run - ensure str(user) is included!
    7878# Note, the user is free to include as many parameters as desired
    79 dir_comment='_'+setup+'_'+str(tide)+'_'+str(event_number)+'_'+ 'alpha' +str(alpha)+'_'+str(user)
     79dir_comment='_'+setup+'_'+str(tide)+'_'+str(event_number)+'_'+ 'Rockingham_'+str(user)
    8080
    8181#------------------------------------------------------------------------------
     
    101101# gauges - used in get_timeseries.py
    102102gauge_name = 'perth.csv'
    103 gauge_name2 = 'thinned_MGA50.csv'
     103
     104#buildings - used in run_building_inundation.py
     105building = 'perth_res_combined'
     106
    104107
    105108# BOUNDING POLYGON - used in build_boundary.py and run_perth.py respectively
     
    182185
    183186#w here the directory of the gauges sit
    184 gauges_dir_name = gauges_dir + gauge_name       #used for get_timeseries.py
    185 gauges_dir_name2 = gauges_dir + gauge_name2     #used for get_timeseries.py
     187gauges_dir_name = gauges_dir + gauge_name      #used for get_timeseries.py
     188building_in_dir_name = gauges_dir + building + '.csv'    #used for run_building_inundation.py
    186189
    187190#------------------------------------------------------------------------------
     
    205208res_poly_all = 100000*res_factor
    206209
     210### Area of Interest 1 (Fremantle, increase to reach Perth)
     211##poly_aoi1 = read_polygon(polygons_dir+'CBD_increase.csv')
     212##res_aoi1 = 500*res_factor
     213
    207214# Area of Interest 1 (Fremantle)
    208215poly_aoi1 = read_polygon(polygons_dir+'CBD_coastal.csv')
     
    210217
    211218# Area of Interest 2 (Rockingham)
     219poly_aoi2 = read_polygon(polygons_dir+'rockingham_penguin_increase.csv')
     220res_aoi2 = 500*res_factor
     221
     222# Area of Interest 2 (Rockingham)
    212223poly_aoi2 = read_polygon(polygons_dir+'rockingham_penguin.csv')
    213224res_aoi2 = 500*res_factor
     
    226237
    227238# Area of Significance 1 (Garden Island and sand bank infront of Rockingham)
    228 poly_aos1 = read_polygon(polygons_dir+'garden_rockingham.csv')
     239poly_aos1 = read_polygon(polygons_dir+'garden_rockingham_increase.csv')
    229240res_aos1 = 1000*res_factor
    230241
     
    248259
    249260# Combined all regions, must check that all are included!
     261##interior_regions = [[poly_aoi2,res_aoi2], [poly_aos1,res_aos1]
     262##                     ,[poly_aos2,res_aos2],[poly_aos3,res_aos3]
     263##                     ,[poly_sw1,res_sw1], [poly_dw1,res_dw1]]
     264
    250265interior_regions = [[poly_aoi1,res_aoi1],[poly_aoi2,res_aoi2]
    251266                     ,[poly_aoi2a,res_aoi2a],[poly_aoi3,res_aoi3]
     
    287302ymaxRockingham = 6433000
    288303
     304#Fremantle and Perth extract ascii grid
     305xminPerth = 376000
     306xmaxPerth = 396000
     307yminPerth = 6449000
     308ymaxPerth = 6467000
     309
  • anuga_work/production/perth/run_perth.py

    r5817 r6032  
    226226   
    227227    kwargs={}
     228    kwargs['file_name']=project.dir_comment
    228229    kwargs['finaltime']=project.finaltime
    229230    kwargs['output_dir']=project.output_run_time_dir
  • anuga_work/production/perth/run_perth_250m.py

    r5787 r6032  
    224224   
    225225    kwargs={}
     226    kwargs['file_name']=project.dir_comment
    226227    kwargs['finaltime']=project_250m.finaltime
    227228    kwargs['output_dir']=project_250m.output_run_time_dir
Note: See TracChangeset for help on using the changeset viewer.