source: anuga_work/production/dampier_2006/build_dampier.py @ 3835

Last change on this file since 3835 was 3835, checked in by nick, 16 years ago

update to dampier

File size: 6.6 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.py
5The output sww file is stored in project.output_time_dir
6
7The scenario is defined by a triangular mesh created from project.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
26# Related major packages
27from anuga.shallow_water import Domain
28from anuga.shallow_water import Dirichlet_boundary
29from anuga.shallow_water import File_boundary
30from anuga.shallow_water import Reflective_boundary
31from anuga.shallow_water.data_manager import convert_dem_from_ascii2netcdf, dem2pts
32
33from anuga.pmesh.mesh_interface import create_mesh_from_regions
34
35from anuga.geospatial_data.geospatial_data import *
36
37# Application specific imports
38import project   # Definition of file names and polygons
39
40
41
42#------------------------------------------------------------------------------
43# Copy scripts to time stamped output directory and capture screen
44# output to file
45#------------------------------------------------------------------------------
46
47
48
49# creates copy of code in output dir if dir doesn't exist
50if access(project.output_time_dir,F_OK) == 0:
51    mkdir (project.output_time_dir)
52copy (dirname(project.__file__) +sep+ project.__name__+'.py',
53      project.output_time_dir + project.__name__+'.py')     #copies project.py
54copy (__file__, project.output_time_dir + basename(__file__))
55print 'project.output_time_dir',project.output_time_dir       #copies this file
56
57
58
59
60boundary_dir_name = project.boundary_dir_name
61
62
63from anuga.shallow_water.data_manager import urs2sww
64
65print 'minlat=project.north_boundary, maxlat=project.south_boundary',project.north_boundary, project.south_boundary
66print 'minlon= project.west_boundary, maxlon=project.east_boundary',project.west_boundary, project.east_boundary
67
68#import sys; sys.exit()
69urs2sww(boundary_dir_name,
70#        minlat=project.north_boundary, maxlat=project.south_boundary,
71#        minlon= project.west_boundary, maxlon=project.east_boundary,
72        verbose='true')
73       
74import sys; sys.exit()
75#-------------------------------------------------------------------------------
76# Preparation of topographic data
77#
78# Convert ASC 2 DEM 2 PTS using source data and store result in source data
79# Do for coarse and fine data
80# Fine pts file to be clipped to area of interest
81#-------------------------------------------------------------------------------
82
83# topography directory filenames
84onshore_dir_name = project.onshore_dir_name
85coast_dir_name = project.coast_dir_name
86islands_dir_name = project.islands_dir_name
87offshore_dir_name = project.offshore_dir_name
88offshore_dir_name1 = project.offshore_dir_name1
89offshore_dir_name2 = project.offshore_dir_name2
90offshore_dir_name3 = project.offshore_dir_name3
91offshore_dir_name4 = project.offshore_dir_name4
92offshore_dir_name5 = project.offshore_dir_name5
93offshore_dir_name6 = project.offshore_dir_name6
94offshore_dir_name7 = project.offshore_dir_name7
95offshore_dir_name8 = project.offshore_dir_name8
96offshore_dir_name9 = project.offshore_dir_name9
97offshore_dir_name10 = project.offshore_dir_name10
98offshore_dir_name11 = project.offshore_dir_name11
99offshore_dir_name12 = project.offshore_dir_name12
100offshore_dir_name13 = project.offshore_dir_name13
101offshore_dir_name14 = project.offshore_dir_name14
102
103
104
105# files to be used
106#file_used = []
107
108# creates DEM from asc data
109convert_dem_from_ascii2netcdf(onshore_dir_name, use_cache=True, verbose=True)
110convert_dem_from_ascii2netcdf(islands_dir_name, use_cache=True, verbose=True)
111
112#creates pts file for onshore DEM
113dem2pts(onshore_dir_name,
114#        easting_min=project.eastingmin,
115#        easting_max=project.eastingmax,
116#        northing_min=project.northingmin,
117#        northing_max= project.northingmax,
118        use_cache=True, 
119        verbose=True)
120
121
122#creates pts file for islands DEM
123dem2pts(islands_dir_name, use_cache=True, verbose=True)
124
125
126print'create G1'
127G1 = Geospatial_data(file_name = project.onshore_dir_name + '.pts')
128G2 = Geospatial_data(file_name = project.coast_dir_name + '.xya')
129G3 = Geospatial_data(file_name = project.islands_dir_name + '.pts')
130G_off = Geospatial_data(file_name = project.offshore_dir_name + '.xya')
131G_off1 = Geospatial_data(file_name = project.offshore_dir_name1 + '.xya')
132G_off2 = Geospatial_data(file_name = project.offshore_dir_name2 + '.xya')
133G_off3 = Geospatial_data(file_name = project.offshore_dir_name3 + '.xya')
134G_off4 = Geospatial_data(file_name = project.offshore_dir_name4 + '.xya')
135G_off5 = Geospatial_data(file_name = project.offshore_dir_name5 + '.xya')
136G_off6 = Geospatial_data(file_name = project.offshore_dir_name6 + '.xya')
137G_off7 = Geospatial_data(file_name = project.offshore_dir_name7 + '.xya')
138G_off8 = Geospatial_data(file_name = project.offshore_dir_name8 + '.xya')
139G_off9 = Geospatial_data(file_name = project.offshore_dir_name9 + '.xya')
140G_off10 = Geospatial_data(file_name = project.offshore_dir_name10 + '.xya')
141G_off11 = Geospatial_data(file_name = project.offshore_dir_name11 + '.xya')
142G_off12 = Geospatial_data(file_name = project.offshore_dir_name12 + '.xya')
143G_off13 = Geospatial_data(file_name = project.offshore_dir_name13 + '.xya')
144G_off14 = Geospatial_data(file_name = project.offshore_dir_name14 + '.xya')
145
146print'add G1+G2+G3+all offshore data'
147G = G1 + G2 + G3 + G_off + G_off1 + G_off2 + G_off3 + G_off4 + G_off5 \
148    + G_off6 + G_off7 + G_off8 + G_off9 + G_off10 + G_off11 + G_off12 \
149    + G_off13 + G_off14
150
151G.clip(project.bounding_polygon)
152#FIXME: add a clip function to pts
153
154print'export G'
155G.export_points_file(project.combined_dir_name + '.pts')
156import sys; sys.exit()
157
158
159
160#-------------------------------------------------------------------------
161# Convert URS to SWW file for boundary conditions
162#-------------------------------------------------------------------------
163
164# filenames
165meshname = project.mesh_name+'.msh'
166source_dir = project.boundarydir
167boundary_file = project.boundaryname
168
169print 'Available boundary tags', domain.get_boundary_tags()
170
171from anuga.shallow_water.data_manager import urs2sww
172
173urs2sww(boundary_file,
174        minlat=project.north_boundary, maxlat=project.south_boundary,
175        minlon= project.west_boundary, maxlon=project.east_boundary,
176        verbose='true')
177
178
179
180
181
182
Note: See TracBrowser for help on using the repository browser.