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

Last change on this file since 3827 was 3827, checked in by nick, 18 years ago

more dampier

File size: 6.4 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
65urs2sww(boundary_dir_name,
66#        minlat=project.north_boundary, maxlat=project.south_boundary,
67#        minlon= project.west_boundary, maxlon=project.east_boundary,
68        verbose='true')
69       
70import sys; sys.exit()
71#-------------------------------------------------------------------------------
72# Preparation of topographic data
73#
74# Convert ASC 2 DEM 2 PTS using source data and store result in source data
75# Do for coarse and fine data
76# Fine pts file to be clipped to area of interest
77#-------------------------------------------------------------------------------
78
79# topography directory filenames
80onshore_dir_name = project.onshore_dir_name
81coast_dir_name = project.coast_dir_name
82islands_dir_name = project.islands_dir_name
83offshore_dir_name = project.offshore_dir_name
84offshore_dir_name1 = project.offshore_dir_name1
85offshore_dir_name2 = project.offshore_dir_name2
86offshore_dir_name3 = project.offshore_dir_name3
87offshore_dir_name4 = project.offshore_dir_name4
88offshore_dir_name5 = project.offshore_dir_name5
89offshore_dir_name6 = project.offshore_dir_name6
90offshore_dir_name7 = project.offshore_dir_name7
91offshore_dir_name8 = project.offshore_dir_name8
92offshore_dir_name9 = project.offshore_dir_name9
93offshore_dir_name10 = project.offshore_dir_name10
94offshore_dir_name11 = project.offshore_dir_name11
95offshore_dir_name12 = project.offshore_dir_name12
96offshore_dir_name13 = project.offshore_dir_name13
97offshore_dir_name14 = project.offshore_dir_name14
98
99
100
101# files to be used
102#file_used = []
103
104# creates DEM from asc data
105convert_dem_from_ascii2netcdf(onshore_dir_name, use_cache=True, verbose=True)
106convert_dem_from_ascii2netcdf(islands_dir_name, use_cache=True, verbose=True)
107
108#creates pts file for onshore DEM
109dem2pts(onshore_dir_name,
110#        easting_min=project.eastingmin,
111#        easting_max=project.eastingmax,
112#        northing_min=project.northingmin,
113#        northing_max= project.northingmax,
114        use_cache=True, 
115        verbose=True)
116
117
118#creates pts file for islands DEM
119dem2pts(islands_dir_name, use_cache=True, verbose=True)
120
121
122print'create G1'
123G1 = Geospatial_data(file_name = project.onshore_dir_name + '.pts')
124G2 = Geospatial_data(file_name = project.coast_dir_name + '.xya')
125G3 = Geospatial_data(file_name = project.islands_dir_name + '.pts')
126G_off = Geospatial_data(file_name = project.offshore_dir_name + '.xya')
127G_off1 = Geospatial_data(file_name = project.offshore_dir_name1 + '.xya')
128G_off2 = Geospatial_data(file_name = project.offshore_dir_name2 + '.xya')
129G_off3 = Geospatial_data(file_name = project.offshore_dir_name3 + '.xya')
130G_off4 = Geospatial_data(file_name = project.offshore_dir_name4 + '.xya')
131G_off5 = Geospatial_data(file_name = project.offshore_dir_name5 + '.xya')
132G_off6 = Geospatial_data(file_name = project.offshore_dir_name6 + '.xya')
133G_off7 = Geospatial_data(file_name = project.offshore_dir_name7 + '.xya')
134G_off8 = Geospatial_data(file_name = project.offshore_dir_name8 + '.xya')
135G_off9 = Geospatial_data(file_name = project.offshore_dir_name9 + '.xya')
136G_off10 = Geospatial_data(file_name = project.offshore_dir_name10 + '.xya')
137G_off11 = Geospatial_data(file_name = project.offshore_dir_name11 + '.xya')
138G_off12 = Geospatial_data(file_name = project.offshore_dir_name12 + '.xya')
139G_off13 = Geospatial_data(file_name = project.offshore_dir_name13 + '.xya')
140G_off14 = Geospatial_data(file_name = project.offshore_dir_name14 + '.xya')
141
142print'add G1+G2+G3+all offshore data'
143G = G1 + G2 + G3 + G_off + G_off1 + G_off2 + G_off3 + G_off4 + G_off5 \
144    + G_off6 + G_off7 + G_off8 + G_off9 + G_off10 + G_off11 + G_off12 \
145    + G_off13 + G_off14
146
147G.clip(project.bounding_polygon)
148#FIXME: add a clip function to pts
149
150print'export G'
151G.export_points_file(project.combined_dir_name + '.pts')
152import sys; sys.exit()
153
154
155
156#-------------------------------------------------------------------------
157# Convert URS to SWW file for boundary conditions
158#-------------------------------------------------------------------------
159
160# filenames
161meshname = project.mesh_name+'.msh'
162source_dir = project.boundarydir
163boundary_file = project.boundaryname
164
165print 'Available boundary tags', domain.get_boundary_tags()
166
167from anuga.shallow_water.data_manager import urs2sww
168
169urs2sww(boundary_file,
170        minlat=project.north_boundary, maxlat=project.south_boundary,
171        minlon= project.west_boundary, maxlon=project.east_boundary,
172        verbose='true')
173
174
175
176
177
178
Note: See TracBrowser for help on using the repository browser.