Changeset 6027


Ignore:
Timestamp:
Nov 28, 2008, 11:48:45 AM (16 years ago)
Author:
kristy
Message:

general maintenance of scripts, added boundary to mesh in run_geraldton.py

Location:
anuga_work/production/geraldton
Files:
6 edited

Legend:

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

    r5929 r6027  
    22# This python script is an ArcGIS script that can only be run on a computer
    33# with and ArcGIS licence and version 2.4.1 python.
    4 # This script is designed to read in .asc files and deliever rasters with 
     4# This script is designed to read in .asc files and deliever rasters with
    55# projection (GDA94z50) held in a file geodatabase (called raster)
    66# written by Kristy Van Putten and Ross Wilson
     
    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")
     22gp.overwriteoutput = 1
    1823
    1924output_dir = "\\\\nas2\\gemd\\georisk_models\\inundation\\data\\western_australia\\"
    20 
    21 ##Geraldton
    2225scenario_dir="geraldton_tsunami_scenario\\anuga\\outputs\\"
    23 time_dir1 = "20081102_104418_run_final_0_27283_alpha0.1_kvanputt\\"
    24 time_dir2 = "20081102_104513_run_final_0.6_27283_alpha0.1_kvanputt\\"
    2526
    2627
    27 time_dirs = [time_dir1, time_dir2]
     28time_dir1 = '20081117_141443_run_final_0.6_27283_alpha0.1_kvanputt'
     29##time_dir2 = ''
     30##time_dir3 = ''
     31##time_dir4 = ''
     32##time_dir5 = ''
     33##time_dir6 = ''
    2834
     35time_dirs = [time_dir1] #, time_dir2, time_dir3, time_dir4, time_dir5, time_dir6]
     36 
    2937for time_dir in time_dirs:
    3038
    3139    # Local variables...
    32     folder = output_dir + scenario_dir + time_dir
    33     raster_gbd = output_dir + scenario_dir + time_dir + 'raster.gdb'
    34    
     40    folder = output_dir + scenario_dir + time_dir +'\\'
     41    raster_gbd = folder + 'raster.gdb'
     42    land = scenario_dir + "map_work\\\Geraldton.gdb\\outlines\\Clip_Topography"
     43
    3544    # Process: Create File GDB...
    3645    gp.CreateFileGDB_management(folder, "raster")
    3746
    3847    gp.Workspace = raster_gbd
     48
     49    #print gp.Workspace
    3950   
    4051    #replication dictionary
    41     replicate = (('geraldton', ''), ('time_41700_0', 'b'), ('_', ''))
     52    replicate = (('geraldton', ''),('_', ''),('max','M_'),
     53                 ('CBD', 'CDB'),
     54                 ('depth','_depth'),('speed', '_speed'),
     55                 ('elevation', '_ele_'), ('stage','_sta_'))
    4256
    4357    generate_filename = []
     
    5468        generate_filename.append(output_DEM)
    5569
    56         # Process: ASCII to Raster
     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'
    5775        gp.ASCIIToRaster_conversion(infile, output_DEM, "FLOAT")
    5876
    59         # Process: Define Projection
     77        print 'Process: Define Projection'
    6078        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]]"
    6179                                                   ",PROJECTION['Transverse_Mercator'],PARAMETER['False_Easting',500000.0],PARAMETER['False_Northing',10000000.0],PARAMETER['Central_Meridian',117.0],PARAMETER['Scale_Factor',0.9996]"
    6280                                                   ",PARAMETER['Latitude_Of_Origin',0.0],UNIT['Meter',1.0]]")
    6381
     82##        print 'Process: Extract by Mask'
     83##        gp.ExtractByMask_sa(output_DEM, land, output_extract)
    6484
     85
  • anuga_work/production/geraldton/build_boundary_27283.py

    r5804 r6027  
    100100    urs2sts(urs_filenames,
    101101            basename_out=os.path.join(project.boundaries_dir_event,scenario_name),
     102            zone=50,
    102103            ordering_filename=order_filename,
    103104            weights=weights,
  • anuga_work/production/geraldton/build_geraldton.py

    r5789 r6027  
    9292G_coast = Geospatial_data(file_name = coast_in_dir_name)
    9393print'create Geospatial data7 objects from topographies'
    94 G_off = Geospatial_data(file_name = offshore_in_dir_name)
     94G_off1 = Geospatial_data(file_name = offshore_in_dir_name)
    9595print'create Geospatial data8 objects from topographies'
    96 G_off1 = Geospatial_data(file_name = offshore_in_dir_name1)
     96G_off2 = Geospatial_data(file_name = offshore_in_dir_name1)
    9797print'create Geospatial data9 objects from topographies'
    98 G_off2 = Geospatial_data(file_name = offshore_in_dir_name2)
     98G_off3 = Geospatial_data(file_name = offshore_in_dir_name2)
    9999print'create Geospatial data10 objects from topographies'
    100 G_off3 = Geospatial_data(file_name = offshore_in_dir_name3)
     100G_off4 = Geospatial_data(file_name = offshore_in_dir_name3)
    101101
    102102#-------------------------------------------------------------------------------
     
    105105
    106106print 'clipping port data to area of significance'
    107 G_off2_clip = G_off2.clip(project.poly_CBD_1km, verbose=True)
     107G_off2_clip = G_off2.clip(project.poly_buffer_20m, verbose=True)
    108108print 'add all bathymetry files'
    109109G_off = G_off1 + G_off2_clip + G_off3 + G_off4
     
    113113
    114114print'add all geospatial objects'
    115 G = G1_clip + G2 + G3 + G_off_clip
     115G = G1_clip + G2 + G_off_clip
    116116
    117117print'clip combined geospatial object by bounding polygon'
  • anuga_work/production/geraldton/project.py

    r5829 r6027  
    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
    4747event_number = 68693 # Sumatra 9.2
     
    5050friction=0.01           # manning's friction coefficient
    5151starttime=0             
    52 finaltime=80000         # final time for simulation
     52finaltime=80000       # final time for simulation
    5353
    5454setup='final'  # Final can be replaced with trial or basic.
     
    5656               # faster, but less accurate, simulation.
    5757
     58if setup =='coarse':
     59    print'coarse'
     60    res_factor=10000000
     61    time_thinning=48
     62    yieldstep=240
    5863if setup =='trial':
    5964    print'trial'
     
    100105gauge_name2 = 'thinned_MGA50.csv'
    101106
     107#buildings - used in run_building_inundation.py
     108building = 'geraldton_res_clip'
     109
     110# barrier
     111barrier = 'CBD.csv'
     112barrier1 = 'wall.csv'
     113
    102114# BOUNDING POLYGON - used in build_boundary.py and run_geraldton.py respectively
    103115# NOTE: when files are put together the points must be in sequence - for ease go clockwise!
     
    156168# where the mesh sits (this is created during the run_geraldton.py)
    157169meshes_dir_name = meshes_dir + scenario_name+'.msh'
     170barrier_dir_name = meshes_dir + barrier
     171barrier_dir_name1 = meshes_dir + barrier1
    158172
    159173# where the boundary ordering files sit (this is used within build_boundary.py)
     
    172186output_run_time_dir_name = output_run_time_dir + scenario_name  #Used by post processing
    173187
    174 #w here the directory of the gauges sit
     188# where the directory of the gauges sit
    175189gauges_dir_name = gauges_dir + gauge_name       #used for get_timeseries.py
    176190gauges_dir_name2 = gauges_dir + gauge_name2     #used for get_timeseries.py
     191building_in_dir_name = gauges_dir + building + '.csv'    #used for run_building_inundation.py
    177192
    178193#------------------------------------------------------------------------------
     
    184199poly_mainland=read_polygon(polygons_dir +'land_initial_condition.csv')
    185200poly_ocean=read_polygon(polygons_dir +'ocean_initial_condition.csv')
     201poly_buffer_20m=read_polygon(polygons_dir +'buffer_20m.csv')
    186202
    187203# Initial bounding polygon for data clipping
  • anuga_work/production/geraldton/run_geraldton.py

    r5789 r6027  
    3838from anuga.shallow_water.data_manager import export_grid, create_sts_boundary
    3939from anuga.pmesh.mesh_interface import create_mesh_from_regions
     40from anuga.pmesh.mesh import importMeshFromFile
    4041from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files,store_parameters
    4142from anuga_parallel.parallel_abstraction import get_processor_name
     
    4445from anuga.fit_interpolate.benchmark_least_squares import mem_usage
    4546from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area, is_inside_polygon
    46 from anuga.geospatial_data.geospatial_data import find_optimal_smoothing_parameter
     47from anuga.geospatial_data.geospatial_data import find_optimal_smoothing_parameter,Geospatial_data
    4748from polygon import Polygon_function
    48    
     49
     50
    4951# Application specific imports
    5052import project  # Definition of file names and polygons
     
    109111                         interior_regions=project.interior_regions,
    110112                         filename=project.meshes_dir_name,
    111                          use_cache=True,
     113                         use_cache=False,
    112114                         verbose=True)
     115
     116    m = importMeshFromFile(project.meshes_dir_name)
     117    # load points from a points file
     118    m.add_points_and_segments(Geospatial_data(project.barrier_dir_name))
     119    m.add_points_and_segments(Geospatial_data(project.barrier_dir_name1))
     120    m.generate_mesh()
     121    m.export_mesh_file(project.meshes_dir_name)
    113122   
    114123    #-------------------------------------------------------------------------
     
    224233   
    225234    kwargs={}
     235    kwargs['file_name']=project.dir_comment
    226236    kwargs['finaltime']=project.finaltime
    227237    kwargs['output_dir']=project.output_run_time_dir
  • anuga_work/production/geraldton/run_geraldton_250m.py

    r5789 r6027  
    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.