source: anuga_work/production/shark_bay_2007/build_shark_bay.py @ 5563

Last change on this file since 5563 was 4616, checked in by ole, 17 years ago

Shark bay work

File size: 4.3 KB
Line 
1"""Script for running tsunami inundation scenario for Dampier, WA, Australia.
2
3Source data such as elevation and boundary data is assumed to be available in
4directories specified by project_urs.py
5The output sww file is stored in project.output_time_dir
6
7The scenario is defined by a triangular mesh created from project_urs.polygon,
8the elevation data and a simulated submarine landslide.
9
10Ole Nielsen and Duncan Gray, GA - 2005 and Jane Sexton, Nick Bartzis, GA - 2006
11"""
12
13#------------------------------------------------------------------------------
14# Import necessary modules
15#------------------------------------------------------------------------------
16
17# Standard modules
18from os import sep
19from os.path import dirname, basename
20from os import mkdir, access, F_OK
21from shutil import copy
22import time
23import sys
24
25# Related major packages
26from anuga.shallow_water import Domain
27from anuga.shallow_water import Dirichlet_boundary
28from anuga.shallow_water import File_boundary
29from anuga.shallow_water import Reflective_boundary
30from anuga.shallow_water.data_manager import convert_dem_from_ascii2netcdf
31from anuga.shallow_water.data_manager import dem2pts
32from anuga.pmesh.mesh_interface import create_mesh_from_regions
33from anuga.geospatial_data.geospatial_data import Geospatial_data
34from anuga.shallow_water.data_manager import start_screen_catcher
35from anuga.shallow_water.data_manager import copy_code_files
36from anuga.shallow_water.data_manager import urs_ungridded2sww
37from anuga_parallel.parallel_abstraction import get_processor_name
38
39# Application specific imports
40import project   # Definition of file names and polygons
41
42
43#------------------------------------------------------------------------------
44# Copy scripts to time stamped output directory and capture screen
45# output to file
46#------------------------------------------------------------------------------
47
48copy_code_files(project.output_build_time_dir,__file__, 
49               dirname(project.__file__)+sep+ project.__name__+'.py' )#
50
51start_screen_catcher(project.output_build_time_dir)
52
53print 'Processor Name:', get_processor_name()
54print 'User: ', project.user
55
56
57#-------------------------------------------------------------------------------
58# Preparation of topographic data
59#
60# Convert ASC 2 DEM 2 PTS using source data and store result in source data
61# Do for coarse and fine data
62# Fine pts file to be clipped to area of interest
63#-------------------------------------------------------------------------------
64
65print 'project.combined_dir_name', project.combined_dir_name
66
67
68geospatial_data = None
69# create DEMs from asc data
70
71# FIXME (Ole): Clip data by interior regions if possible
72
73print 'creating geospatial data objects from asc data (via dem and pts formats)'
74for filename in project.ascii_grid_filenames:
75    convert_dem_from_ascii2netcdf(filename,
76                                  basename_out=filename,
77                                  use_cache=True, verbose=True)
78    dem2pts(filename, use_cache=True, verbose=True)
79
80    geospatial_data += Geospatial_data(file_name=filename + '.pts',
81                                       verbose=True)
82
83
84print 'creating geospatial data objects from txt data'
85for filename in project.point_filenames:
86    geospatial_data += Geospatial_data(file_name=filename + '.txt',
87                                       verbose=True)
88
89
90print 'clip combined geospatial object by bounding polygon'
91G = geospatial_data.clip(project.bounding_polygon)
92
93
94print 'export combined geospatial data'
95if access(project.topographies_dir, F_OK) == 0:
96    mkdir (project.topographies_dir)
97G.export_points_file(project.combined_dir_name + '.pts')
98
99
100#print 'split combined data set'
101#G_small, _ = G.split(0.1, True)
102#
103#print 'export sub sampled DEM file'
104#G_small.export_points_file(project.combined_dir_name + '_small' + '.txt')
105
106
107 
108#-------------------------------------------------------------------------
109# Convert URS to SWW file for boundary conditions
110#-------------------------------------------------------------------------
111print 'converting boundary conditions to sww format'
112
113print 'boundary_dir', project.boundary_dir
114print 'project.boundary_name', project.boundary_name
115
116urs_ungridded2sww(project.boundary_name, verbose=True,
117                  mint=0, maxt=40000, zscale=1)
118
119
120print 'Finished building the %s scenario' %project.scenario_name
121
122
Note: See TracBrowser for help on using the repository browser.