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

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

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