"""Script for running tsunami inundation scenario for Dampier, WA, Australia. Source data such as elevation and boundary data is assumed to be available in directories specified by project.py The output sww file is stored in project.output_time_dir The scenario is defined by a triangular mesh created from project.polygon, the elevation data and a simulated submarine landslide. Ole Nielsen and Duncan Gray, GA - 2005 and Jane Sexton, Nick Bartzis, GA - 2006 """ #------------------------------------------------------------------------------ # Import necessary modules #------------------------------------------------------------------------------ # Standard modules from os import sep from os.path import dirname, basename from os import mkdir, access, F_OK from shutil import copy import time import sys # Related major packages from anuga.shallow_water import Domain from anuga.shallow_water.data_manager import convert_dem_from_ascii2netcdf, dem2pts from anuga.geospatial_data.geospatial_data import * from anuga.shallow_water.data_manager import start_screen_catcher, copy_code_files,store_parameters # Application specific imports import project # Definition of file names and polygons #------------------------------------------------------------------------------ # Copy scripts to time stamped output directory and capture screen # output to file #------------------------------------------------------------------------------ copy_code_files(project.output_build_time_dir,__file__, dirname(project.__file__)+sep+ project.__name__+'.py' ) start_screen_catcher(project.output_build_time_dir) print 'USER: ', project.user #------------------------------------------------------------------------------- # Preparation of topographic data # # Convert ASC 2 DEM 2 PTS using source data and store result in source data # Do for coarse and fine data # Fine pts file to be clipped to area of interest #------------------------------------------------------------------------------- print"project.poly_all",project.poly_all print"project.combined_dir_name",project.combined_dir_name # topography directory filenames onshore_in_dir_name = project.onshore_in_dir_name coast_in_dir_name = project.coast_in_dir_name coast_in_dir_name1 = project.coast_in_dir_name1 offshore_in_dir_name = project.offshore_in_dir_name offshore_in_dir_name1 = project.offshore_in_dir_name1 offshore_in_dir_name2 = project.offshore_in_dir_name2 onshore_dir_name = project.onshore_dir_name coast_dir_name = project.coast_dir_name coast_dir_name1 = project.coast_dir_name1 offshore_dir_name = project.offshore_dir_name offshore_dir_name1 = project.offshore_dir_name1 offshore_dir_name2 = project.offshore_dir_name2 # creates DEM from asc data print "creates DEMs from ascii data" convert_dem_from_ascii2netcdf(onshore_in_dir_name, basename_out=onshore_dir_name, use_cache=True, verbose=True) #creates pts file for onshore DEM print "creates pts file for onshore DEM" dem2pts(onshore_dir_name, # easting_min=project.eastingmin, # easting_max=project.eastingmax, # northing_min=project.northingmin, # northing_max= project.northingmax, use_cache=True, verbose=True) #creates pts file for island DEM #dem2pts(island_dir_name, use_cache=True, verbose=True) print'create Geospatial data1 objects from topographies' G1 = Geospatial_data(file_name = onshore_dir_name + '.pts',verbose=True) G2 = Geospatial_data(file_name = coast_in_dir_name + '.txt',verbose=True) G3 = Geospatial_data(file_name = coast_in_dir_name1 + '.txt',verbose=True) G_off = Geospatial_data(file_name = offshore_in_dir_name + '.txt',verbose=True) G_off1 = Geospatial_data(file_name = offshore_in_dir_name1 + '.txt',verbose=True) G_off2 = Geospatial_data(file_name = offshore_in_dir_name2 + '.txt',verbose=True) print'add all geospatial objects' G = G1 + G2 + G3 + G_off + G_off1 + G_off2 print'clip combined geospatial object by bounding polygon' G_clipped = G.clip(project.poly_all) print'export combined DEM file' if access(project.topographies_dir,F_OK) == 0: mkdir (project.topographies_dir) G_clipped.export_points_file(project.combined_dir_name + '.txt') print'project.combined_dir_name + .txt',project.combined_dir_name + '.txt' #------------------------------------------------------------------------- # Convert URS to SWW file for boundary conditions #------------------------------------------------------------------------- print 'starting to create boundary conditions' from anuga.shallow_water.data_manager import urs2sww, urs_ungridded2sww boundaries_in_dir_name = project.boundaries_in_dir_name print 'boundaries_in_dir_name',project.boundaries_in_dir_name #import sys; sys.exit() urs_ungridded2sww(project.boundaries_in_dir_name, project.boundaries_in_dir_name, verbose=True, mint=4000, maxt=80000, zscale=1)